From d14db3678adb3a62d7e6a4fa4f90e1b22bc6c5f6 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 2 Nov 2017 10:22:13 +0800 Subject: [PATCH] Add rich text for step descriptions --- .../components/wizard-custom-step.hbs | 4 ++-- assets/stylesheets/wizard/wizard_custom.scss | 6 ++++++ assets/stylesheets/wizard_custom_admin.scss | 18 ++++++++++++++++++ controllers/admin.rb | 6 ++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs index 43c0391e..3842621e 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs @@ -34,12 +34,12 @@ -
+

{{i18n 'admin.wizard.step.description'}}

- {{textarea name="description" value=step.description placeholder=(i18n "admin.wizard.custom_text_placeholder")}} + {{d-editor value=step.description placeholder="admin.wizard.custom_text_placeholder"}}
diff --git a/assets/stylesheets/wizard/wizard_custom.scss b/assets/stylesheets/wizard/wizard_custom.scss index 8df18f98..c3203769 100644 --- a/assets/stylesheets/wizard/wizard_custom.scss +++ b/assets/stylesheets/wizard/wizard_custom.scss @@ -47,6 +47,12 @@ .wizard-column .wizard-field .input-area { margin: 0.5em 0; } + + img.emoji { + width: 20px; + height: 20px; + vertical-align: middle; + } } .step-message { diff --git a/assets/stylesheets/wizard_custom_admin.scss b/assets/stylesheets/wizard_custom_admin.scss index f8ba8214..cb5d42d6 100644 --- a/assets/stylesheets/wizard_custom_admin.scss +++ b/assets/stylesheets/wizard_custom_admin.scss @@ -60,10 +60,28 @@ margin-top: 5px; display: block; } + + .d-editor { + width: 100%; + + .d-editor-input { + height: 100px; + } + + button { + margin: 0; + } + } } &.full { width: 100%; + + .setting-value { + width: initial; + overflow: hidden; + float: none; + } } label { diff --git a/controllers/admin.rb b/controllers/admin.rb index 7acf2881..057faa54 100644 --- a/controllers/admin.rb +++ b/controllers/admin.rb @@ -75,6 +75,12 @@ class CustomWizard::AdminController < ::ApplicationController return render json: { error: error } if error + ## end of error checks + + wizard['steps'].each do |s| + s['description'] = PrettyText.cook(s['description']) if s['description'] + end + existing = PluginStore.get('custom_wizard', wizard['id']) || {} new_time = existing['after_time_scheduled'] ? after_time_scheduled != Time.parse(existing['after_time_scheduled']).utc :