Show last user activity in admin ordergroups too

This commit is contained in:
wvengen 2016-03-04 16:28:18 +01:00
parent 8b8693df5a
commit d56828fa4d
2 changed files with 15 additions and 4 deletions

View File

@ -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

View File

@ -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)},