Skip to content

Instantly share code, notes, and snippets.

@paneq
Created May 4, 2012 22:28
Show Gist options
  • Save paneq/2598121 to your computer and use it in GitHub Desktop.
Save paneq/2598121 to your computer and use it in GitHub Desktop.
Apotomo widgets that depends on current user and roles
class AbsenceController < ApplicationController
has_widgets do |root|
current_role.widgets_for(current_user).each do |widget|
root << widget(widget.path, widget.css, :position => widget.position)
end
end
end
class Absence::BasicWidget < Apotomo::Widget
helper do
def widget_div(options={}, &block)
options[:class] = Array.wrap( options[:class] )
options[:class] << :widget
options[:class] << options[:position]
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment