diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 8d22c69f3..62cb2e46a 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -65,7 +65,7 @@ class MembersController < ApplicationController redirect_to parent_path end - def destroy + def remove end def add diff --git a/app/views/groups/_sidebar.html.haml b/app/views/groups/_sidebar.html.haml index 820d1f643..3a84d8935 100644 --- a/app/views/groups/_sidebar.html.haml +++ b/app/views/groups/_sidebar.html.haml @@ -9,7 +9,7 @@ %li{:class => (act == :edit && contr == :groups) ? 'active' : ''} = link_to t("layout.groups.edit"), edit_group_path(@group) - if can? :manage_members, @group - %li + %li{:class => (act == :edit && contr == :members) ? 'active' : ''} = link_to t("layout.groups.edit_members"), edit_group_members_path(@group) -#.block.notice diff --git a/app/views/members/edit.html.haml b/app/views/members/edit.html.haml index 2a6b01a91..55ac93a3e 100644 --- a/app/views/members/edit.html.haml +++ b/app/views/members/edit.html.haml @@ -1,46 +1,100 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.members.back_to_group"), parent_path - %li.active= link_to t("layout.members.edit"), edit_group_members_path(@group) - .content - .inner - = form_tag group_members_path(parent) do - %h2.title= t("layout.users.list_header") - %table.table - %tr - %th.first ID - %th= t("activerecord.attributes.user.name") - %th= t("activerecord.attributes.user.roles") - %th= t("activerecord.attributes.user.uname") - - #TODO: Replace this Chelyabinsk add/remove collaborators method by more human method - - @users.each do |user| - %tr{:class => cycle("odd", "even")} - %td - = user.id - %td - = link_to user.name, user_path(user) - %td - - Relation::ROLES.each do |role| - = check_box_tag "#{ role }[#{user.id}]", '1', ((parent.objects.exists? :object_id => user.id, :object_type => 'User', :role => role) ? :checked : nil), {:class => "user_role_chbx"} - = label_tag "#{ role }[#{user.id}]", t("layout.members.roles.#{ role }") - %td - = user.uname - .group.navform.wat-cf - %button.button{:type => "submit"} - = image_tag("choose.png", :alt => t("layout.save")) - = t("layout.save") - %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), group_path(parent), :class => "text_button_padding link_button" += form_tag group_members_path(@group), :id => 'members_form', :delete_url => remove_group_members_path(@group) do + = hidden_field_tag "_method", "post" + %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %thead + %tr + %th + \  + %th + = t("layout.collaborators.members") + %th{:colspan => "3"} + = t("layout.collaborators.roles") + %tbody + - @users.each do |user| + %tr#admin-table-members-row1 + %td + %span#niceCheckbox1.niceCheck-main{:onclick => "changeCheck(this)", :style => "background-position: 0px 0px; "} + = check_box_tag "user_remove[#{user.id}][]" + %td + .img + = image_tag(gravatar_url(user.email)) + .forimg= link_to user.name, user_path(user) + - Relation::ROLES.each_with_index do |role, i| + %td + .radio + = radio_button_tag "user[#{user.id}]", role, ((parent.objects.exists? :object_id => user.id, :object_type => 'User', :role => role) ? :checked : nil), :class => 'niceRadio' + -# f.radio_button "group[#{role}][#{group.id}]", '1', ((@project.relations.exists? :object_id => group.id, :object_type => 'Group', :role => role) ? :checked : nil) + -#%span.niceRadio.radioChecked + -# %input#myradio1{:checked => "checked", :name => "myradio", :tabindex => "1", :type => "radio", :value => "on"}/ + .forradio= t("layout.collaborators.role_names.#{ role }") + = link_to_function t("layout.delete"), "deleteAdminMember();", :class => 'button' + .both +.hr.top - = form_tag add_group_members_path(parent) do - .group - %h2.title= t("layout.members.add_member") - = label_tag "", t("layout.members.input_username") - = autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path - %br - .group.navform.wat-cf - %button.button{:type => "submit"} - = image_tag("choose.png", :alt => t("layout.add")) - = t("layout.add") += form_tag add_group_members_path(parent) do + .admin-search + = autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path#, :id_element => '#member_id_field' + .admin-role + .lineForm + = select_tag 'role', options_for_collaborators_roles_select + .both + -#.admin-search + -# = label_tag "group_uname", t("layout.collaborators.input_groupname") + -# = autocomplete_field_tag 'group_id', params[:group_id], autocomplete_group_uname_groups_path, :id_element => '#group_id_field' + =# hidden_field_tag 'member_id', nil, :id => 'member_id_field' + =# hidden_field_tag 'group_id', nil, :id => 'group_id_field' + %br + = submit_tag t("layout.add"), :class => 'button' +.hr.bottom +.both += link_to_function t("layout.save"), "saveAdminMember();", :class => 'button' + +- content_for :sidebar, render('groups/sidebar') + +-#.block +-# .secondary-navigation +-# %ul.wat-cf +-# %li.first= link_to t("layout.members.back_to_group"), parent_path +-# %li.active= link_to t("layout.members.edit"), edit_group_members_path(@group) +-# .content +-# .inner +-# = form_tag group_members_path(parent) do +-# %h2.title= t("layout.users.list_header") +-# %table.table +-# %tr +-# %th.first ID +-# %th= t("activerecord.attributes.user.name") +-# %th= t("activerecord.attributes.user.roles") +-# %th= t("activerecord.attributes.user.uname") +-# - #TODO: Replace this Chelyabinsk add/remove collaborators method by more human method +-# - @users.each do |user| +-# %tr{:class => cycle("odd", "even")} +-# %td +-# = user.id +-# %td +-# = link_to user.name, user_path(user) +-# %td +-# - Relation::ROLES.each do |role| +-# = check_box_tag "#{ role }[#{user.id}]", '1', ((parent.objects.exists? :object_id => user.id, :object_type => 'User', :role => role) ? :checked : nil), {:class => "user_role_chbx"} +-# = label_tag "#{ role }[#{user.id}]", t("layout.members.roles.#{ role }") +-# %td +-# = user.uname +-# .group.navform.wat-cf +-# %button.button{:type => "submit"} +-# = image_tag("choose.png", :alt => t("layout.save")) +-# = t("layout.save") +-# %span.text_button_padding= t("layout.or") +-# = link_to t("layout.cancel"), group_path(parent), :class => "text_button_padding link_button" +-# +-# = form_tag add_group_members_path(parent) do +-# .group +-# %h2.title= t("layout.members.add_member") +-# = label_tag "", t("layout.members.input_username") +-# = autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path +-# %br +-# .group.navform.wat-cf +-# %button.button{:type => "submit"} +-# = image_tag("choose.png", :alt => t("layout.add")) +-# = t("layout.add") +-# diff --git a/config/routes.rb b/config/routes.rb index b19755d07..7783d1ba0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -164,6 +164,7 @@ Rosa::Application.routes.draw do get :edit post :add post :update + delete :remove end member do post :update