Permalink
Browse files

Merge pull request #1075 from ehoch/master

Add Modal Config Section
  • Loading branch information...
2 parents db1ac45 + 4dfea0e commit 6d32552b9929aa196af3b1c0bd292c723c5f6c0c @bbenezech bbenezech committed Apr 10, 2012
@@ -10,7 +10,16 @@ def generate(options = {})
:model_config => @template.instance_variable_get(:@model_config),
:nested_in => false
})
- groups = options[:model_config].send(options[:nested_in] ? :nested : options[:action]).with(:form => self, :object => @object, :view => @template).visible_groups
+
+ if options[:nested_in]
+ action = :nested
+ elsif @template.request.format == 'text/javascript'
+ action = :modal
+ else
+ action = options[:action]
+ end
+
+ groups = options[:model_config].send(action).with(:form => self, :object => @object, :view => @template).visible_groups
object_infos +
groups.map do |fieldset|
@@ -4,6 +4,7 @@
require 'rails_admin/config/sections/update'
require 'rails_admin/config/sections/create'
require 'rails_admin/config/sections/nested'
+require 'rails_admin/config/sections/modal'
require 'rails_admin/config/sections/list'
require 'rails_admin/config/sections/export'
require 'rails_admin/config/sections/show'
@@ -0,0 +1,10 @@
+require 'rails_admin/config/sections/edit'
+
+module RailsAdmin
+ module Config
+ module Sections
+ class Modal < RailsAdmin::Config::Sections::Edit
+ end
+ end
+ end
+end

0 comments on commit 6d32552

Please sign in to comment.