diff --git a/ghost/admin/controllers/settings/code-injection.js b/ghost/admin/controllers/settings/code-injection.js new file mode 100644 index 0000000000..95af5d5344 --- /dev/null +++ b/ghost/admin/controllers/settings/code-injection.js @@ -0,0 +1,19 @@ +var SettingsCodeInjectionController = Ember.ObjectController.extend({ + actions: { + save: function () { + var self = this; + + return this.get('model').save().then(function (model) { + self.notifications.closePassive(); + self.notifications.showSuccess('Settings successfully saved.'); + + return model; + }).catch(function (errors) { + self.notifications.closePassive(); + self.notifications.showErrors(errors); + }); + } + } +}); + +export default SettingsCodeInjectionController; diff --git a/ghost/admin/models/setting.js b/ghost/admin/models/setting.js index 5da5b6384a..025a664051 100644 --- a/ghost/admin/models/setting.js +++ b/ghost/admin/models/setting.js @@ -14,7 +14,9 @@ var Setting = DS.Model.extend(NProgressSaveMixin, ValidationEngine, { forceI18n: DS.attr('boolean'), permalinks: DS.attr('string'), activeTheme: DS.attr('string'), - availableThemes: DS.attr() + availableThemes: DS.attr(), + ghost_head: DS.attr('string'), + ghost_foot: DS.attr('string') }); export default Setting; diff --git a/ghost/admin/router.js b/ghost/admin/router.js index 4d1fa9b974..e2fc518007 100644 --- a/ghost/admin/router.js +++ b/ghost/admin/router.js @@ -40,6 +40,7 @@ Router.map(function () { this.route('about'); this.route('tags'); this.route('labs'); + this.route('code-injection'); }); // Redirect debug to settings labs diff --git a/ghost/admin/routes/settings/code-injection.js b/ghost/admin/routes/settings/code-injection.js new file mode 100644 index 0000000000..d2f8acf0c2 --- /dev/null +++ b/ghost/admin/routes/settings/code-injection.js @@ -0,0 +1,23 @@ +import AuthenticatedRoute from 'ghost/routes/authenticated'; +import loadingIndicator from 'ghost/mixins/loading-indicator'; +import CurrentUserSettings from 'ghost/mixins/current-user-settings'; +import styleBody from 'ghost/mixins/style-body'; + + +var SettingsCodeInjectionRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, CurrentUserSettings, { + classNames: ['settings-view-code'], + + beforeModel: function () { + return this.currentUser() + .then(this.transitionAuthor()) + .then(this.transitionEditor()); + }, + + model: function () { + return this.store.find('setting', {type: 'blog,theme'}).then(function (records) { + return records.get('firstObject'); + }); + } +}); + +export default SettingsCodeInjectionRoute; diff --git a/ghost/admin/templates/settings.hbs b/ghost/admin/templates/settings.hbs index f8171aec4a..141a6fb526 100644 --- a/ghost/admin/templates/settings.hbs +++ b/ghost/admin/templates/settings.hbs @@ -11,6 +11,10 @@ {{gh-activating-list-item route="settings.general" title="General" classNames="settings-nav-general icon-settings"}} {{/unless}} + {{#unless session.user.isEditor}} + {{gh-activating-list-item route="settings.code-injection" title="Code Injection" classNames="settings-nav-code"}} + {{/unless}} + {{! Whilst tag management is still in development only show tags button if there if tagsUI is true in config.js --}} {{#if showTags}} {{gh-activating-list-item route="settings.tags" title="Tags" classNames="settings-nav-tags icon-tag"}} diff --git a/ghost/admin/templates/settings/code-injection.hbs b/ghost/admin/templates/settings/code-injection.hbs new file mode 100644 index 0000000000..964c069ae5 --- /dev/null +++ b/ghost/admin/templates/settings/code-injection.hbs @@ -0,0 +1,31 @@ +
+ {{#link-to "settings" class="btn btn-default btn-back"}}Back{{/link-to}} +

Code Injection

+
+ +
+
+ +
+
+
+
+

+ Ghost allows you to inject code into the top and bottom of your template files without editing them. This allows for quick modifications to insert useful things like tracking codes and meta data. +

+
+ +
+ +

Code here will be injected to the \{{ghost_head}} helper at the top of your page

+ {{textarea id="ghost-head" name="codeInjection[ghost_head]" type="text" value=ghost_head}} +
+ +
+ +

Code here will be injected to the \{{ghost_foot}} helper at the top of your page

+ {{textarea id="blog-foot" name="codeInjection[ghost_foot]" type="text" value=ghost_foot}} +
+
+
+
diff --git a/ghost/admin/views/settings/code-injection.js b/ghost/admin/views/settings/code-injection.js new file mode 100644 index 0000000000..235261fac3 --- /dev/null +++ b/ghost/admin/views/settings/code-injection.js @@ -0,0 +1,5 @@ +import BaseView from 'ghost/views/settings/content-base'; + +var SettingsGeneralView = BaseView.extend(); + +export default SettingsGeneralView;