<%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
</span>
</p>
+
<% if User.current.allowed_to?(:log_time_for_other_users, @project) %>
<p><%= f.select :user_id, user_collection_for_select_options(@time_entry), :required => true %></p>
+ <% elsif !@time_entry.new_record? %>
+ <p>
+ <%= f.label_for_field :user_id %>
+ <span><%= link_to_user(@time_entry.user) %></span>
+ </p>
<% end %>
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
<p><%= f.hours_field :hours, :size => 6, :required => true %></p>
<ul id="bulk-selection">
<% @time_entries.each do |entry| %>
- <%= content_tag 'li',
- link_to("#{format_date(entry.spent_on)} - #{entry.project}: #{l(:label_f_hour_plural, :value => entry.hours)}", edit_time_entry_path(entry)) %>
+ <%=
+ content_tag 'li',
+ link_to(
+ "#{format_date(entry.spent_on)} - #{entry.project}: #{l(:label_f_hour_plural, :value => entry.hours)} (#{entry.user})",
+ edit_time_entry_path(entry)
+ )
+ %>
<% end %>
</ul>
}
);
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
# blank option for project
assert_select 'option[value=""]'
end
+ assert_select 'label[for=?]', 'time_entry_user_id', 0
+ assert_select 'select[name=?]', 'time_entry[user_id]', 0
end
def test_new_with_project_id
assert_response :success
assert_select 'form[action=?]', '/time_entries/2'
+
+ # Time entry user should be shown as text
+ # for user without permission to log time for other users
+ assert_select 'label[for=?]', 'time_entry_user_id', 1
+ assert_select 'a.user.active', :text => 'Redmine Admin'
end
def test_get_edit_with_an_existing_time_entry_with_inactive_activity
assert_select 'ul#bulk-selection' do
assert_select 'li', 2
- assert_select 'li a', :text => '03/23/2007 - eCookbook: 4.25 hours'
+ assert_select 'li a', :text => '03/23/2007 - eCookbook: 4.25 hours (John Smith)'
end
assert_select 'form#bulk_edit_form[action=?]', '/time_entries/bulk_update' do