Skip to content

Commit

Permalink
closes #62: booking_list show resume button now when user_id of curre…
Browse files Browse the repository at this point in the history
…nt user and owner matches instead of relying on a parameter
  • Loading branch information
Robert Kranz committed Jul 11, 2013
1 parent 63d8549 commit e5e37eb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/models/time_booking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def update_time(start, stop)
self.time_entry.update_attributes!(:spent_on => start, :hours => self.hours_spent) #also update TimeEntry
end

def user_id
self.time_entry.user_id
end

def activity_id
self.time_entry.activity_id
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/time_bookings/_list_bookings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<% end %>

<tr id="booking-entry-<%= entry.id %>" class="hascontextmenu entry <%= cycle('odd', 'even') %>">
<%= render :partial => 'time_bookings/list_entry', :locals => {:entry => entry, :query => query, :show_resume => true} %>
<%= render :partial => 'time_bookings/list_entry', :locals => {:entry => entry, :query => query} %>
</tr>
<% end -%>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion app/views/time_bookings/_list_entry.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= raw query.columns.map { |column| "<td class=\"#{column.css_classes}\">#{column_content(column, entry)}</td>" }.join %>
<td>
<% tt = TimeTracker.where(:user_id => User.current.id).first %>
<% if show_resume && tt.nil? && User.current.allowed_to_globally?({:controller => 'time_trackers', :action => 'start'}, {}) %>
<% if entry.user_id == User.current.id && tt.nil? && User.current.allowed_to_globally?({:controller => 'time_trackers', :action => 'start'}, {}) %>
<%= link_to '',
{:controller => 'time_trackers', :action => 'start', :time_tracker => {:issue_id => entry.virtual? ? nil : entry.time_entry.issue.id, :comments => entry.comments}},
:class => 'icon-start tt_list_button'
Expand Down
2 changes: 1 addition & 1 deletion app/views/tt_bookings_list/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<% end %>

<tr id="booking-entry-<%= entry.id %>" class="hascontextmenu entry <%= cycle('odd', 'even') %>">
<%= render :partial => 'time_bookings/list_entry', :locals => {:entry => entry, :query => query, :show_resume => false} %>
<%= render :partial => 'time_bookings/list_entry', :locals => {:entry => entry, :query => query} %>
</tr>
<% end -%>
</tbody>
Expand Down

0 comments on commit e5e37eb

Please sign in to comment.