From d37ed80e8a5b59bd19ca7dbebbd8f03f6a1cec48 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 25 Sep 2014 12:08:44 -0400 Subject: [PATCH] FIX: CSS Customizations were showing as undefined --- .../admin/models/site_customization.js | 18 ++++++------------ .../routes/admin_customize_css_html_route.js | 10 ---------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/app/assets/javascripts/admin/models/site_customization.js b/app/assets/javascripts/admin/models/site_customization.js index 71143b89683..b9f0042c7f1 100644 --- a/app/assets/javascripts/admin/models/site_customization.js +++ b/app/assets/javascripts/admin/models/site_customization.js @@ -9,11 +9,6 @@ Discourse.SiteCustomization = Discourse.Model.extend({ trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'mobile_stylesheet', 'mobile_header', 'override_default_style'], - init: function() { - this._super(); - this.startTrackingChanges(); - }, - description: function() { return "" + this.name + (this.enabled ? ' (*)' : ''); }.property('selected', 'name'), @@ -43,7 +38,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({ return true; }); this.set('originals', originals); - }, + }.on('init'), previewUrl: function() { return "/?preview-style=" + (this.get('key')); @@ -103,15 +98,14 @@ var SiteCustomizations = Ember.ArrayProxy.extend({ Discourse.SiteCustomization.reopenClass({ findAll: function() { - var customizations = SiteCustomizations.create({ content: [], loading: true }); - Discourse.ajax("/admin/site_customizations").then(function (data) { + return Discourse.ajax("/admin/site_customizations").then(function (data) { + var content = []; if (data) { - _.each(data.site_customizations,function(c) { - customizations.pushObject(Discourse.SiteCustomization.create(c.site_customizations)); + content = data.site_customizations.map(function(c) { + return Discourse.SiteCustomization.create(c); }); } - customizations.set('loading', false); + return SiteCustomizations.create({ content: content }); }); - return customizations; } }); diff --git a/app/assets/javascripts/admin/routes/admin_customize_css_html_route.js b/app/assets/javascripts/admin/routes/admin_customize_css_html_route.js index ca459442360..a9684add0f2 100644 --- a/app/assets/javascripts/admin/routes/admin_customize_css_html_route.js +++ b/app/assets/javascripts/admin/routes/admin_customize_css_html_route.js @@ -1,15 +1,5 @@ -/** - Handles routes related to css/html customization - - @class AdminCustomizeCssHtmlRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ Discourse.AdminCustomizeCssHtmlRoute = Discourse.Route.extend({ - model: function() { return Discourse.SiteCustomization.findAll(); } - });