Commit 6eabf90b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Ability to edit group member permissions

parent f8137075
......@@ -11,3 +11,8 @@ $ ->
container = $(".js-toggle-visibility-container")
container.toggleClass("hide")
e.preventDefault()
$("body").on "click", ".js-toggle-button", (e) ->
$(@).disableButton()
$(@).closest(".js-toggle-container").find(".js-toggle-content").show()
e.preventDefault()
......@@ -7,3 +7,7 @@ $.fn.enableButton = ->
$(@).removeAttr('disabled').
removeClass('disabled')
$.fn.disableButton = ->
$(@).attr('disabled', 'disabled').
addClass('disabled')
......@@ -13,7 +13,8 @@ class UsersGroupsController < ApplicationController
end
def update
# TODO: implement
@member = @group.users_groups.find(params[:id])
@member.update_attributes(params[:users_group])
end
def destroy
......
- user = member.user
- return unless user
%li{class: dom_class(member)}
%li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)}
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
%strong= user.name
%span.cgray= user.username
......@@ -8,12 +8,16 @@
%span.label.label-success It's you
%span.pull-right
- if @group.owners.include?(user)
%span.label.label-info Group Owner
- else
= member.human_access
%strong= member.human_access
- if show_controls && user != @group.owner && user != current_user
= link_to '#', class: "btn-tiny btn js-toggle-button", title: 'Edit access level' do
%i.icon-edit
= link_to group_users_group_path(@group, member), confirm: remove_user_from_group_message(@group, user), method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do
%i.icon-minus.icon-white
.edit-member.hide.js-toggle-content
= form_for [@group, member], remote: true do |f|
.alert.prepend-top-20
= f.select :group_access, options_for_select(UsersGroup.group_access_roles, member.group_access)
= f.submit 'Save', class: 'btn btn-save'
:plain
$("##{dom_id(@member)}").replaceWith('#{escape_javascript(render(@member, member: @member, show_controls: true))}');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment