Class: RubyMVC::Views::ActiveRecordWebModelView

Inherits:
WebModelView show all
Defined in:
lib/ruby_mvc/views/ar_web_model_view.rb

Instance Attribute Summary

Attributes inherited from WebContentView

#uri

Attributes inherited from View

#controller

Attributes included from ActionProvider

#actions

Instance Method Summary collapse

Methods included from ActionProvider

#action

Methods included from Toolkit::SignalHandler::ClassMethods

#signal, #signals, #valid_signal!, #valid_signal?

Methods included from Toolkit::SignalHandler

#signal_connect, #signal_disconnect, #signal_emit

Constructor Details

#initialize(row, options = {}) ⇒ ActiveRecordWebModelView

Returns a new instance of ActiveRecordWebModelView.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/ruby_mvc/views/ar_web_model_view.rb', line 48

def initialize(row, options = {})
  super

  action(:edit, :label => "Edit", :icon => :stock_edit) do
    signal_emit("row-edit", self, row)
  end

#      action(:delete, :label => "Delete", :icon => :stock_delete) do
#        signal_emit("row-delete", self, row)
#      end

  begin
    if @model.children
      action(:add_child, :label => "Add Child", :icon => :stock_new) do
        signal_emit("add-child", self, row)
      end

      action(:add_child_link, :label => "Add Child Link", :icon => :stock_new) do
        signal_emit("add-child-link", self, row)
      end
    end
  rescue NoMethodError
    # we ignore this on purpose
  end
end

Instance Method Details

#renderObject



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ruby_mvc/views/ar_web_model_view.rb', line 74

def render
  # FIXME: this isn't the way to properly test for
  # ancestry, but we need it right now.  Needs to have a
  # review/revisit of the way things are nested.  It's
  # evolving a little organically at the moment
  # (2012-01-12: ast)

  tagz {
    render_parent
    super
    render_links
  }
end