Skip to content

Commit

Permalink
Show last user activity in admin ordergroups too
Browse files Browse the repository at this point in the history
  • Loading branch information
wvengen committed Mar 4, 2016
1 parent 8b8693d commit d56828f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 10 additions & 0 deletions app/helpers/admin/ordergroups_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Admin::OrdergroupsHelper
def ordergroup_members_title(ordergroup)
s = ''
s += ordergroup.users.map(&:name).join(', ') if ordergroup.users.any?
if ordergroup.contact_person.present?
s += "\n" + Ordergroup.human_attribute_name(:contact) + ": " + ordergroup.contact_person
end
s
end
end
9 changes: 5 additions & 4 deletions app/views/admin/ordergroups/_ordergroups.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
%thead
%tr
%th= heading_helper Ordergroup, :name
%th= heading_helper Ordergroup, :contact
%th= heading_helper Ordergroup, :contact_address
%th= heading_helper Ordergroup, :user_tokens
%th= heading_helper Ordergroup, :contact_address
%th= heading_helper Ordergroup, :last_user_activity
%th= t 'ui.actions'
%tbody
- for ordergroup in @ordergroups
%tr{:class => cycle('even','odd', :name => 'groups')}
%td= link_to ordergroup.name, [:admin, ordergroup]
%td= ordergroup.contact
%td{title: ordergroup_members_title(ordergroup)}
%abbr{title: ordergroup_members_title(ordergroup)}= ordergroup.users.size
%td= link_to_gmaps ordergroup.contact_address
%td= ordergroup.users.size
%td= format_date ordergroup.last_user_activity
%td
= link_to t('ui.edit'), edit_admin_ordergroup_path(ordergroup), class: 'btn btn-mini'
= link_to t('ui.delete'), [:admin, ordergroup], :data => {:confirm => t('admin.confirm', name: ordergroup.name)},
Expand Down

0 comments on commit d56828f

Please sign in to comment.