Module: WebFlow::BaseHelper
- Defined in:
- lib/webflow/base_helper.rb
Instance Method Summary collapse
-
#end_flow_form_tag ⇒ Object
Alias for Rails standard end_form_tag.
-
#flow_button_tag(content_or_options = nil, options = nil, &block) ⇒ Object
Helper method to generate a button element.
- #flow_form_tag(url_for_options = {}, options = {}, &block) ⇒ Object
-
#flow_key_tag ⇒ Object
Helper method to generate a hidden
input
tag for the flow execution key. -
#flow_link_to(*args, &block) ⇒ Object
Helper method to generate an HTML anchor element.
- #get_flow_data(key) ⇒ Object
Instance Method Details
#end_flow_form_tag ⇒ Object
Alias for Rails standard end_form_tag
253 254 255 |
# File 'lib/webflow/base_helper.rb', line 253 def end_flow_form_tag end_form_tag end |
#flow_button_tag(content_or_options = nil, options = nil, &block) ⇒ Object
Helper method to generate a button element. This is a wrapper method for the Rails button_tag method. It adds a data-remote attribute, if specified, to enable an UJS ajax submission.
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/webflow/base_helper.rb', line 210 def ( = nil, = nil, &block) = if block_given? && .is_a?(Hash) ||= {} .stringify_keys! if remote = .delete("remote") ["data-remote"] = remote end if event = .delete("event") ["name"] = WebFlow::Base.event_input_name_prefix + WebFlow::Base.event_prefix + event.to_s ["value"] = WebFlow::Base.event_prefix + event.to_s end , , &block end |
#flow_form_tag(url_for_options = {}, options = {}, &block) ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/webflow/base_helper.rb', line 187 def flow_form_tag( = {}, = {}, &block) content = if block_given? form_tag , , &block else form_tag , end content << hidden_field_tag(WebFlow::Base.flow_execution_key_id, @flow_id) content end |
#flow_key_tag ⇒ Object
Helper method to generate a hidden input
tag for the flow execution key.
182 183 184 |
# File 'lib/webflow/base_helper.rb', line 182 def flow_key_tag hidden_field_tag WebFlow::Base.flow_execution_key_id, @flow_id end |
#flow_link_to(*args, &block) ⇒ Object
Helper method to generate an HTML anchor element. This method is a wrapper for the Rails link_to method.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/webflow/base_helper.rb', line 235 def flow_link_to(*args, &block) if block_given? = args.first || {} event_name = args.second = args.third flow_link_to(capture(&block), event_name, , ) else name = args[0] event_name = args[1] = args[2] || {} = args[3] [:method] = 'GET' link_to name, append_flow_params(, event_name), end end |
#get_flow_data(key) ⇒ Object
258 259 260 |
# File 'lib/webflow/base_helper.rb', line 258 def get_flow_data(key) controller.current_flow_user_data[key] end |