Revision feacea35
Added by Amos Benari about 11 years ago
- ID feacea35f07f362d9e2c694a83516bbc902321a0
app/helpers/application_helper.rb | ||
---|---|---|
link_to_function(name, ("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")").html_safe, add_html_classes(options, "btn btn-success") )
|
||
end
|
||
|
||
def toggle_div divs
|
||
update_page do |page|
|
||
(divs.is_a?(Array) ? divs : divs.to_s).each_line do |div|
|
||
# add jquery '#div' to the div if its missing
|
||
div = div.to_s
|
||
div = "##{div}" if div[0] != "#"
|
||
page << "if ($('#{div}').is(':visible')) {"
|
||
page[div].hide()
|
||
page << "} else {"
|
||
page[div].show
|
||
page << "}"
|
||
end
|
||
end
|
||
end
|
||
|
||
def link_to_remove_puppetclass klass, host
|
||
options = klass.name.size > 28 ? {:'data-original-title'=>klass.name, :rel=>'twipsy'} : {}
|
||
content_tag(:span, truncate(klass.name, :length => 28), options).html_safe +
|
||
... | ... | |
:'data-original-title'=>"Click to remove #{klass}", :rel=>'twipsy',
|
||
:'data-url' => parameters_puppetclass_path( :id => klass.id),
|
||
:'data-host-id' => host.id,
|
||
:class=>"ui-icon ui-icon-minus")
|
||
:'data-animation' => "",
|
||
:class=>"icon-remove-sign")
|
||
end
|
||
|
||
def link_to_add_puppetclass klass, host, type
|
||
... | ... | |
:'data-url' => parameters_puppetclass_path( :id => klass.id),
|
||
:'data-host-id' => host.try(:id),
|
||
:'data-original-title' => "Click to add #{klass}", :rel => 'twipsy',
|
||
:class => "ui-icon ui-icon-plus")
|
||
:'data-animation' => "",
|
||
:class => "icon-plus-sign")
|
||
end
|
||
|
||
def add_html_classes options, classes
|
||
... | ... | |
options
|
||
end
|
||
|
||
def check_all_links(form_name=':checkbox')
|
||
link_to_function("Check all", "checkAll('#{form_name}', true)") +
|
||
link_to_function("Uncheck all", "checkAll('#{form_name}', false)")
|
||
def check_all_roles_links
|
||
link_to("Check all", "#", :id => "check_all_roles", :remote => true) +
|
||
link_to("Uncheck all", "#", :id => "uncheck_all_roles", :remote => true)
|
||
end
|
||
|
||
# Return true if user is authorized for controller/action, otherwise false
|
||
... | ... | |
end
|
||
end
|
||
|
||
def auto_complete_search(method, val,tag_options = {}, completion_options = {})
|
||
def auto_complete_search(name, val, options = {})
|
||
path = eval("#{controller_name}_path")
|
||
options = tag_options.merge(:class => "auto_complete_input")
|
||
text_field_tag(method, val, options) + auto_complete_clear_value_button(method) +
|
||
auto_complete_field_jquery(method, "#{path}/auto_complete_#{method}", completion_options)
|
||
options.merge!(:class => "autocomplete-input", :'data-url' => "#{path}/auto_complete_#{name}" )
|
||
text_field_tag(name, val, options)
|
||
end
|
||
|
||
def help_path
|
||
... | ... | |
end
|
||
|
||
def gravatar_image_tag(email, html_options = {})
|
||
default_image = "/images/user.jpg"
|
||
default_image = "user.jpg"
|
||
html_options.merge!(:onerror=>"this.src='#{default_image}'")
|
||
image_tag(gravatar_url(email, default_image), html_options)
|
||
end
|
Also available in: Unified diff
upgrade foreman to rails 3.2.13
This commit updates from rails 3.0.x to 3.2.x, main changes include:
Users who uses foreman in production, make sure that you now compile
your assets, e.g
rake assets:precompile
Paired-with: Joseph Mitchell Magen <jmagen@redhat.com>
Paired-with: Ohad Levy <ohadlevy@gmail.com>
Signed-off-by: Ohad Levy <ohadlevy@gmail.com>