diff --git a/ghost/admin/models/settings.js b/ghost/admin/models/settings.js
index b57193f35c..b6a58a177e 100644
--- a/ghost/admin/models/settings.js
+++ b/ghost/admin/models/settings.js
@@ -3,7 +3,7 @@
'use strict';
//id:0 is used to issue PUT requests
Ghost.Models.Settings = Ghost.ProgressModel.extend({
- url: Ghost.paths.apiRoot + '/settings/?type=blog,theme',
+ url: Ghost.paths.apiRoot + '/settings/?type=blog,theme,app',
id: '0'
});
diff --git a/ghost/admin/tpl/settings/apps.hbs b/ghost/admin/tpl/settings/apps.hbs
new file mode 100644
index 0000000000..e584081688
--- /dev/null
+++ b/ghost/admin/tpl/settings/apps.hbs
@@ -0,0 +1,15 @@
+
+
+
+
+ {{#each availableApps}}
+
+ {{#if package}}{{package.name}} - {{package.version}}{{else}}{{name}} - package.json missing :({{/if}}
+ Deactivate{{else}}button-add js-button-activate">Activate{{/if}}
+
+ {{/each}}
+
+
\ No newline at end of file
diff --git a/ghost/admin/tpl/settings/sidebar.hbs b/ghost/admin/tpl/settings/sidebar.hbs
index 246d0882c5..ad8295818b 100644
--- a/ghost/admin/tpl/settings/sidebar.hbs
+++ b/ghost/admin/tpl/settings/sidebar.hbs
@@ -5,5 +5,6 @@
\ No newline at end of file
diff --git a/ghost/admin/views/settings.js b/ghost/admin/views/settings.js
index 24bf32bfa8..9283924307 100644
--- a/ghost/admin/views/settings.js
+++ b/ghost/admin/views/settings.js
@@ -446,4 +446,70 @@
}
});
+ // ### Apps page
+ Settings.apps = Settings.Pane.extend({
+ id: "apps",
+
+ events: {
+ 'click .js-button-activate': 'activateApp',
+ 'click .js-button-deactivate': 'deactivateApp'
+ },
+
+ beforeRender: function () {
+ this.availableApps = this.model.toJSON().availableApps;
+ },
+
+ activateApp: function (event) {
+ var button = $(event.currentTarget);
+
+ button.removeClass('button-add').addClass('button js-button-active').text('Working');
+
+ this.saveStates();
+ },
+
+ deactivateApp: function (event) {
+ var button = $(event.currentTarget);
+
+ button.removeClass('button-delete js-button-active').addClass('button').text('Working');
+
+ this.saveStates();
+ },
+
+ saveStates: function () {
+ var activeButtons = this.$el.find('.js-apps .js-button-active'),
+ toSave = [],
+ self = this;
+
+ _.each(activeButtons, function (app) {
+ toSave.push($(app).data('app'));
+ });
+
+ this.model.save({
+ activeApps: JSON.stringify(toSave)
+ }, {
+ success: this.saveSuccess,
+ error: this.saveError
+ }).then(function () { self.render(); });
+ },
+
+ saveSuccess: function () {
+ Ghost.notifications.addItem({
+ type: 'success',
+ message: 'Active applications updated.',
+ status: 'passive',
+ id: 'success-1100'
+ });
+ },
+
+ saveError: function (xhr) {
+ Ghost.notifications.addItem({
+ type: 'error',
+ message: Ghost.Views.Utils.getRequestErrorMessage(xhr),
+ status: 'passive'
+ });
+ },
+
+ templateName: 'settings/apps'
+ });
+
}());