Module: ScaptimonyPoliciesHelper
- Defined in:
- app/helpers/scaptimony_policies_helper.rb
Instance Method Summary collapse
- #previous_link(form) ⇒ Object
- #profiles_selection ⇒ Object
- #scap_content_profile_selector(form) ⇒ Object
- #scap_content_selector(form) ⇒ Object
- #show_partial_wizard(step) ⇒ Object
- #submit_or_cancel_policy(form, overwrite = nil, args = { }) ⇒ Object
Instance Method Details
#previous_link(form) ⇒ Object
62 63 64 65 66 67 |
# File 'app/helpers/scaptimony_policies_helper.rb', line 62 def previous_link(form) previous = content_tag(:span, :class => 'glyphicon glyphicon-chevron-left') {} content_tag(:div, :class => 'pull-left') do link_to((previous).html_safe, '#', :class => 'btn btn-default', :onclick => "previous_step('#{@policy.previous_step}')") end end |
#profiles_selection ⇒ Object
2 3 4 5 6 |
# File 'app/helpers/scaptimony_policies_helper.rb', line 2 def profiles_selection return @scap_content.scap_content_profiles unless @scap_content.blank? return @policy.scap_content.scap_content_profiles unless @policy.scap_content.blank? return [] end |
#scap_content_profile_selector(form) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/scaptimony_policies_helper.rb', line 24 def scap_content_profile_selector(form) if profiles_selection.length == 1 select_f form, :scap_content_profile_id, profiles_selection, :id, :title, {:selected => @policy.scap_content_profile_id }, {:label => _("XCCDF Profile"), :disabled => profiles_selection.empty? ? true : false, :help_inline => :indicator} else select_f form, :scap_content_profile_id, profiles_selection, :id, :title, {:selected => @policy.scap_content_profile_id, :include_blank => _("Default XCCDF profile")}, {:label => _("XCCDF Profile"), :disabled => profiles_selection.empty? ? true : false, :help_inline => :indicator} end end |
#scap_content_selector(form) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/scaptimony_policies_helper.rb', line 8 def scap_content_selector(form) scap_contents = Scaptimony::ScapContent.all if scap_contents.length > 1 select_f form, :scap_content_id, scap_contents, :id, :title, {:include_blank => _("Choose existing SCAP Content")} , {:label => _("SCAP Content"), :onchange => 'scap_content_selected(this);', :'data-url' => method_path('scap_content_selected')} else select_f form, :scap_content_id, scap_contents, :id, :title, {:label => _("SCAP Content"), :onchange => 'scap_content_selected(this);', :'data-url' => method_path('scap_content_selected')} end end |
#show_partial_wizard(step) ⇒ Object
58 59 60 |
# File 'app/helpers/scaptimony_policies_helper.rb', line 58 def show_partial_wizard(step) @policy.current_step == step ? 'show-pane' : 'hide-pane' end |
#submit_or_cancel_policy(form, overwrite = nil, args = { }) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/helpers/scaptimony_policies_helper.rb', line 41 def submit_or_cancel_policy(form, overwrite = nil, args = { }) args[:cancel_path] ||= send("#{controller_name}_path") content_tag(:div, :class => "clearfix") do content_tag(:div, :class => "form-actions") do text = overwrite ? overwrite : _("Submit") = {:class => "btn btn-primary"} .merge! :'data-id' => form_to_submit_id(form) unless .has_key?(:'data-id') previous = form.object.first_step? ? ' ' : previous_link(form) cancel_and_submit = content_tag(:div, :class => "pull-right") do link_to(_("Cancel"), args[:cancel_path], :class => "btn btn-default") + ' ' + form.submit(text, ) end (previous + cancel_and_submit).html_safe end end end |