Defect #34641 » 34641-v2.patch
app/views/issues/_edit.html.erb | ||
---|---|---|
9 | 9 |
</div> |
10 | 10 |
</fieldset> |
11 | 11 |
<% end %> |
12 |
<% if User.current.allowed_to?(:log_time, @project) %> |
|
13 |
<fieldset class="tabular"><legend><%= l(:button_log_time) %></legend> |
|
12 |
<fieldset id="log_time" class="tabular<%= ' hidden' unless User.current.allowed_to?(:log_time, @project) %>"><legend><%= l(:button_log_time) %></legend> |
|
14 | 13 |
<%= labelled_fields_for :time_entry, @time_entry do |time_entry| %> |
15 | 14 |
<div class="splitcontent"> |
16 | 15 |
<div class="splitcontentleft"> |
... | ... | |
25 | 24 |
<p><%= custom_field_tag_with_label :time_entry, value %></p> |
26 | 25 |
<% end %> |
27 | 26 |
<% end %> |
28 |
</fieldset> |
|
29 |
<% end %> |
|
27 |
</fieldset> |
|
30 | 28 |
<% if @issue.notes_addable? %> |
31 | 29 |
<fieldset><legend><%= l(:field_notes) %></legend> |
32 | 30 |
<%= f.text_area :notes, :cols => 60, :rows => 10, :class => 'wiki-edit', |
app/views/issues/edit.js.erb | ||
---|---|---|
1 | 1 |
replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>'); |
2 | 2 | |
3 | 3 |
<% if User.current.allowed_to?(:log_time, @issue.project) %> |
4 |
$('#log_time').show();
|
|
4 |
$('#log_time').removeClass('hidden');
|
|
5 | 5 |
<% else %> |
6 |
$('#log_time').hide();
|
|
6 |
$('#log_time').addClass('hidden');
|
|
7 | 7 |
<% end %> |
test/functional/issues_controller_test.rb | ||
---|---|---|
5551 | 5551 |
@request.session[:user_id] = 2 |
5552 | 5552 |
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time] |
5553 | 5553 |
get(:edit, :params => {:id => 1}) |
5554 |
assert_select 'input[name=?]', 'time_entry[hours]' |
|
5554 |
assert_select '#log_time:not(.hidden)' do |
|
5555 |
assert_select 'input[name=?]', 'time_entry[hours]' |
|
5556 |
end |
|
5555 | 5557 |
end |
5556 | 5558 | |
5557 | 5559 |
def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission |
5558 | 5560 |
@request.session[:user_id] = 2 |
5559 | 5561 |
Role.find_by_name('Manager').remove_permission! :log_time |
5560 | 5562 |
get(:edit, :params => {:id => 1}) |
5561 |
assert_select 'input[name=?]', 'time_entry[hours]', 0 |
|
5563 |
assert_select '#log_time.hidden' do |
|
5564 |
assert_select 'input[name=?]', 'time_entry[hours]' |
|
5565 |
end |
|
5562 | 5566 |
end |
5563 | 5567 | |
5564 | 5568 |
def test_get_edit_with_params |