diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 33f8352f57..fe7dad04a8 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -9,8 +9,7 @@ <% end %> - <% if User.current.allowed_to?(:log_time, @project) %> -
<%= l(:button_log_time) %> +
<%= l(:button_log_time) %> <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %>
@@ -25,8 +24,7 @@

<%= custom_field_tag_with_label :time_entry, value %>

<% end %> <% end %> -
- <% end %> +
<% if @issue.notes_addable? %>
<%= l(:field_notes) %> <%= f.text_area :notes, :cols => 60, :rows => 10, :class => 'wiki-edit', diff --git a/app/views/issues/edit.js.erb b/app/views/issues/edit.js.erb index 8c94aecebd..ef04553e0c 100644 --- a/app/views/issues/edit.js.erb +++ b/app/views/issues/edit.js.erb @@ -1,7 +1,7 @@ replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>'); <% if User.current.allowed_to?(:log_time, @issue.project) %> - $('#log_time').show(); + $('#log_time').removeClass('hidden'); <% else %> - $('#log_time').hide(); + $('#log_time').addClass('hidden'); <% end %> diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index a8296b9bc3..7d17098768 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -5551,14 +5551,18 @@ class IssuesControllerTest < Redmine::ControllerTest @request.session[:user_id] = 2 Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time] get(:edit, :params => {:id => 1}) - assert_select 'input[name=?]', 'time_entry[hours]' + assert_select '#log_time:not(.hidden)' do + assert_select 'input[name=?]', 'time_entry[hours]' + end end def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission @request.session[:user_id] = 2 Role.find_by_name('Manager').remove_permission! :log_time get(:edit, :params => {:id => 1}) - assert_select 'input[name=?]', 'time_entry[hours]', 0 + assert_select '#log_time.hidden' do + assert_select 'input[name=?]', 'time_entry[hours]' + end end def test_get_edit_with_params