Class: RubyMVC::Views::ActiveRecordTypeEditor
- Includes:
- LinkDispatcher
- Defined in:
- lib/ruby_mvc/views/ar_type_editor.rb
Instance Attribute Summary
Attributes inherited from View
Instance Method Summary collapse
- #create_instance(sender, link) ⇒ Object
-
#initialize(type, options = {}, &block) ⇒ ActiveRecordTypeEditor
constructor
A new instance of ActiveRecordTypeEditor.
Methods included from LinkDispatcher
Methods inherited from View
create_widget, #method_missing, #peer, widget, widget_def
Constructor Details
#initialize(type, options = {}, &block) ⇒ ActiveRecordTypeEditor
Returns a new instance of ActiveRecordTypeEditor.
32 33 34 35 36 37 38 39 40 |
# File 'lib/ruby_mvc/views/ar_type_editor.rb', line 32 def initialize(type, = {}, &block) ctrl = [:controller] = [:controller] || self super(, &block) @type = type @list = active_record_type_list type para link("New...") { ctrl.link_activated(self, "/create_instance") } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RubyMVC::Views::View
Instance Method Details
#create_instance(sender, link) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ruby_mvc/views/ar_type_editor.rb', line 42 def create_instance(sender, link) debug("create instance of type #{@type}") obj = @type.new window do stack do obj.description = "Some text" editor = active_record_model_editor obj flow :margin_left => 0, :left => "-25%" do "Cancel", :align => "right" do close end "Save", :align => "right" do editor.save close end debug("created buttons") end end end end |