From 6734a51b6add70d576f25b29afbebc85f79bdc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 14 Jan 2015 11:52:42 +0100 Subject: [PATCH] move SiteText.{head,top,bottom} to SiteCustomization --- .../admin/models/site_customization.js | 20 ++++++-- .../admin/templates/customize_css_html.hbs | 28 ++++++++--- .../admin/views/admin_customize_view.js | 46 ++++++++++++------- .../stylesheets/common/admin/admin_base.scss | 5 ++ .../admin/site_customizations_controller.rb | 5 +- app/controllers/application_controller.rb | 2 +- app/models/site_customization.rb | 37 +++++++-------- app/models/site_text.rb | 3 -- app/views/layouts/application.html.erb | 8 +++- app/views/layouts/crawler.html.erb | 4 +- app/views/layouts/no_js.html.erb | 4 +- config/locales/client.en.yml | 7 +++ ...migrate_site_text_to_site_customization.rb | 2 +- ...114093325_add_top_to_site_customization.rb | 20 ++++++++ 14 files changed, 132 insertions(+), 59 deletions(-) create mode 100644 db/migrate/20150114093325_add_top_to_site_customization.rb diff --git a/app/assets/javascripts/admin/models/site_customization.js b/app/assets/javascripts/admin/models/site_customization.js index 94a0567842c..27b6ddbdd93 100644 --- a/app/assets/javascripts/admin/models/site_customization.js +++ b/app/assets/javascripts/admin/models/site_customization.js @@ -7,7 +7,12 @@ @module Discourse **/ Discourse.SiteCustomization = Discourse.Model.extend({ - trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer'], + trackedProperties: [ + 'enabled', 'name', + 'stylesheet', 'header', 'top', 'footer', + 'mobile_stylesheet', 'mobile_header', 'mobile_top', 'mobile_footer', + 'head_tag', 'body_tag' + ], description: function() { return "" + this.name + (this.enabled ? ' (*)' : ''); @@ -25,8 +30,10 @@ Discourse.SiteCustomization = Discourse.Model.extend({ if (changed) { this.set('savingStatus', ''); } return changed; - - }.property('enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer', 'originals'), + }.property('enabled', 'name', 'originals', + 'stylesheet', 'header', 'top', 'footer', + 'mobile_stylesheet', 'mobile_header', 'mobile_top', 'mobile_footer', + 'head_tag', 'body_tag'), startTrackingChanges: function() { var self = this; @@ -43,15 +50,20 @@ Discourse.SiteCustomization = Discourse.Model.extend({ save: function() { this.set('savingStatus', I18n.t('saving')); this.set('saving',true); + var data = { name: this.name, enabled: this.enabled, stylesheet: this.stylesheet, header: this.header, + top: this.top, footer: this.footer, mobile_stylesheet: this.mobile_stylesheet, mobile_header: this.mobile_header, - mobile_footer: this.mobile_footer + mobile_top: this.mobile_top, + mobile_footer: this.mobile_footer, + head_tag: this.head_tag, + body_tag: this.body_tag }; var siteCustomization = this; diff --git a/app/assets/javascripts/admin/templates/customize_css_html.hbs b/app/assets/javascripts/admin/templates/customize_css_html.hbs index d28bdc6d352..acff1b73e35 100644 --- a/app/assets/javascripts/admin/templates/customize_css_html.hbs +++ b/app/assets/javascripts/admin/templates/customize_css_html.hbs @@ -17,12 +17,22 @@