lib/apotomo/widget.rb in apotomo-0.1.3 vs lib/apotomo/widget.rb in apotomo-0.1.4

- old
+ new

@@ -33,13 +33,13 @@ attr_writer :visible attr_writer :controller attr_accessor :version - class << self - include WidgetShortcuts - end + #class << self + # include WidgetShortcuts + #end include TreeNode include Onfire include EventMethods @@ -49,13 +49,17 @@ include WidgetShortcuts helper Apotomo::Rails::ViewHelper + # Runs callbacks for +name+ hook in instance context. + def run_widget_hook(name, *args) + self.class.callbacks_for_hook(name).each { |blk| instance_exec(*args, &blk) } + end def add_has_widgets_blocks(*) - run_hook :has_widgets, self + run_widget_hook(:has_widgets, self) end after_initialize :add_has_widgets_blocks # Constructor which needs a unique id for the widget and one or multiple start states.