app/helpers/trestle/url_helper.rb in trestle-0.8.6 vs app/helpers/trestle/url_helper.rb in trestle-0.8.7
- old
+ new
@@ -1,7 +1,9 @@
module Trestle
module UrlHelper
+ DIALOG_ACTIONS = [:new, :show, :edit]
+
def admin_link_to(content, instance_or_url=nil, options={}, &block)
if block_given?
instance_or_url, options = content, instance_or_url || {}
content = capture(&block)
end
@@ -25,10 +27,10 @@
action = options.delete(:action) || :show
params = options.delete(:params) || {}
params[:id] ||= admin.to_param(instance_or_url) if instance_or_url
- if [:show, :edit].include?(action) && admin.form.dialog?
+ if DIALOG_ACTIONS.include?(action) && admin.form.dialog?
options[:data] ||= {}
options[:data][:behavior] ||= "dialog"
end
link_to(content, admin.path(action, params), options)