diff --git a/lib/custom_wizard/action.rb b/lib/custom_wizard/action.rb index fc436f3b..d68e978b 100644 --- a/lib/custom_wizard/action.rb +++ b/lib/custom_wizard/action.rb @@ -499,7 +499,13 @@ class CustomWizard::Action ).perform params[:raw] = action['post_builder'] ? - mapper.interpolate(action['post_template']) : + mapper.interpolate( + action['post_template'], + user: true, + value: true, + wizard: true, + template: true + ) : data[action['post']] params[:import_mode] = ActiveRecord::Type::Boolean.new.cast(action['suppress_notifications']) diff --git a/lib/custom_wizard/builder.rb b/lib/custom_wizard/builder.rb index 3e86c9c4..813680c6 100644 --- a/lib/custom_wizard/builder.rb +++ b/lib/custom_wizard/builder.rb @@ -177,6 +177,16 @@ class CustomWizard::Builder params[:index] = index.to_i unless index.nil? end + if field_template['description'].present? + params[:description] = mapper.interpolate( + field_template['description'], + user: true, + value: true, + wizard: true, + template: true + ) + end + field = step.add_field(params) end @@ -232,8 +242,11 @@ class CustomWizard::Builder step.description = mapper.interpolate( step_template['description'], user: true, - value: true + value: true, + wizard: true, + template: true ) + step.description = PrettyText.cook(step.description) end step diff --git a/lib/custom_wizard/template.rb b/lib/custom_wizard/template.rb index b0f786c9..a1c0aad0 100644 --- a/lib/custom_wizard/template.rb +++ b/lib/custom_wizard/template.rb @@ -98,7 +98,7 @@ class CustomWizard::Template def prepare_data @data[:steps].each do |step| if step[:raw_description] - step[:description] = PrettyText.cook(step[:raw_description]) + step[:description] = step[:raw_description] end remove_non_mapped_index(step) diff --git a/spec/fixtures/wizard.json b/spec/fixtures/wizard.json index 20ff1441..c21d445c 100644 --- a/spec/fixtures/wizard.json +++ b/spec/fixtures/wizard.json @@ -46,7 +46,7 @@ "type": "text_only" } ], - "description": "

Text inputs!

" + "description": "Text inputs!" }, { "id": "step_2", @@ -93,7 +93,7 @@ "file_types": ".jpg,.jpeg,.png" } ], - "description": "

Because I couldn’t think of another name for this step \":slight_smile:\"

" + "description": "Because I couldn't think of another name for this step :)" }, { "id": "step_3", @@ -160,7 +160,7 @@ "type": "user_selector" } ], - "description": "

Unfortunately not the edible type \":sushi:\"

" + "description": "Unfortunately not the edible type :sushi: " } ], "actions": [