1
0
Fork 0

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'), isDropdown: Ember.computed.equal('field.type', 'dropdown'),
disableId: Ember.computed.not('field.isNew'), disableId: Ember.computed.not('field.isNew'),
choicesTypes: ['translation', 'preset', 'custom'], choicesTypes: ['translation', 'preset', 'custom'],
choicesTranslation: Ember.computed.equal('choicesType', 'translation'), choicesTranslation: Ember.computed.equal('field.choices_type', 'translation'),
choicesPreset: Ember.computed.equal('choicesType', 'preset'), choicesPreset: Ember.computed.equal('field.choices_type', 'preset'),
choicesCustom: Ember.computed.equal('choicesType', 'custom'), choicesCustom: Ember.computed.equal('field.choices_type', 'custom'),
@computed('field.type') @computed('field.type')
isInput: (type) => type === 'text' || type === 'textarea', isInput: (type) => type === 'text' || type === 'textarea',

Datei anzeigen

@ -70,7 +70,7 @@
{{i18n 'admin.wizard.field.choices_label'}} {{i18n 'admin.wizard.field.choices_label'}}
</div> </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}} {{#if choicesTranslation}}
<div class="wizard-header small"> <div class="wizard-header small">

Datei anzeigen

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

Datei anzeigen

@ -100,7 +100,14 @@ class CustomWizard::Builder
if f['choices_filters'] && f['choices_filters'].length > 0 if f['choices_filters'] && f['choices_filters'].length > 0
f['choices_filters'].each do |f| 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
end end

Datei anzeigen

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