Module: Arturo::FeaturesHelper
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- app/helpers/arturo/features_helper.rb
Instance Method Summary collapse
- #arturo_flash_message(status, message) ⇒ Object
- #arturo_flash_messages(flash = self.flash) ⇒ Object
- #deployment_percentage_output_tag(id, value) ⇒ Object
- #deployment_percentage_range_and_output_tags(name, value, options = {}) ⇒ Object
- #error_messages_for_feature(feature, attribute) ⇒ Object
Instance Method Details
#arturo_flash_message(status, message) ⇒ Object
15 16 17 18 19 20 |
# File 'app/helpers/arturo/features_helper.rb', line 15 def (status, ) content_tag(:div, :class => "alert alert-#{status} alert-arturo") do close = content_tag(:a, '×'.html_safe, :href => '#', :class => 'close', 'data-dismiss' => 'alert') content_tag(:span, ) + close end end |
#arturo_flash_messages(flash = self.flash) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/helpers/arturo/features_helper.rb', line 6 def (flash = self.flash) [ :success, :notice, :error ].inject(''.html_safe) do |output, status| [* flash[status] ].each do || output += (status, ) end output end end |
#deployment_percentage_output_tag(id, value) ⇒ Object
37 38 39 |
# File 'app/helpers/arturo/features_helper.rb', line 37 def deployment_percentage_output_tag(id, value) content_tag(:output, value, { 'for' => id, 'class' => 'deployment_percentage no_js' }) end |
#deployment_percentage_range_and_output_tags(name, value, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/arturo/features_helper.rb', line 22 def (name, value, = {}) id = sanitize_to_id(name) = { 'type' => 'range', 'name' => name, 'id' => id, 'value' => value, 'min' => '0', 'max' => '100', 'step' => '1', 'class' => 'deployment_percentage' }.update(.stringify_keys) tag(:input, ) + deployment_percentage_output_tag(id, value) end |
#error_messages_for_feature(feature, attribute) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/arturo/features_helper.rb', line 41 def (feature, attribute) if feature.errors[attribute].any? content_tag(:ul, :class => 'errors') do feature.errors[attribute].map { |msg| content_tag(:li, msg, :class => 'error') }.join('').html_safe end else '' end end |