Skip to content

Instantly share code, notes, and snippets.

@kennethgeerts
Last active August 29, 2015 14:12
Show Gist options
  • Save kennethgeerts/3229205cb74a302b0e52 to your computer and use it in GitHub Desktop.
Save kennethgeerts/3229205cb74a302b0e52 to your computer and use it in GitHub Desktop.
def document_actions_form_tag
capture do
concat form_tag('', method: :post, id: 'document_actions_form')
input_name_value_pairs(request.params).each do |name_value_pair|
concat tag('input', { name: name_value_pair.first, value: name_value_pair.last, type: 'hidden' })
end
clazz = Class.new do
def checkbox_header
"<input type=\"checkbox\" id=\"select-all\" />".html_safe
end
def checkbox(document_id)
"<input name=\"selected[#{document_id}]\" type=\"checkbox\" class=\"cb\" />".html_safe
end
end
yield clazz.new
concat '</form>'.html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment