lib/zen/package/dashboard/lib/dashboard/widget.rb in zen-0.4.2 vs lib/zen/package/dashboard/lib/dashboard/widget.rb in zen-0.4.3
- old
+ new
@@ -34,11 +34,11 @@
# Once a widget has been registered it can be retrieved using
# {Dashboard::Widget#[]}:
#
# Dashboard::Widget[:example_widget] # => <Dashboard::Widget ...>
#
- # @since 08-01-2012
+ # @since 2012-01-08
#
class Widget
include Zen::Validation
include Ramaze::Trinity
include Ramaze::Helper::ACL
@@ -73,11 +73,11 @@
# w.data = lambda do |action|
# return action.node.render_view(:example)
# end
# end
#
- # @since 08-01-2012
+ # @since 2012-01-08
#
def add
widget = self.new
yield(widget)
@@ -90,11 +90,11 @@
# Retrieves the widget for the given name.
#
# @example
# Dashboard::Widget[:recent_entries]
#
- # @since 08-01-2012
+ # @since 2012-01-08
#
def [](name)
name = name.to_sym
unless REGISTERED.key?(name)
@@ -106,11 +106,11 @@
##
# Generates the HTML for all active widgets and sorts them by the user's
# sort order.
#
- # @since 14-01-2012
+ # @since 2012-01-14
# @return [String]
#
def html
html = ''
widgets = Dashboard::Model::Widget.select(:name) \
@@ -127,11 +127,11 @@
##
# Builds the HTML for the radio buttons that can be used to change the
# amount of widget columns.
#
- # @since 15-01-2012
+ # @since 2012-01-15
# @return [String]
#
def columns_html
g = Ramaze::Gestalt.new
current = user.widget_columns
@@ -158,11 +158,11 @@
##
# Generates a chunk of HTML that contains various checkboxes to toggle the
# state of all widgets.
#
- # @since 14-01-2012
+ # @since 2012-01-14
# @return [String]
#
def checkbox_html
g = Ramaze::Gestalt.new
active = Dashboard::Model::Widget.select(:name) \
@@ -194,11 +194,11 @@
private
##
# Returns the current user model.
#
- # @since 15-01-2012
+ # @since 2012-01-15
# @return [Users::Model::User]
def user
return Ramaze::Current.action.node.request.env[
Ramaze::Helper::UserHelper::RAMAZE_HELPER_USER
]
@@ -206,11 +206,11 @@
end # class << self
##
# Sets the name of the widget and converts it to a symbol.
#
- # @since 11-01-2012
+ # @since 2012-01-11
# @param [#to_sym] name The name of the widget.
#
def name=(name)
@name = name.to_sym
end
@@ -218,11 +218,11 @@
##
# Returns the title of the widget. If the title is set to a valid language
# string the value of that string is returned, otherwise the raw title is
# returned.
#
- # @since 11-01-2012
+ # @since 2012-01-11
# @return [String]
#
def title
begin
return lang(@title)
@@ -232,22 +232,22 @@
end
##
# Checks if the user is allowed to view the current widget.
#
- # @since 16-01-2012
+ # @since 2012-01-16
# @return [TrueClass|Falseclass]
#
def allowed?
return true if @permission.nil?
return user_authorized?(@permission)
end
##
# Validates the instance of the widget.
#
- # @since 11-01-2012
+ # @since 2012-01-11
#
def validate
validates_presence([:name, :title, :data])
if REGISTERED.key?(name)
@@ -267,10 +267,10 @@
# <div class="body">
# Widget content
# </div>
# </section>
#
- # @since 12-01-2012
+ # @since 2012-01-12
# @return [String]
#
def html
g = Ramaze::Gestalt.new
action = Ramaze::Current.action