Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-10 04:12:53 +01:00
Cook dropdown choices
Dieser Commit ist enthalten in:
Ursprung
1442bfe898
Commit
5e936036e6
3 geänderte Dateien mit 19 neuen und 1 gelöschten Zeilen
|
@ -215,6 +215,10 @@
|
||||||
|
|
||||||
.combo-box ul {
|
.combo-box ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
li p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wizard-buttons > a, .wizard-buttons > button, .spinner {
|
.wizard-buttons > a, .wizard-buttons > button, .spinner {
|
||||||
|
|
|
@ -91,7 +91,7 @@ class CustomWizard::Builder
|
||||||
|
|
||||||
if f['choices'] && f['choices'].length > 0
|
if f['choices'] && f['choices'].length > 0
|
||||||
f['choices'].each do |c|
|
f['choices'].each do |c|
|
||||||
field.add_choice(c['value'], label: c['label'])
|
field.add_choice(c['key'], label: c['value'])
|
||||||
end
|
end
|
||||||
elsif f['choices_key'] && f['choices_key'].length > 0
|
elsif f['choices_key'] && f['choices_key'].length > 0
|
||||||
choices = I18n.t(f['choices_key'])
|
choices = I18n.t(f['choices_key'])
|
||||||
|
|
|
@ -44,6 +44,20 @@ end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
::Wizard::Choice.class_eval do
|
||||||
|
def initialize(id, opts)
|
||||||
|
@id = id
|
||||||
|
@opts = opts
|
||||||
|
@data = opts[:data]
|
||||||
|
@extra_label = opts[:extra_label]
|
||||||
|
@icon = opts[:icon]
|
||||||
|
end
|
||||||
|
|
||||||
|
def label
|
||||||
|
@label ||= PrettyText.cook(@opts[:label], keep_emoji_images: true, postProcessTag: '<div>')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class ::Wizard::Step
|
class ::Wizard::Step
|
||||||
attr_accessor :title, :description, :key
|
attr_accessor :title, :description, :key
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren