app/helpers/trestle/url_helper.rb in trestle-0.9.8 vs app/helpers/trestle/url_helper.rb in trestle-0.10.0.pre
- old
+ new
@@ -1,8 +1,8 @@
module Trestle
module UrlHelper
- DIALOG_ACTIONS = [:new, :show, :edit]
+ MODAL_ACTIONS = [:new, :show, :edit]
def admin_link_to(content, instance_or_url=nil, options={}, &block)
# Block given - ignore content parameter and capture content from block
if block_given?
instance_or_url, options = content, instance_or_url || {}
@@ -43,12 +43,15 @@
params[:id] ||= admin.to_param(instance) if instance
path = admin.path(action, params)
end
# Determine link data options
- if DIALOG_ACTIONS.include?(action) && admin.form.dialog?
- options[:data] ||= {}
- options[:data][:behavior] ||= "dialog"
+ options[:data] ||= {}
+
+ if MODAL_ACTIONS.include?(action) && admin.form.modal?
+ options[:data][:controller] ||= "modal-trigger"
+ else
+ options[:data][:turbo_frame] = "_top"
end
link_to(content, path, options)
else
raise ActionController::UrlGenerationError, "An admin could not be inferred. Please specify an admin using the :admin option."