#345: refactoring
This commit is contained in:
parent
1217bdad88
commit
0b626f90fa
|
@ -2,6 +2,7 @@ class Groups::MembersController < Groups::BaseController
|
||||||
before_filter -> { authorize! :manage_members, @group }
|
before_filter -> { authorize! :manage_members, @group }
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@members = @group.members.order(:uname) - [@group.owner]
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
%th= t("layout.collaborators.members")
|
%th= t("layout.collaborators.members")
|
||||||
%th{colspan: "3"}= t("layout.collaborators.roles")
|
%th{colspan: "3"}= t("layout.collaborators.roles")
|
||||||
%tbody
|
%tbody
|
||||||
- (@group.members - [@group.owner]).each do |user|
|
- actors = @group.actors.where(actor_id: @members.map(&:id), actor_type: 'User')
|
||||||
|
- @members.each do |user|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%span#niceCheckbox1.niceCheck-main= check_box_tag "user_remove[#{user.id}][]"
|
%span#niceCheckbox1.niceCheck-main= check_box_tag "user_remove[#{user.id}][]"
|
||||||
|
@ -18,7 +19,8 @@
|
||||||
.forimg= link_to user.fullname, user_path(user)
|
.forimg= link_to user.fullname, user_path(user)
|
||||||
- Relation::ROLES.each_with_index do |role, i|
|
- Relation::ROLES.each_with_index do |role, i|
|
||||||
%td
|
%td
|
||||||
.radio= radio_button_tag "user[#{user.id}]", role, ((@group.actors.exists? actor_id: user.id, actor_type: 'User', role: role) ? :checked : nil), class: 'niceRadio'
|
- checked = actors.find{ |a| a.actor_id == user.id && a.role == role }
|
||||||
|
.radio= radio_button_tag "user[#{user.id}]", role, (checked ? :checked : nil), class: 'niceRadio'
|
||||||
.forradio= t("layout.collaborators.role_names.#{ role }")
|
.forradio= t("layout.collaborators.role_names.#{ role }")
|
||||||
= link_to_function t("layout.delete"), "deleteAdminMember();", class: 'button'
|
= link_to_function t("layout.delete"), "deleteAdminMember();", class: 'button'
|
||||||
.both
|
.both
|
||||||
|
|
Loading…
Reference in New Issue