Skip to content

Commit

Permalink
Merge pull request #765 from instedd/feature/760-additional_callback_…
Browse files Browse the repository at this point in the history
…info

Support additional variables in call flow steps
  • Loading branch information
ggiraldez authored Nov 3, 2016
2 parents e4ee835 + 6d3a3e3 commit 1caa48e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@ onWorkflow ->
display_name: @display_name
}

content_kinds: () =>
return [{text: 'Variable', value: 'variable'},
{text: 'Step', value: 'step'},
{text: 'Response', value: 'response'},
{text: 'Value', value: 'value'}]

available_variables: () =>
workflow.all_variables().sort()

available_steps: () =>
{name: step.name(), value: step.id} for step in workflow.steps() when (step.type() == 'capture') || (step.type() == 'menu')

available_responses: () =>
_.flatten({name: "#{step.name()} - #{variable.display_name}", value: "#{step.id}_#{variable.name}"} for variable in step.response_variables() for step in workflow.steps() when step.response_variables?)

on_step_removed: (step) =>
@step_id(null) if step.id == parseInt(@step_id())
@response(null) if step.id == parseInt(@response()) # Note that parseInt("123_resp") == "123"

description: () =>
desc = super()
if desc? then "(#{desc})" else null
Expand Down
2 changes: 1 addition & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Project < ActiveRecord::Base
after_save :telemetry_track_activity

def defined_variables
project_variables.collect(&:name)
project_variables.collect(&:name) + [ImplicitVariables::Language.key, ImplicitVariables::SmsNumber.key]
end

def update_variables_with variable_names
Expand Down
2 changes: 1 addition & 1 deletion spec/models/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
'max_input_length' => 2,
'timeout' => 10 }]

project.reload.defined_variables.should eq(['some_variable', 'foo'])
project.reload.defined_variables.should eq(['some_variable', 'foo', 'language', 'sms_number'])
end
end

Expand Down

0 comments on commit 1caa48e

Please sign in to comment.