class Lolita::Configuration::Action

Attributes

html[W]
name[R]
title[W]

Public Class Methods

new(dbi,name, options ={}, &block) click to toggle source
# File lib/lolita/configuration/action.rb, line 10
def initialize(dbi,name, options ={}, &block)
  @dbi = dbi
  @name = name
  options.each do |key,value|
    self.send(:"#{key}=",value)
  end
  instance_eval(&block) if block_given?
end

Public Instance Methods

html(attributes = nil) click to toggle source
# File lib/lolita/configuration/action.rb, line 19
def html attributes = nil
  if attributes
    @html = attributes
  else
    result = {}
    (@html || {}).each{|k,v|
      result[k] = v.respond_to?(:call) ? v.call : v
    }
    result
  end
end
title(value=nil) click to toggle source
# File lib/lolita/configuration/action.rb, line 31
def title value=nil
  if value
    @title = value
  else
    if @title
      @title.respond_to?(:call) ? @title.call : @title
    else
      ::I18n.t("#{@dbi.klass.to_s.underscore}.actions.#{@name}")
    end
  end
end
view_url(view, record) click to toggle source
# File lib/lolita/configuration/action.rb, line 43
def view_url view, record
  if @url.respond_to?(:call)
    @url.call(view,record)
  else
    @url
  end
end