0001-Show-time-entry-user-info-in-edit-page-also-for-user.patch

Marius BALTEANU, 2020-03-14 17:38

Download (2.12 KB)

View differences:

app/views/timelog/_form.html.erb
16 16
      <%=  link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
17 17
    </span>
18 18
  </p>
19

  
19 20
  <% if User.current.allowed_to?(:log_time_for_other_users, @project) %>
20 21
    <p><%= f.select :user_id, user_collection_for_select_options(@time_entry), :required => true %></p>
22
  <% elsif !@time_entry.new_record? %>
23
    <p>
24
      <%= f.label_for_field :user_id %>
25
      <span><%= link_to_user(@time_entry.user) %></span>
26
    </p>
21 27
  <% end %>
22 28
  <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
23 29
  <p><%= f.hours_field :hours, :size => 6, :required => true %></p>
test/functional/timelog_controller_test.rb
46 46
      # blank option for project
47 47
      assert_select 'option[value=""]'
48 48
    end
49
    assert_select 'label[for=?]', 'time_entry_user_id', 0
50
    assert_select 'select[name=?]', 'time_entry[user_id]', 0
49 51
  end
50 52

  
51 53
  def test_new_with_project_id
......
150 152
    assert_response :success
151 153

  
152 154
    assert_select 'form[action=?]', '/time_entries/2'
155

  
156
    # Time entry user should be shown as text
157
    # for user without permission to log time for other users
158
    assert_select 'label[for=?]', 'time_entry_user_id', 1
159
    assert_select 'a.user.active', :text => 'Redmine Admin'
153 160
  end
154 161

  
155 162
  def test_get_edit_with_an_existing_time_entry_with_inactive_activity
156
-