Defect #34641 » 34641.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"><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>
|
|
| 28 |
<%= javascript_tag("$('#log_time').hide();") unless User.current.allowed_to?(:log_time, @project) %>
|
|
| 30 | 29 |
<% if @issue.notes_addable? %> |
| 31 | 30 |
<fieldset><legend><%= l(:field_notes) %></legend> |
| 32 | 31 |
<%= f.text_area :notes, :cols => 60, :rows => 10, :class => 'wiki-edit', |
| test/functional/issues_controller_test.rb | ||
|---|---|---|
| 5539 | 5539 |
@request.session[:user_id] = 2 |
| 5540 | 5540 |
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
|
| 5541 | 5541 |
get(:edit, :params => {:id => 1})
|
| 5542 |
assert_select 'input[name=?]', 'time_entry[hours]' |
|
| 5542 |
assert_select '#log_time' do |
|
| 5543 |
assert_select 'input[name=?]', 'time_entry[hours]' |
|
| 5544 |
end |
|
| 5545 |
assert_no_match /#{Regexp.quote("$('#log_time').hide();")}/, response.body
|
|
| 5543 | 5546 |
end |
| 5544 | 5547 | |
| 5545 | 5548 |
def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission |
| 5546 | 5549 |
@request.session[:user_id] = 2 |
| 5547 | 5550 |
Role.find_by_name('Manager').remove_permission! :log_time
|
| 5548 | 5551 |
get(:edit, :params => {:id => 1})
|
| 5549 |
assert_select 'input[name=?]', 'time_entry[hours]', 0 |
|
| 5552 |
assert_select '#log_time' do |
|
| 5553 |
assert_select 'input[name=?]', 'time_entry[hours]' |
|
| 5554 |
end |
|
| 5555 |
assert_match /#{Regexp.quote("$('#log_time').hide();")}/, response.body
|
|
| 5550 | 5556 |
end |
| 5551 | 5557 | |
| 5552 | 5558 |
def test_get_edit_with_params |