mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Move users routes out of settings & change to team
issue #5434 - move users routes/views/controllers out of settings - rename users team - update nav-menu.hbs - remove legacy routes - fix up tests
This commit is contained in:
parent
c765acb849
commit
2048110167
@ -30,7 +30,7 @@ export default Ember.Controller.extend({
|
||||
|
||||
user.destroyRecord().then(function () {
|
||||
self.store.unloadAll('post');
|
||||
self.transitionToRoute('settings.users');
|
||||
self.transitionToRoute('team');
|
||||
self.get('notifications').showSuccess('The user has been deleted.', {delayed: true});
|
||||
}, function () {
|
||||
self.get('notifications').showError('The user could not be deleted. Please try again.');
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
import PaginationControllerMixin from 'ghost/mixins/pagination-controller';
|
||||
|
||||
var UsersIndexController = Ember.ArrayController.extend(PaginationControllerMixin, {
|
||||
var TeamIndexController = Ember.ArrayController.extend(PaginationControllerMixin, {
|
||||
init: function () {
|
||||
// let the PaginationControllerMixin know what type of model we will be paginating
|
||||
// this is necessary because we do not have access to the model inside the Controller::init method
|
||||
@ -21,4 +21,4 @@ var UsersIndexController = Ember.ArrayController.extend(PaginationControllerMixi
|
||||
})
|
||||
});
|
||||
|
||||
export default UsersIndexController;
|
||||
export default TeamIndexController;
|
@ -5,7 +5,7 @@ var CurrentUserSettings = Ember.Mixin.create({
|
||||
|
||||
return function (user) {
|
||||
if (user.get('isAuthor')) {
|
||||
return self.transitionTo('settings.users.user', user);
|
||||
return self.transitionTo('team.user', user);
|
||||
}
|
||||
|
||||
return user;
|
||||
@ -17,7 +17,7 @@ var CurrentUserSettings = Ember.Mixin.create({
|
||||
|
||||
return function (user) {
|
||||
if (user.get('isEditor')) {
|
||||
return self.transitionTo('settings.users');
|
||||
return self.transitionTo('team');
|
||||
}
|
||||
|
||||
return user;
|
||||
|
@ -40,18 +40,16 @@ Router.map(function () {
|
||||
this.route('edit', {path: ':post_id'});
|
||||
});
|
||||
|
||||
this.route('settings.general', {path: '/settings/general'});
|
||||
this.route('settings.users', {path: '/settings/users'}, function () {
|
||||
this.route('team', {path: '/team'}, function () {
|
||||
this.route('user', {path: ':slug'});
|
||||
});
|
||||
|
||||
this.route('settings.general', {path: '/settings/general'});
|
||||
this.route('settings.tags', {path: '/settings/tags'});
|
||||
this.route('settings.labs', {path: '/settings/labs'});
|
||||
this.route('settings.code-injection', {path: '/settings/code-injection'});
|
||||
this.route('settings.navigation', {path: '/settings/navigation'});
|
||||
|
||||
// Redirect legacy content to posts
|
||||
this.route('content');
|
||||
|
||||
this.route('error404', {path: '/*path'});
|
||||
});
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
import Ember from 'ember';
|
||||
var ContentRoute = Ember.Route.extend({
|
||||
beforeModel: function () {
|
||||
this.transitionTo('posts');
|
||||
}
|
||||
});
|
||||
|
||||
export default ContentRoute;
|
@ -1,8 +0,0 @@
|
||||
import Ember from 'ember';
|
||||
var DebugRoute = Ember.Route.extend({
|
||||
beforeModel: function () {
|
||||
this.transitionTo('settings.labs');
|
||||
}
|
||||
});
|
||||
|
||||
export default DebugRoute;
|
@ -4,7 +4,7 @@ import PaginationRouteMixin from 'ghost/mixins/pagination-route';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
var paginationSettings,
|
||||
UsersIndexRoute;
|
||||
TeamIndexRoute;
|
||||
|
||||
paginationSettings = {
|
||||
page: 1,
|
||||
@ -12,10 +12,10 @@ paginationSettings = {
|
||||
status: 'active'
|
||||
};
|
||||
|
||||
UsersIndexRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, PaginationRouteMixin, {
|
||||
TeamIndexRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, PaginationRouteMixin, {
|
||||
titleToken: 'Team',
|
||||
|
||||
classNames: ['settings-view-users'],
|
||||
classNames: ['view-users'],
|
||||
|
||||
setupController: function (controller, model) {
|
||||
this._super(controller, model);
|
||||
@ -55,4 +55,4 @@ UsersIndexRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, Pagi
|
||||
}
|
||||
});
|
||||
|
||||
export default UsersIndexRoute;
|
||||
export default TeamIndexRoute;
|
@ -2,10 +2,10 @@ import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
||||
import styleBody from 'ghost/mixins/style-body';
|
||||
|
||||
var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
|
||||
var TeamUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
|
||||
titleToken: 'Team - User',
|
||||
|
||||
classNames: ['settings-view-user'],
|
||||
classNames: ['team-view-user'],
|
||||
|
||||
model: function (params) {
|
||||
var self = this;
|
||||
@ -17,7 +17,7 @@ var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings
|
||||
var user = result.findBy('slug', params.slug);
|
||||
|
||||
if (!user) {
|
||||
return self.transitionTo('error404', 'settings/users/' + params.slug);
|
||||
return self.transitionTo('error404', 'team/' + params.slug);
|
||||
}
|
||||
|
||||
return user;
|
||||
@ -31,15 +31,15 @@ var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings
|
||||
isAuthor = currentUser.get('isAuthor'),
|
||||
isEditor = currentUser.get('isEditor');
|
||||
if (isAuthor && !isOwnProfile) {
|
||||
self.transitionTo('settings.users.user', currentUser);
|
||||
self.transitionTo('team.user', currentUser);
|
||||
} else if (isEditor && !isOwnProfile && !user.get('isAuthor')) {
|
||||
self.transitionTo('settings.users');
|
||||
self.transitionTo('team');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
deactivate: function () {
|
||||
var model = this.modelFor('settings.users.user');
|
||||
var model = this.modelFor('team.user');
|
||||
|
||||
// we want to revert any unsaved changes on exit
|
||||
if (model && model.get('isDirty')) {
|
||||
@ -56,4 +56,4 @@ var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, CurrentUserSettings
|
||||
}
|
||||
});
|
||||
|
||||
export default SettingsUserRoute;
|
||||
export default TeamUserRoute;
|
@ -10,7 +10,7 @@
|
||||
<ul class="dropdown-menu dropdown-triangle-top js-user-menu-dropdown-menu" role="menu" style="right:-50%;left:auto;margin-right:40px">
|
||||
<li role="presentation">{{#link-to "about" classNames="gh-nav-menu-about dropdown-item js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-shop"></i> About Ghost{{/link-to}}</li>
|
||||
<li class="divider"></li>
|
||||
<li role="presentation">{{#link-to "settings.users.user" session.user.slug classNames="dropdown-item user-menu-profile js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-user"></i> Your Profile{{/link-to}}</li>
|
||||
<li role="presentation">{{#link-to "team.user" session.user.slug classNames="dropdown-item user-menu-profile js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-user"></i> Your Profile{{/link-to}}</li>
|
||||
<li role="presentation">{{#link-to "signout" classNames="dropdown-item user-menu-signout" role="menuitem" tabindex="-1"}}<i class="icon-signout"></i> Sign Out{{/link-to}}</li>
|
||||
</ul>
|
||||
{{/gh-dropdown}}
|
||||
@ -24,7 +24,7 @@
|
||||
<li>{{#link-to "editor.new" classNames="gh-nav-main-editor"}}<i class="icon-pen"></i>New Post{{/link-to}}</li>
|
||||
<li>{{#link-to "posts" classNames="gh-nav-main-content"}}<i class="icon-content"></i>Content{{/link-to}}</li>
|
||||
{{!<li><a href="#"><i class="icon-user"></i>My Posts</a></li>}}
|
||||
<li>{{#link-to "settings.users" classNames="gh-nav-main-users"}}<i class="icon-team"></i>Team{{/link-to}}</li>
|
||||
<li>{{#link-to "team" classNames="gh-nav-main-users"}}<i class="icon-team"></i>Team{{/link-to}}</li>
|
||||
{{!<li><a href="#"><i class="icon-idea"></i>Ideas</a></li>}}
|
||||
</ul>
|
||||
{{#if (gh-user-can session.user 'admin')}}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<h4 class="user-list-title">Invited users</h4>
|
||||
|
||||
{{#each invitedUsers itemController="settings/users/user" as |user|}}
|
||||
{{#each invitedUsers itemController="team/user" as |user|}}
|
||||
<div class="user-list-item">
|
||||
<span class="user-list-item-icon icon-mail">ic</span>
|
||||
|
||||
@ -37,8 +37,8 @@
|
||||
|
||||
<h4 class="user-list-title">Active users</h4>
|
||||
|
||||
{{#each activeUsers itemController="settings/users/user" as |user|}}
|
||||
{{#link-to 'settings.users.user' user.model class="user-list-item" }}
|
||||
{{#each activeUsers itemController="team/user" as |user|}}
|
||||
{{#link-to 'team.user' user.model class="user-list-item" }}
|
||||
<span class="user-list-item-figure" style={{user.userImageBackground}}>
|
||||
<span class="hidden">Photo of {{user.model.name}}</span>
|
||||
</span>
|
@ -1,6 +1,6 @@
|
||||
<header class="view-header">
|
||||
{{#gh-view-title openMobileMenu="openMobileMenu"}}
|
||||
{{#link-to "settings.users"}}Team{{/link-to}} <i class="icon-arrow-right"></i> {{user.name}}
|
||||
{{#link-to "team"}}Team{{/link-to}} <i class="icon-arrow-right"></i> {{user.name}}
|
||||
{{/gh-view-title}}
|
||||
<section class="view-actions">
|
||||
{{#if view.userActionsAreVisible}}
|
@ -1,5 +0,0 @@
|
||||
import BaseView from 'ghost/views/settings/content-base';
|
||||
|
||||
var SettingsUserIndexView = BaseView.extend();
|
||||
|
||||
export default SettingsUserIndexView;
|
7
ghost/admin/app/views/team/index.js
Normal file
7
ghost/admin/app/views/team/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
var TeamUserIndexView = Ember.View.extend({
|
||||
tagName: 'section',
|
||||
classNames: ['gh-view']
|
||||
});
|
||||
|
||||
export default TeamUserIndexView;
|
@ -1,7 +1,8 @@
|
||||
import Ember from 'ember';
|
||||
import BaseView from 'ghost/views/settings/content-base';
|
||||
|
||||
var SettingsUserView = BaseView.extend({
|
||||
var TeamUserView = Ember.View.extend({
|
||||
tagName: 'section',
|
||||
classNames: ['gh-view'],
|
||||
currentUser: Ember.computed.alias('controller.session.user'),
|
||||
|
||||
isNotOwnProfile: Ember.computed('controller.user.id', 'currentUser.id', function () {
|
||||
@ -28,4 +29,4 @@ var SettingsUserView = BaseView.extend({
|
||||
|
||||
});
|
||||
|
||||
export default SettingsUserView;
|
||||
export default TeamUserView;
|
Loading…
Reference in New Issue
Block a user