[refs #232] Add group members edit page design

This commit is contained in:
konstantin.grabar 2012-03-01 18:23:26 +04:00
parent 71748ebddc
commit fc3d4c0b6d
4 changed files with 101 additions and 46 deletions

View File

@ -65,7 +65,7 @@ class MembersController < ApplicationController
redirect_to parent_path redirect_to parent_path
end end
def destroy def remove
end end
def add def add

View File

@ -9,7 +9,7 @@
%li{:class => (act == :edit && contr == :groups) ? 'active' : ''} %li{:class => (act == :edit && contr == :groups) ? 'active' : ''}
= link_to t("layout.groups.edit"), edit_group_path(@group) = link_to t("layout.groups.edit"), edit_group_path(@group)
- if can? :manage_members, @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) = link_to t("layout.groups.edit_members"), edit_group_members_path(@group)
-#.block.notice -#.block.notice

View File

@ -1,46 +1,100 @@
.block = form_tag group_members_path(@group), :id => 'members_form', :delete_url => remove_group_members_path(@group) do
.secondary-navigation = hidden_field_tag "_method", "post"
%ul.wat-cf %table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%li.first= link_to t("layout.members.back_to_group"), parent_path %thead
%li.active= link_to t("layout.members.edit"), edit_group_members_path(@group) %tr
.content %th
.inner \ 
= form_tag group_members_path(parent) do %th
%h2.title= t("layout.users.list_header") = t("layout.collaborators.members")
%table.table %th{:colspan => "3"}
%tr = t("layout.collaborators.roles")
%th.first ID %tbody
%th= t("activerecord.attributes.user.name") - @users.each do |user|
%th= t("activerecord.attributes.user.roles") %tr#admin-table-members-row1
%th= t("activerecord.attributes.user.uname") %td
- #TODO: Replace this Chelyabinsk add/remove collaborators method by more human method %span#niceCheckbox1.niceCheck-main{:onclick => "changeCheck(this)", :style => "background-position: 0px 0px; "}
- @users.each do |user| = check_box_tag "user_remove[#{user.id}][]"
%tr{:class => cycle("odd", "even")} %td
%td .img
= user.id = image_tag(gravatar_url(user.email))
%td .forimg= link_to user.name, user_path(user)
= link_to user.name, user_path(user) - Relation::ROLES.each_with_index do |role, i|
%td %td
- Relation::ROLES.each do |role| .radio
= 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"} = radio_button_tag "user[#{user.id}]", role, ((parent.objects.exists? :object_id => user.id, :object_type => 'User', :role => role) ? :checked : nil), :class => 'niceRadio'
= label_tag "#{ role }[#{user.id}]", t("layout.members.roles.#{ role }") -# f.radio_button "group[#{role}][#{group.id}]", '1', ((@project.relations.exists? :object_id => group.id, :object_type => 'Group', :role => role) ? :checked : nil)
%td -#%span.niceRadio.radioChecked
= user.uname -# %input#myradio1{:checked => "checked", :name => "myradio", :tabindex => "1", :type => "radio", :value => "on"}/
.group.navform.wat-cf .forradio= t("layout.collaborators.role_names.#{ role }")
%button.button{:type => "submit"} = link_to_function t("layout.delete"), "deleteAdminMember();", :class => 'button'
= image_tag("choose.png", :alt => t("layout.save")) .both
= t("layout.save") .hr.top
%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 = form_tag add_group_members_path(parent) do
.group .admin-search
%h2.title= t("layout.members.add_member") = autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path#, :id_element => '#member_id_field'
= label_tag "", t("layout.members.input_username") .admin-role
= autocomplete_field_tag 'user_id', params[:user_id], autocomplete_user_uname_users_path .lineForm
%br = select_tag 'role', options_for_collaborators_roles_select
.group.navform.wat-cf .both
%button.button{:type => "submit"} -#.admin-search
= image_tag("choose.png", :alt => t("layout.add")) -# = label_tag "group_uname", t("layout.collaborators.input_groupname")
= t("layout.add") -# = 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")
-#

View File

@ -164,6 +164,7 @@ Rosa::Application.routes.draw do
get :edit get :edit
post :add post :add
post :update post :update
delete :remove
end end
member do member do
post :update post :update