From d370e067464d11b3d4ddde5865254ed1f463773e Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Fri, 26 Apr 2019 09:47:12 +0000 Subject: [PATCH] Show locked badge for protected pages --- app/views/wiki/show.html.erb | 11 +++++++---- test/functional/wiki_controller_test.rb | 10 ++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 93a3583..92f86e8 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -82,12 +82,15 @@ -<% if User.current.allowed_to?(:view_wiki_edits, @project) %>

- <%= wiki_content_update_info(@content) %> - · <%= link_to l(:label_x_revisions, :count => @content.version), {:action => 'history', :id => @page.title} %> + <% if User.current.allowed_to?(:view_wiki_edits, @project) %> + <%= wiki_content_update_info(@content) %> + · <%= link_to l(:label_x_revisions, :count => @content.version), {:action => 'history', :id => @page.title} %> + <% end %> + <% if @page.protected? %> + <%= l('status_locked') %> + <% end %>

-<% end %> <% other_formats_links do |f| %> <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index b416f8a..c3d7563 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -176,6 +176,16 @@ class WikiControllerTest < Redmine::ControllerTest assert_select 'textarea[name=?]', 'content[text]' end + def test_show_protected_page_shoud_show_locked_badge + @request.session[:user_id] = 2 + + get :show, :params => {:project_id => 1, :id => 'CookBook_documentation'} + + assert_select 'p.wiki-update-info' do + assert_select 'span.badge.badge-status-locked' + end + end + def test_get_new @request.session[:user_id] = 2 -- 2.1.4