Cleanup groups view on profile page

This commit is contained in:
wvengen 2014-12-16 21:09:04 +01:00
parent b080fb5fda
commit bf6a31a032
3 changed files with 32 additions and 17 deletions

View file

@ -9,15 +9,28 @@
= render :partial => 'shared/user_form_fields', :locals => {:f => f, :password_autocomplete => 'store-only'}
.form-actions
= submit_tag t('ui.save'), class: 'btn'
.span5
%h2= t '.groups.title'
%table.table.table-striped
- @current_user.memberships.each do |membership|
- if @current_user.ordergroup
%h3= User.human_attribute_name(:ordergroup, count: 1)
%table.table.table-striped
%tr
%td= membership.group.name
%td= link_to t('.groups.invite'), new_invite_path(id: membership.group_id),
remote: true, class: 'btn btn-success btn-small'
- if membership.group.type != 'Ordergroup'
%td= link_to t('.groups.cancel'), cancel_membership_path(membership_id: membership),
:data => {confirm: t('.groups.cancel_confirm')}, method: :post,
class: 'btn btn-danger btn-small'
%td
- if @current_user.ordergroup.users.count > 1
%strong= @current_user.ordergroup.name + ':'
= @current_user.ordergroup.users.map{|u| show_user u}.join(', ')
- else
= @current_user.ordergroup.name
%td.right
= link_to t('.groups.invite'), new_invite_path(id: @current_user.ordergroup),
remote: true, class: 'btn btn-success btn-small'
- if @current_user.workgroups.count > 0
%h3= User.human_attribute_name(:workgroup, count: 2)
%table.table.table-striped
- @current_user.workgroups.each do |workgroup|
%tr
%td= workgroup.name
%td.right
= link_to t('.groups.cancel'), cancel_membership_path(group_id: workgroup),
:data => {confirm: t('.groups.cancel_confirm')}, method: :post,
class: 'btn btn-danger btn-small'