Class: AjaxScaffold::ScaffoldColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/base/ajax_scaffold.rb,
lib/ajax_scaffold_plugin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, options) ⇒ ScaffoldColumn

Only options is required. It will infer the eval and sort values based on the given class.



7
8
9
10
11
12
13
14
15
# File 'lib/base/ajax_scaffold.rb', line 7

def initialize(klass, options)
  @name = options[:name]
  @eval = options[:eval].nil? ? "#{Inflector.underscore(klass.to_s)}.#{@name}" : options[:eval]
  @label = options[:label].nil? ? Inflector.titleize(@name) : options[:label]
  @sortable = options[:sortable].nil? ? true : options[:sortable]
  @sort_sql = options[:sort_sql].nil? ? "#{klass.table_name}.#{@name}" : options[:sort_sql] unless !@sortable
  @class_name = options[:class_name].nil? ? "" : options[:class_name]
  @sanitize = options[:sanitize].nil? ? true : options[:sanitize]
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



3
4
5
# File 'lib/base/ajax_scaffold.rb', line 3

def class_name
  @class_name
end

#evalObject (readonly)

Returns the value of attribute eval.



3
4
5
# File 'lib/base/ajax_scaffold.rb', line 3

def eval
  @eval
end

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/base/ajax_scaffold.rb', line 3

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/base/ajax_scaffold.rb', line 3

def name
  @name
end

#sanitizeObject (readonly)

Returns the value of attribute sanitize.



3
4
5
# File 'lib/base/ajax_scaffold.rb', line 3

def sanitize
  @sanitize
end

#sortObject (readonly)

Returns the value of attribute sort.



6
7
8
# File 'lib/ajax_scaffold_plugin.rb', line 6

def sort
  @sort
end

#sort_sqlObject (readonly)

Returns the value of attribute sort_sql.



3
4
5
# File 'lib/base/ajax_scaffold.rb', line 3

def sort_sql
  @sort_sql
end

#totalObject (readonly)

Returns the value of attribute total.



6
7
8
# File 'lib/ajax_scaffold_plugin.rb', line 6

def total
  @total
end

Instance Method Details

#add_to_total(value) ⇒ Object



24
25
26
# File 'lib/ajax_scaffold_plugin.rb', line 24

def add_to_total(value)
  @total += value.to_f
end

#sanitize?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/base/ajax_scaffold.rb', line 17

def sanitize?
  @sanitize
end

#sortable?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/base/ajax_scaffold.rb', line 21

def sortable?
  @sortable
end