User management updates
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import Ember from 'ember'
|
||||
export default Ember.Controller.extend
|
||||
nickname_filter: ''
|
||||
email_filter: ''
|
||||
organization_filter: null
|
||||
possible_organizations: (-> @store.peekAll('panda/organization')).property()
|
||||
users: Ember.computed 'model', 'nickname_filter', 'email_filter', 'organization_filter', ->
|
||||
return [] unless records = @get 'model'
|
||||
if nickname_filter = @get('nickname_filter')
|
||||
nickname_matcher = new RegExp nickname_filter, 'i'
|
||||
records = records.filter (record) -> nickname_matcher.test record.get('nickname')
|
||||
if email_filter = @get('email_filter')
|
||||
email_matcher = new RegExp email_filter, 'i'
|
||||
records = records.filter (record) -> email_matcher.test record.get('email')
|
||||
if organization_filter = @get('organization_filter')
|
||||
records = records.filter (record) -> record.get('organizations').includes organization_filter
|
||||
#records.sortBy 'nickname'
|
||||
records
|
||||
|
||||
actions:
|
||||
clear_nickname_filter: -> @set 'nickname_filter', ''
|
||||
clear_email_filter: -> @set 'email_filter', ''
|
||||
set_organization_filter: (organization) -> @set 'organization_filter', organization
|
||||
@@ -1,3 +1,3 @@
|
||||
import Ember from 'ember'
|
||||
export default Ember.Route.extend
|
||||
model: -> @store.peekAll('user') # fetched in application route
|
||||
model: -> @store.peekAll('user') # preloaded in application route
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.ui.container
|
||||
.ui.visible.message= t 'project.modals.edit_projects_context.message'
|
||||
.ui.visible.message= t 'project.edit_projects_context.message'
|
||||
h3.ui.top.attached.header
|
||||
.ui.right.floated.icon.buttons= push-action type="new" action="newWorkflowInstanceType"
|
||||
= t 'models.plural.workflow_instance_type'
|
||||
@@ -8,5 +8,9 @@
|
||||
each workflow_instance_types as |workflow_instance_type|
|
||||
.ui.segment
|
||||
editable-attribute model=workflow_instance_type
|
||||
span
|
||||
span.between-brackets
|
||||
span id:
|
||||
= workflow_instance_type.id
|
||||
.modal-actions.sticky
|
||||
button.ui.basic.button.modal-close.pull-right{ action "close"}= t 'general.close'
|
||||
|
||||
@@ -8,14 +8,58 @@ d-breadcrumbs as |breadcrumb|
|
||||
/= push-action type='edit' action='editUsersContext'
|
||||
= push-action type='new' action='newUser' description='Add user'
|
||||
= t 'models.plural.user'
|
||||
span
|
||||
span.between-brackets= users.length
|
||||
table.ui.unstackable.table
|
||||
thead
|
||||
tr
|
||||
th= t 'attributes.user.nickname'
|
||||
th= t 'attributes.user.email'
|
||||
th= t 'models.plural.organization'
|
||||
th.actions
|
||||
tr
|
||||
td.unpadded
|
||||
.ui.mini.right.action.left.icon.input
|
||||
i.filter.icon
|
||||
= input value=nickname_filter
|
||||
if nickname_filter
|
||||
button.ui.icon.button click='clear_nickname_filter'
|
||||
i.close.icon
|
||||
td.unpadded
|
||||
.ui.mini.right.action.left.icon.input
|
||||
i.filter.icon
|
||||
= input value=email_filter
|
||||
if email_filter
|
||||
button.ui.icon.button click='clear_email_filter'
|
||||
i.close.icon
|
||||
td
|
||||
= ui-dropdown class='fluid search selection' selected=organization_filter onChange=(action 'set_organization_filter') fullTextSearch=true as |execute mapper|
|
||||
.default.text= t 'action.select_model' modelPath='models.organization'
|
||||
i.dropdown.icon
|
||||
.menu
|
||||
.item data-value='{{map-value mapper null}}' --
|
||||
each possible_organizations as |organization|
|
||||
.item data-value='{{map-value mapper organization}}'
|
||||
if organization.logo
|
||||
img src=organization.logo_url.small
|
||||
= organization.name
|
||||
td
|
||||
if organization_filter
|
||||
button.ui.mini.icon.button click="action 'set_organization_filter' null"
|
||||
i.close.icon
|
||||
|
||||
tbody
|
||||
/each model as |user|
|
||||
each (sort-by 'nickname' model) as |user|
|
||||
each (sort-by 'nickname' users) as |user|
|
||||
tr
|
||||
td= link-to user.nickname 'user.show' user
|
||||
td= user.email
|
||||
td.comma-separated-items
|
||||
each (sort-by 'name' user.organizations) as |organization|
|
||||
if (eq organization_filter organization)
|
||||
strong= link-to organization.name 'organization.show' organization
|
||||
else
|
||||
= link-to organization.name 'organization.show' organization
|
||||
td.actions= push-action type='edit' action='editUser' model=user
|
||||
br
|
||||
br
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
"emberx-select": "^3.1.0",
|
||||
"json-formatter-js": "^2.2.0",
|
||||
"loader.js": "^4.2.3",
|
||||
"sass": "^1.24.0",
|
||||
"semantic-ui-ember": "^3.0.3",
|
||||
"tooltipster": "^4.2.5",
|
||||
"viz.js": "^1.8.0"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Ember from 'ember'
|
||||
import config from '../config/environment'
|
||||
import DunlopApplicationRoute from 'ember-cli-dunlop/mixins/application-route'
|
||||
|
||||
export default Ember.Route.extend DunlopApplicationRoute,
|
||||
@@ -55,7 +56,7 @@ export default Ember.Route.extend DunlopApplicationRoute,
|
||||
contentType: "application/json"
|
||||
success: success
|
||||
dataType: "json"
|
||||
if get(session, 'isAuthenticated')
|
||||
if Ember.get(session, 'isAuthenticated')
|
||||
session.authorize 'authorizer:devise', (key, authorization) ->
|
||||
request.crossDomain = true
|
||||
request.headers = {"#{key}": authorization}
|
||||
|
||||
Reference in New Issue
Block a user