Ghost/ghost/admin/app/routes/members.js
Rishabh Garg d115204d9f Added labels for Members (#1477)
no issue

refs TryGhost/Ghost#11538

* Added members label handling v1

* Added members label dropdown in list screen

* Updated selected labels and member list UI refactor

* Added v1 label add/delete modal

* Added add label modal v1

* Fixed disabled check for new label save

* First stab at member filters layout

* Updated member detail screen design

* Member detail refinements

* Added basic editing for member labels

* Fixed label deletion from members list

* Updated filtered list header

* Refinements for dropdown and empty filter state

* Refined label modal

* Updated member labels fetch logic

* Added custom dropdown component for labels

* Refined style for dropdown

* Refined dropdown button

* Restructure and refine members dropdown styles

* Added selected indication to dropdown

* Fixed dropdown footer style

* Removed member label placeholder

* Removed add label from member list actions

* New label refinements

* Added confirmation modal for label delete

* Added duplicate validation check for labels

* Updated validation check with slug

* Updated copy

* Updated actions dropdown copy

* Fixed visual glitch of dropdown on FF

* Hide scrollbar for labels dropdown

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2020-02-14 15:04:01 +05:30

46 lines
1.2 KiB
JavaScript

import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
import {inject as service} from '@ember/service';
export default AuthenticatedRoute.extend({
config: service(),
queryParams: {
label: {refreshModel: true}
},
// redirect to posts screen if:
// - TODO: members is disabled?
// - logged in user isn't owner/admin
beforeModel() {
this._super(...arguments);
return this.session.user.then((user) => {
if (!user.isOwnerOrAdmin) {
return this.transitionTo('home');
}
});
},
// trigger a background load of labels for filter dropdown
setupController(controller) {
this._super(...arguments);
controller.fetchMembers.perform();
if (!controller._hasLoadedLabels) {
this.store.query('label', {limit: 'all'}).then(() => {
controller._hasLoadedLabels = true;
});
}
},
deactivate() {
this._super(...arguments);
this.controller.modalLabel && this.controller.modalLabel.rollbackAttributes();
},
buildRouteInfoMetadata() {
return {
titleToken: 'Members'
};
}
});