0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-09 20:02:54 +01:00

Fix dropdown choices && wizard start

Dieser Commit ist enthalten in:
Angus McLeod 2017-11-08 16:52:50 +08:00
Ursprung a784d4a33e
Commit 8c173a7b17
5 geänderte Dateien mit 26 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -5,9 +5,9 @@ export default Ember.Component.extend({
isDropdown: Ember.computed.equal('field.type', 'dropdown'),
disableId: Ember.computed.not('field.isNew'),
choicesTypes: ['translation', 'preset', 'custom'],
choicesTranslation: Ember.computed.equal('choicesType', 'translation'),
choicesPreset: Ember.computed.equal('choicesType', 'preset'),
choicesCustom: Ember.computed.equal('choicesType', 'custom'),
choicesTranslation: Ember.computed.equal('field.choices_type', 'translation'),
choicesPreset: Ember.computed.equal('field.choices_type', 'preset'),
choicesCustom: Ember.computed.equal('field.choices_type', 'custom'),
@computed('field.type')
isInput: (type) => type === 'text' || type === 'textarea',

Datei anzeigen

@ -70,7 +70,7 @@
{{i18n 'admin.wizard.field.choices_label'}}
</div>
{{combo-box value=choicesType content=choicesTypes none="admin.wizard.field.choices_type"}}
{{combo-box value=field.choices_type content=choicesTypes none="admin.wizard.field.choices_type"}}
{{#if choicesTranslation}}
<div class="wizard-header small">

Datei anzeigen

@ -64,6 +64,10 @@
height: 20px;
vertical-align: middle;
}
.combo-box ul {
padding: 0;
}
}
.step-message {

Datei anzeigen

@ -100,7 +100,14 @@ class CustomWizard::Builder
if f['choices_filters'] && f['choices_filters'].length > 0
f['choices_filters'].each do |f|
objects.reject! { |o| o[f['key']] != f['value'] }
objects.reject! do |o|
prop = f['key']
if prop.include? 'custom_fields'
o.custom_fields[prop.split('.')[1]].to_s != f['value'].to_s
else
o[prop].to_s != f['value'].to_s
end
end
end
end

Datei anzeigen

@ -51,18 +51,17 @@ class CustomWizard::Wizard
end
def start
completed = ::UserHistory.where(
acting_user_id: @user.id,
action: ::UserHistory.actions[:custom_wizard_step],
context: @id,
subject: @steps.map(&:id)
).uniq.pluck(:subject)
@steps.each do |s|
return s unless completed.include?(s.id)
if unfinished?
step_id = ::UserHistory.where(
acting_user_id: @user.id,
action: ::UserHistory.actions[:custom_wizard_step],
context: @id,
subject: @steps.map(&:id)
).order("created_at").last.subject
@steps.find { |s| s.id == step_id }
else
@first_step
end
@first_step
end
def create_updater(step_id, fields)