FIX: CSS Customizations were showing as undefined

This commit is contained in:
Robin Ward 2014-09-25 12:08:44 -04:00
parent de76b512c1
commit d37ed80e8a
2 changed files with 6 additions and 22 deletions

View File

@ -9,11 +9,6 @@
Discourse.SiteCustomization = Discourse.Model.extend({ Discourse.SiteCustomization = Discourse.Model.extend({
trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'mobile_stylesheet', 'mobile_header', 'override_default_style'], trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'mobile_stylesheet', 'mobile_header', 'override_default_style'],
init: function() {
this._super();
this.startTrackingChanges();
},
description: function() { description: function() {
return "" + this.name + (this.enabled ? ' (*)' : ''); return "" + this.name + (this.enabled ? ' (*)' : '');
}.property('selected', 'name'), }.property('selected', 'name'),
@ -43,7 +38,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
return true; return true;
}); });
this.set('originals', originals); this.set('originals', originals);
}, }.on('init'),
previewUrl: function() { previewUrl: function() {
return "/?preview-style=" + (this.get('key')); return "/?preview-style=" + (this.get('key'));
@ -103,15 +98,14 @@ var SiteCustomizations = Ember.ArrayProxy.extend({
Discourse.SiteCustomization.reopenClass({ Discourse.SiteCustomization.reopenClass({
findAll: function() { findAll: function() {
var customizations = SiteCustomizations.create({ content: [], loading: true }); return Discourse.ajax("/admin/site_customizations").then(function (data) {
Discourse.ajax("/admin/site_customizations").then(function (data) { var content = [];
if (data) { if (data) {
_.each(data.site_customizations,function(c) { content = data.site_customizations.map(function(c) {
customizations.pushObject(Discourse.SiteCustomization.create(c.site_customizations)); return Discourse.SiteCustomization.create(c);
}); });
} }
customizations.set('loading', false); return SiteCustomizations.create({ content: content });
}); });
return customizations;
} }
}); });

View File

@ -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({ Discourse.AdminCustomizeCssHtmlRoute = Discourse.Route.extend({
model: function() { model: function() {
return Discourse.SiteCustomization.findAll(); return Discourse.SiteCustomization.findAll();
} }
}); });