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 %thead
%tr %tr
%th= heading_helper Ordergroup, :name %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, :user_tokens
%th= heading_helper Ordergroup, :contact_address
%th= heading_helper Ordergroup, :last_user_activity
%th= t 'ui.actions' %th= t 'ui.actions'
%tbody %tbody
- for ordergroup in @ordergroups - for ordergroup in @ordergroups
%tr{:class => cycle('even','odd', :name => 'groups')} %tr{:class => cycle('even','odd', :name => 'groups')}
%td= link_to ordergroup.name, [:admin, ordergroup] %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= link_to_gmaps ordergroup.contact_address
%td= ordergroup.users.size %td= format_date ordergroup.last_user_activity
%td %td
= link_to t('ui.edit'), edit_admin_ordergroup_path(ordergroup), class: 'btn btn-mini' = 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)}, = link_to t('ui.delete'), [:admin, ordergroup], :data => {:confirm => t('admin.confirm', name: ordergroup.name)},