Project

General

Profile

Feature #9634 » 0001-Show-locked-badge-for-protected-pages.patch

Marius BĂLTEANU, 2019-04-26 12:59

View differences:

app/views/wiki/show.html.erb
82 82
</div>
83 83
</fieldset>
84 84

  
85
<% if User.current.allowed_to?(:view_wiki_edits, @project) %>
86 85
<p class="wiki-update-info">
87
  <%= wiki_content_update_info(@content) %>
88
 · <%= link_to l(:label_x_revisions, :count => @content.version), {:action => 'history', :id => @page.title} %>
86
  <% if User.current.allowed_to?(:view_wiki_edits, @project) %>
87
    <%= wiki_content_update_info(@content) %>
88
    · <%= link_to l(:label_x_revisions, :count => @content.version), {:action => 'history', :id => @page.title} %>
89
  <% end %>
90
  <% if @page.protected? %>
91
    <span class="badge badge-status-locked"><%= l('status_locked') %></span>
92
  <% end %>
89 93
</p>
90
<% end %>
91 94

  
92 95
<% other_formats_links do |f| %>
93 96
  <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %>
test/functional/wiki_controller_test.rb
176 176
    assert_select 'textarea[name=?]', 'content[text]'
177 177
  end
178 178

  
179
  def test_show_protected_page_shoud_show_locked_badge
180
    @request.session[:user_id] = 2
181

  
182
    get :show, :params => {:project_id => 1, :id => 'CookBook_documentation'}
183

  
184
    assert_select 'p.wiki-update-info' do
185
      assert_select 'span.badge.badge-status-locked'
186
    end
187
  end
188

  
179 189
  def test_get_new
180 190
    @request.session[:user_id] = 2
181 191

  
(5-5/5)