Class: AjaxScaffold::ScaffoldColumn
- Inherits:
-
Object
- Object
- AjaxScaffold::ScaffoldColumn
- Defined in:
- lib/base/ajax_scaffold.rb,
lib/ajax_scaffold_plugin.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#eval ⇒ Object
readonly
Returns the value of attribute eval.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sanitize ⇒ Object
readonly
Returns the value of attribute sanitize.
-
#sort ⇒ Object
readonly
Returns the value of attribute sort.
-
#sort_sql ⇒ Object
readonly
Returns the value of attribute sort_sql.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #add_to_total(value) ⇒ Object
-
#initialize(klass, options) ⇒ ScaffoldColumn
constructor
Only options is required.
- #sanitize? ⇒ Boolean
- #sortable? ⇒ Boolean
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, ) @name = [:name] @eval = [:eval].nil? ? "#{Inflector.underscore(klass.to_s)}.#{@name}" : [:eval] @label = [:label].nil? ? Inflector.titleize(@name) : [:label] @sortable = [:sortable].nil? ? true : [:sortable] @sort_sql = [:sort_sql].nil? ? "#{klass.table_name}.#{@name}" : [:sort_sql] unless !@sortable @class_name = [:class_name].nil? ? "" : [:class_name] @sanitize = [:sanitize].nil? ? true : [:sanitize] end |
Instance Attribute Details
#class_name ⇒ Object (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 |
#eval ⇒ Object (readonly)
Returns the value of attribute eval.
3 4 5 |
# File 'lib/base/ajax_scaffold.rb', line 3 def eval @eval end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
3 4 5 |
# File 'lib/base/ajax_scaffold.rb', line 3 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/base/ajax_scaffold.rb', line 3 def name @name end |
#sanitize ⇒ Object (readonly)
Returns the value of attribute sanitize.
3 4 5 |
# File 'lib/base/ajax_scaffold.rb', line 3 def sanitize @sanitize end |
#sort ⇒ Object (readonly)
Returns the value of attribute sort.
6 7 8 |
# File 'lib/ajax_scaffold_plugin.rb', line 6 def sort @sort end |
#sort_sql ⇒ Object (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 |
#total ⇒ Object (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
17 18 19 |
# File 'lib/base/ajax_scaffold.rb', line 17 def sanitize? @sanitize end |
#sortable? ⇒ Boolean
21 22 23 |
# File 'lib/base/ajax_scaffold.rb', line 21 def sortable? @sortable end |