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
14 15 16 17 18 19 |
# File 'app/helpers/arturo/features_helper.rb', line 14 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
5 6 7 8 9 10 11 12 |
# File 'app/helpers/arturo/features_helper.rb', line 5 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
36 37 38 |
# File 'app/helpers/arturo/features_helper.rb', line 36 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
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/arturo/features_helper.rb', line 21 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
40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/arturo/features_helper.rb', line 40 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 |