lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.58 vs lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.59

- old
+ new

@@ -68,11 +68,11 @@ html_options[:class] << ' ujs-dialog' html_options[:'data-dialog-id'] = dialog_id html_options[:'data-close-x'] = dialog_options[:close_x] tag_name = html_options.delete(:tag_name) || :a - html_options[:href] = '#' if tag_name == :a + html_options[:href] ||= '#' if tag_name == :a dialog_options[:dialogClass] ||= '' if dialog_options[:title] == false # not nil or blank dialog_options[:dialogClass] << ' ujs-dialog-modal no-title' else @@ -121,10 +121,14 @@ # Same as link_to_dialog, but loads content from a remote URL instead of # using content already on the page. # If a block is given, dialog_options and html_options are shifted left by # 1 and the block is used as the html_content. + # Note that this method should only be used if the URL being linked to + # is valid to display by itself (i.e. the user can copy/paste it or + # open it in a new tab). If it is only viewable in a partial, you should + # be using button_to_remote_dialog. # @param url [String] The URL to load the content from. # @param html_content [String] Text or HTML tags to use as the link body. # @param dialog_options [Hash] Dialog options as described in the readme. # @param html_options [Hash] Attributes to put on the link tag. There is # a special :tag_name option that can be used to change the tag being @@ -136,9 +140,10 @@ if block_given? html_options = dialog_options dialog_options = html_content html_content = capture(&block) end + html_options[:href] = url html_options[:'data-throbber'] = dialog_options.delete(:throbber) || 'large' html_options[:'data-dialog-url'] = url link_to_dialog(Helpers._random_string, html_content,