Module: Jquery::Helpers
- Defined in:
- lib/jquery/modal/helpers.rb,
lib/jquery/modal/helpers/link_helpers.rb
Instance Method Summary collapse
-
#link_to_modal(*args, &block) ⇒ Object
Creates a link tag to a given url or path and ensures that the linke will be rendered as jquery modal dialog.
Instance Method Details
#link_to_modal(*args, &block) ⇒ Object
Creates a link tag to a given url or path and ensures that the linke will be rendered as jquery modal dialog
Signatures
link_to(body, url, = {})
link_to(body, url)
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jquery/modal/helpers/link_helpers.rb', line 12 def link_to_modal(*args, &block) if block_given? = args.first || {} = args.second block_result = capture(&block) link_to_modal(block_result, , ) else name = args[0] = args[1] || {} = args[2] || {} # extend the html_options [:rel] = "modal:open" if (.has_key?(:remote)) if ([:remote] == true) [:rel] = "modal:open:ajaxpost" end # remove the remote tag .delete(:remote) end # check if we have an id [:id] = UUIDTools::UUID.random_create().to_s unless .has_key?(:id) # perform the normal link_to operation html_link = link_to(name, , ) # emit both html_link.html_safe end end |