diff --git a/app/assets/javascripts/app/controllers/_ui_element/user_permission.coffee b/app/assets/javascripts/app/controllers/_ui_element/user_permission.coffee index f6470f98c..877dce2db 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/user_permission.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/user_permission.coffee @@ -46,11 +46,6 @@ class App.UiElement.user_permission if group_id.toString() is group.id.toString() groupsSelected[group.id] = true - # if only one group is selectable, hide all groups - hideGroups = false - if groups.length <= 1 - hideGroups = true - # get roles with group plugin rolesWithGroupPlugin = {} for role in rolesRaw @@ -76,7 +71,6 @@ class App.UiElement.user_permission groups: groups params: params groupsSelected: groupsSelected - hideGroups: hideGroups groupAccesses: App.Group.accesses() ) ) @@ -95,12 +89,12 @@ class App.UiElement.user_permission # if customer, remove admin and agent item.find('[name=role_ids]').bind('change', (e) => - @checkUncheck($(e.currentTarget), rolesWithGroupPlugin, item, hideGroups) + @checkUncheck($(e.currentTarget), rolesWithGroupPlugin, item) ) item.find('[name=role_ids]').trigger('change') item - @checkUncheck: (element, rolesWithGroupPlugin, item, hideGroups) -> + @checkUncheck: (element, rolesWithGroupPlugin, item) -> checked = element.prop('checked') role_id = element.prop('value') return if !role_id @@ -122,33 +116,5 @@ class App.UiElement.user_permission item.localElement.prop('checked', false) triggers.push item.localElement - # if role with groups plugin is deselected, hide group selection - if !checked - selectedRoleIds = [] - item.find('input[name=role_ids]:checked').each( -> - selectedRoleIds.push($(@).val()) - ) - - show = false - for role_id, group of rolesWithGroupPlugin - if _.contains(selectedRoleIds, role_id.toString()) - show = true - break - if !show - item.find('.js-groupList').addClass('hidden') - - # select groups if only one is available - if hideGroups - item.find('.js-groupList .js-groupListItem[value=full]').prop('checked', false) - return - - # if role with groups plugin is selected, show group selection - if rolesWithGroupPlugin[role_id] is 'group' - item.find('.js-groupList:not(.js-groupListHide)').removeClass('hidden') - - # select groups if only one is available - if hideGroups - item.find('.js-groupList .js-groupListItem[value=full]').prop('checked', true) - for trigger in triggers trigger.trigger('change') diff --git a/app/assets/javascripts/app/views/generic/permission.jst.eco b/app/assets/javascripts/app/views/generic/permission.jst.eco index 0a31283fb..cd5954e9e 100644 --- a/app/assets/javascripts/app/views/generic/permission.jst.eco +++ b/app/assets/javascripts/app/views/generic/permission.jst.eco @@ -18,7 +18,7 @@ <%- @T.apply(@, [permission.note].concat(permission.preferences.translations)) %> <% if _.contains(permission.preferences.plugin, 'groups'): %> -