Fix start step && add dropdown none
Dieser Commit ist enthalten in:
Ursprung
8c173a7b17
Commit
75d4fcaab5
8 geänderte Dateien mit 42 neuen und 4 gelöschten Zeilen
|
@ -96,5 +96,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{wizard-custom-input inputs=field.choices}}
|
{{wizard-custom-input inputs=field.choices}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="wizard-header small">
|
||||||
|
{{i18n 'admin.wizard.field.dropdown_none'}}
|
||||||
|
</div>
|
||||||
|
{{input name="dropdown_none" value=field.dropdown_none placeholder=(i18n 'admin.wizard.field.dropdown_none_placeholder')}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{{combo-box elementId=field.id
|
||||||
|
class=fieldClass
|
||||||
|
value=field.value
|
||||||
|
content=field.choices
|
||||||
|
none=field.dropdown_none
|
||||||
|
nameProperty="label"
|
||||||
|
tabindex="9"}}
|
|
@ -38,14 +38,22 @@
|
||||||
|
|
||||||
{{#if showNextButton}}
|
{{#if showNextButton}}
|
||||||
<button class='wizard-btn next primary' {{action "nextStep"}} disabled={{saving}} tabindex="10">
|
<button class='wizard-btn next primary' {{action "nextStep"}} disabled={{saving}} tabindex="10">
|
||||||
{{i18n "wizard.next"}}
|
{{#if saving}}
|
||||||
{{d-icon "chevron-right"}}
|
{{loading-spinner size='small'}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n "wizard.next"}}
|
||||||
|
{{d-icon "chevron-right"}}
|
||||||
|
{{/if}}
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showDoneButton}}
|
{{#if showDoneButton}}
|
||||||
<button class='wizard-btn done' {{action "done"}} disabled={{saving}} tabindex="10">
|
<button class='wizard-btn done' {{action "done"}} disabled={{saving}} tabindex="10">
|
||||||
{{i18n "wizard.done"}}
|
{{#if saving}}
|
||||||
|
{{loading-spinner size='small'}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n "wizard.done"}}
|
||||||
|
{{/if}}
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -68,6 +68,11 @@
|
||||||
.combo-box ul {
|
.combo-box ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wizard-buttons > a, .wizard-buttons > button {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-message {
|
.step-message {
|
||||||
|
|
|
@ -60,6 +60,8 @@ en:
|
||||||
header: "Fields"
|
header: "Fields"
|
||||||
label: "Label"
|
label: "Label"
|
||||||
description: "Description"
|
description: "Description"
|
||||||
|
dropdown_none: "None"
|
||||||
|
dropdown_none_placeholder: "Translation Key"
|
||||||
choices_label: "Dropdown Choices"
|
choices_label: "Dropdown Choices"
|
||||||
choices_type: "Choose a type"
|
choices_type: "Choose a type"
|
||||||
choices_translation: "Translation"
|
choices_translation: "Translation"
|
||||||
|
|
|
@ -80,6 +80,8 @@ class CustomWizard::Builder
|
||||||
field = step.add_field(params)
|
field = step.add_field(params)
|
||||||
|
|
||||||
if f['type'] === 'dropdown'
|
if f['type'] === 'dropdown'
|
||||||
|
field.dropdown_none = f['dropdown_none'] if f['dropdown_none']
|
||||||
|
|
||||||
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['value'], label: c['label'])
|
||||||
|
|
|
@ -58,7 +58,8 @@ class CustomWizard::Wizard
|
||||||
context: @id,
|
context: @id,
|
||||||
subject: @steps.map(&:id)
|
subject: @steps.map(&:id)
|
||||||
).order("created_at").last.subject
|
).order("created_at").last.subject
|
||||||
@steps.find { |s| s.id == step_id }
|
last_index = @steps.index { |s| s.id == step_id }
|
||||||
|
@steps[last_index + 1]
|
||||||
else
|
else
|
||||||
@first_step
|
@first_step
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,6 +25,7 @@ end
|
||||||
|
|
||||||
::Wizard::Field.class_eval do
|
::Wizard::Field.class_eval do
|
||||||
attr_reader :label, :description, :key, :min_length
|
attr_reader :label, :description, :key, :min_length
|
||||||
|
attr_accessor :dropdown_none
|
||||||
|
|
||||||
def initialize(attrs)
|
def initialize(attrs)
|
||||||
attrs = attrs || {}
|
attrs = attrs || {}
|
||||||
|
@ -38,6 +39,7 @@ end
|
||||||
@min_length = attrs[:min_length]
|
@min_length = attrs[:min_length]
|
||||||
@value = attrs[:value]
|
@value = attrs[:value]
|
||||||
@choices = []
|
@choices = []
|
||||||
|
@dropdown_none = attrs[:dropdown_none]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,6 +104,8 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
::WizardFieldSerializer.class_eval do
|
::WizardFieldSerializer.class_eval do
|
||||||
|
attributes :dropdown_none
|
||||||
|
|
||||||
def label
|
def label
|
||||||
return object.label if object.label
|
return object.label if object.label
|
||||||
I18n.t("#{object.key || i18n_key}.label", default: '')
|
I18n.t("#{object.key || i18n_key}.label", default: '')
|
||||||
|
@ -115,4 +119,8 @@ end
|
||||||
def placeholder
|
def placeholder
|
||||||
I18n.t("#{object.key || i18n_key}.placeholder", default: '')
|
I18n.t("#{object.key || i18n_key}.placeholder", default: '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dropdown_none
|
||||||
|
object.dropdown_none
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren