mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Merge pull request #4438 from Gargol/4414
Adds 'save' shortcut to settings screens
This commit is contained in:
commit
68b93cf35f
4 changed files with 38 additions and 4 deletions
|
@ -2,8 +2,15 @@ import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||||
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
||||||
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
||||||
import styleBody from 'ghost/mixins/style-body';
|
import styleBody from 'ghost/mixins/style-body';
|
||||||
|
import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
|
||||||
|
import ctrlOrCmd from 'ghost/utils/ctrl-or-cmd';
|
||||||
|
|
||||||
var SettingsGeneralRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, CurrentUserSettings, {
|
var shortcuts = {},
|
||||||
|
SettingsGeneralRoute;
|
||||||
|
|
||||||
|
shortcuts[ctrlOrCmd + '+s'] = {action: 'save'};
|
||||||
|
|
||||||
|
SettingsGeneralRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, CurrentUserSettings, ShortcutsRoute, {
|
||||||
classNames: ['settings-view-general'],
|
classNames: ['settings-view-general'],
|
||||||
|
|
||||||
beforeModel: function () {
|
beforeModel: function () {
|
||||||
|
@ -16,6 +23,14 @@ var SettingsGeneralRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator
|
||||||
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) {
|
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) {
|
||||||
return records.get('firstObject');
|
return records.get('firstObject');
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
shortcuts: shortcuts,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
save: function () {
|
||||||
|
this.get('controller').send('save');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||||
import styleBody from 'ghost/mixins/style-body';
|
import styleBody from 'ghost/mixins/style-body';
|
||||||
|
import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
|
||||||
|
import ctrlOrCmd from 'ghost/utils/ctrl-or-cmd';
|
||||||
|
|
||||||
var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, {
|
var shortcuts = {},
|
||||||
|
SettingsUserRoute;
|
||||||
|
|
||||||
|
shortcuts[ctrlOrCmd + '+s'] = {action: 'save'};
|
||||||
|
|
||||||
|
SettingsUserRoute = AuthenticatedRoute.extend(styleBody, ShortcutsRoute, {
|
||||||
classNames: ['settings-view-user'],
|
classNames: ['settings-view-user'],
|
||||||
|
|
||||||
model: function (params) {
|
model: function (params) {
|
||||||
|
@ -44,6 +51,14 @@ var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._super();
|
this._super();
|
||||||
|
},
|
||||||
|
|
||||||
|
shortcuts: shortcuts,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
save: function () {
|
||||||
|
this.get('controller').send('save');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
3
core/client/utils/ctrl-or-cmd.js
Normal file
3
core/client/utils/ctrl-or-cmd.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
var ctrlOrCmd = navigator.userAgent.indexOf('Mac') !== -1 ? 'command' : 'ctrl';
|
||||||
|
|
||||||
|
export default ctrlOrCmd;
|
|
@ -1,5 +1,6 @@
|
||||||
var shortcuts = {},
|
import ctrlOrCmd from 'ghost/utils/ctrl-or-cmd';
|
||||||
ctrlOrCmd = navigator.userAgent.indexOf('Mac') !== -1 ? 'command' : 'ctrl';
|
|
||||||
|
var shortcuts = {};
|
||||||
|
|
||||||
// General editor shortcuts
|
// General editor shortcuts
|
||||||
shortcuts[ctrlOrCmd + '+s'] = 'save';
|
shortcuts[ctrlOrCmd + '+s'] = 'save';
|
||||||
|
|
Loading…
Add table
Reference in a new issue