Browse Source

theme key has changed to theme id

Angus 6 năm trước cách đây
mục cha
commit
7a781b24d0

+ 3 - 3
assets/javascripts/discourse/components/wizard-custom-action.js.es6

@@ -16,7 +16,7 @@ const PROFILE_FIELDS = [
   'bio_raw',
   'profile_background',
   'card_background',
-  'theme_key'
+  'theme_id'
 ];
 
 export default Ember.Component.extend({
@@ -60,8 +60,8 @@ export default Ember.Component.extend({
 
   @computed()
   builderUserFields() {
-    const noThemeKey = PROFILE_FIELDS.filter((f) => f !== 'theme_key');
-    const fields = noThemeKey.concat(['email', 'username']);
+    const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id');
+    const fields = noTheme.concat(['email', 'username']);
     return fields.map((f) => ` u{${f}}`);
   },
 

+ 1 - 1
assets/javascripts/discourse/models/custom-wizard.js.es6

@@ -11,7 +11,7 @@ const wizardProperties = [
   'required',
   'prompt_completion',
   'min_trust',
-  'theme_key'
+  'theme_id'
 ];
 
 const CustomWizard = Discourse.Model.extend({

+ 2 - 2
assets/javascripts/discourse/templates/admin-wizard.hbs

@@ -104,10 +104,10 @@
 
   <div class="setting">
     <div class="setting-label">
-      <h3>{{i18n 'admin.wizard.theme_key'}}</h3>
+      <h3>{{i18n 'admin.wizard.theme_id'}}</h3>
     </div>
     <div class="setting-value">
-      {{combo-box content=model.themes valueAttribute='key' value=model.theme_key none='admin.wizard.no_theme'}}
+      {{combo-box content=model.themes valueAttribute='id' value=model.theme_id none='admin.wizard.no_theme'}}
     </div>
   </div>
 

+ 1 - 1
config/locales/client.en.yml

@@ -35,7 +35,7 @@ en:
         prompt_completion_label: "Prompt user to complete wizard."
         min_trust: "Trust"
         min_trust_label: "Trust level required to access wizard."
-        theme_key: "Theme"
+        theme_id: "Theme"
         no_theme: "Select a Theme (optional)"
         save: "Save Changes"
         remove: "Delete Wizard"

+ 3 - 3
controllers/wizard.rb

@@ -4,7 +4,7 @@ class CustomWizard::WizardController < ::ApplicationController
 
   requires_login
   helper_method :wizard_page_title
-  helper_method :theme_key
+  helper_method :theme_id
 
   def wizard
     CustomWizard::Template.new(PluginStore.get('custom_wizard', params[:wizard_id].underscore))
@@ -14,8 +14,8 @@ class CustomWizard::WizardController < ::ApplicationController
     wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title')
   end
 
-  def theme_key
-    wizard ? wizard.theme_key : nil
+  def theme_id
+    wizard ? wizard.theme_id : nil
   end
 
   def index

+ 3 - 3
lib/template.rb

@@ -12,7 +12,7 @@ class CustomWizard::Template
               :after_time,
               :after_time_scheduled,
               :required,
-              :theme_key
+              :theme_id
 
   def initialize(data)
     data = data.is_a?(String) ? ::JSON.parse(data) : data
@@ -31,11 +31,11 @@ class CustomWizard::Template
     @after_time = data['after_time']
     @after_time_scheduled = data['after_time_scheduled']
     @required = data['required'] || false
-    @theme_key = data['theme_key']
+    @theme_id = data['theme_id']
 
     if data['theme']
       theme = Theme.find_by(name: data['theme'])
-      @theme_key = theme.key if theme
+      @theme_id = theme.id if theme
     end
   end
 end

+ 3 - 3
views/layouts/wizard.html.erb

@@ -1,11 +1,11 @@
 <html>
   <head>
-    <%= discourse_stylesheet_link_tag :wizard, theme_key: nil %>
+    <%= discourse_stylesheet_link_tag :wizard, theme_id: nil %>
     <%= stylesheet_link_tag "wizard_custom", media: "all", "data-turbolinks-track" => "reload" %>
     <%= stylesheet_link_tag "wizard_composer", media: "all", "data-turbolinks-track" => "reload" %>
     <%= stylesheet_link_tag "wizard_variables", media: "all", "data-turbolinks-track" => "reload" %>
     <%= stylesheet_link_tag "wizard_custom_mobile", media: "all", "data-turbolinks-track" => "reload" if mobile_view?%>
-    <%- if theme_key %>
+    <%- if theme_id %>
       <%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme) %>
     <%- end %>
     <%= preload_script "ember_jquery" %>
@@ -26,7 +26,7 @@
 
     <%= server_plugin_outlet "custom_wizard" %>
 
-    <meta name="discourse_theme_key" content="<%= theme_key %>">
+    <meta name="discourse_theme_id" content="<%= theme_id %>">
     <meta name="discourse-base-uri" content="<%= Discourse.base_uri %>">
 
     <%= render partial: "layouts/head" %>