-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
I have a setup method in almost all my widgets that sets a instance variable that should be presented by the widget. I use the after_initialize callback method to call setup. Often however do i want to pass this instance to a child widget, but the setup method is called after has_widgets so it's not set yet. Is their a way to change this order?
Example:
class UsageWidget < Apotomo:Widget
after_initialize :setup
has_widgets do |root|
self << widget("usage/graph", :graph,
usage: @usage) # doesn't work, @usage is not set yet
end
def display
render
end
private
def setup(widget)
@user = options[:user]
@organization = options[:organization]
@usage = UsagePresenter.new(@user, @organization, view_context)
end
endReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels