Skip to content

Instantly share code, notes, and snippets.

@hayeah
Created November 20, 2010 21:49
Show Gist options
  • Save hayeah/708200 to your computer and use it in GitHub Desktop.
Save hayeah/708200 to your computer and use it in GitHub Desktop.
module DealsHelper
def slider(klass,attr,opts={})
options = {
:max => max=klass.maximum(attr),
:min => min=klass.minimum(attr),
:range => true,
:values => [min,max]
}.merge(opts).to_json
input = hidden_field_tag "#{klass.to_s.underscore}[#{attr}]"
raw <<-HTML
<div class='slider'>
<div class='options'>#{options}</div>
#{input}
</div>
HTML
end
def icon(deal)
image_tag("icon-#{deal.project.type_name.downcase}.png")
end
def checkboxes(name,values)
boxes = values.map { |value|
"<li>#{check_box_tag(name,value)} #{value}</li>"
}
raw "<ul class='checkboxes'>#{boxes.join "\n"}</ul>"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment