Module: CommonParametersHelper

Included in:
DomainsHelper, HostgroupsHelper, OperatingsystemsHelper, TrendsHelper
Defined in:
app/helpers/common_parameters_helper.rb

Instance Method Summary collapse

Instance Method Details

#authorized_via_my_scope(controller, action) ⇒ Object

Return true if user is authorized for controller/action OR controller/[email protected], otherwise false


3
4
5
6
7
8
# File 'app/helpers/common_parameters_helper.rb', line 3

def authorized_via_my_scope(controller, action)
  return true if authorized_for(controller, action)

  operation = "#{action}_my_#{controller.singularize}".to_sym
  User.current.allowed_to?(operation) and User.current.send(controller).include?(instance_variable_get("@#{controller.singularize}"))
end

#parameter_value_field(value) ⇒ Object


14
15
16
17
18
19
20
# File 'app/helpers/common_parameters_helper.rb', line 14

def parameter_value_field value
   :div, :class => "control-group condensed"  do
    text_area_tag("value_#{value[:value]}", value[:value], :rows => (value[:value].to_s.lines.count || 1 rescue 1),
                  :class => "span5", :disabled => true) +
    (:span, :class => "help-inline") { popover(_("Additional info"), _("<b>Source:</b> %s") % (value[:source]))}
  end
end

#parameters_titleObject


10
11
12
# File 'app/helpers/common_parameters_helper.rb', line 10

def parameters_title
  _("Parameters that would be associated with hosts in this %s") % (type)
end