Class: Showbuilder::Builders::ShowModelTableRowBuilder

Inherits:
Object
  • Object
show all
Includes:
TemplateMethods, I18nText
Defined in:
lib/showbuilder/builders/model_table_row_builder.rb

Instance Attribute Summary collapse

Attributes included from TemplateMethods

#template

Instance Method Summary collapse

Methods included from I18nText

#show_current_itext, #show_itext

Methods included from TemplateMethods

#method_missing

Constructor Details

#initialize(template) ⇒ ShowModelTableRowBuilder

Returns a new instance of ShowModelTableRowBuilder.



15
16
17
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 15

def initialize(template)
  @template = template
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Showbuilder::Builders::TemplateMethods

Instance Attribute Details

#is_headerObject

Returns the value of attribute is_header.



11
12
13
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 11

def is_header
  @is_header
end

#itext_baseObject

Returns the value of attribute itext_base.



12
13
14
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 12

def itext_base
  @itext_base
end

#modelObject

Returns the value of attribute model.



13
14
15
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 13

def model
  @model
end

Instance Method Details

#show_currency_column(*methods) ⇒ Object

show_currency_column :price show_currency_column :product, :price



40
41
42
43
44
45
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 40

def show_currency_column(*methods)
  return show_header_column(methods) if is_header

  content = get_methods_currency_value(model, methods)
   :td, content, :class => 'currency'
end

show_currency_link_column :price show_currency_link_column :product, :price show_currency_link_column :product, :price, :link => :product show_currency_link_column :product, :price, :link => [:sale, :customer] show_currency_link_column :product, :create_at, :link => ->(book){ book_path(book) }



121
122
123
124
125
126
127
128
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 121

def show_currency_link_column(*methods)
  return show_header_column(methods) if is_header

  name = get_methods_currency_value(model, methods)
   :td, :class => 'currency' do
    show_column_link name, methods
  end
end

#show_date_column(*methods) ⇒ Object

show_date_column :create_at show_date_column :sale, :create_at



67
68
69
70
71
72
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 67

def show_date_column(*methods)
  return show_header_column(methods) if is_header

  content = get_methods_date_value(model, methods)
   :td, content, :class => 'date'
end

show_date_link_column :create_at show_date_link_column :sale, :create_at show_date_link_column :sale, :create_at, :link => :sale show_date_link_column :sale, :create_at, :link => [:sale, :customer] show_date_link_column :sale, :create_at, :link => ->(book){ book_path(book) }



93
94
95
96
97
98
99
100
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 93

def show_date_link_column(*methods)
  return show_header_column(methods) if is_header

  name = get_methods_date_value(model, methods)
   :td, :class => 'date' do
    show_column_link name, methods
  end
end

#show_header_column(methods = nil) ⇒ Object

show_header_column show_header_column :balance show_header_column :reminder



133
134
135
136
137
138
139
140
141
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 133

def show_header_column(methods = nil)
  text = ''
  if methods
    methods = Array.wrap(methods)
    methods = filter_methods_options(methods)
    text    = show_current_itext(methods)
  end
   :th, text
end

#show_percent_column(*methods) ⇒ Object

show_percent_column :discount show_percent_column :product, :discount



49
50
51
52
53
54
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 49

def show_percent_column(*methods)
  return show_header_column(methods) if is_header

  content = get_methods_percent_value(model, methods)
   :td, content, :class => 'percent'
end

#show_sequence_column(*args) ⇒ Object

show_sequence_column show_sequence_column :code



21
22
23
24
25
26
27
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 21

def show_sequence_column(*args)
  args = :sequence if args.empty?
  return show_header_column(args) if is_header

  sequence = SequenceManager.get_sequence
   :td, sequence.to_s, :class => 'sequence'
end

#show_text_column(*methods) ⇒ Object

show_text_column :number show_text_column :sale, :number



31
32
33
34
35
36
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 31

def show_text_column(*methods)
  return show_header_column(methods) if is_header

  content = get_methods_text_value(model, methods)
   :td, content, :class => 'text'
end

show_text_link_column :number show_text_link_column :sale, :number show_text_link_column :sale, :number, :link => :sale show_text_link_column :sale, :number, :link => [:sale, :customer] show_text_link_column :sale, :number, :link => ->(book){ book_path(book) }



79
80
81
82
83
84
85
86
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 79

def show_text_link_column(*methods)
  return show_header_column(methods) if is_header

  name = get_methods_text_value(model, methods)
   :td, :class => 'text' do
    show_column_link name, methods
  end
end

#show_time_column(*methods) ⇒ Object

show_time_column :create_at show_time_column :sale, :create_at



58
59
60
61
62
63
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 58

def show_time_column(*methods)
  return show_header_column(methods) if is_header

  content = get_methods_time_value(model, methods)
   :td, content, :class => 'time'
end

show_time_link_column :create_at show_time_link_column :sale, :create_at show_time_link_column :sale, :create_at, :link => :sale show_time_link_column :sale, :create_at, :link => [:sale, :customer] show_time_link_column :sale, :create_at, :link => ->(book){ book_path(book) }



107
108
109
110
111
112
113
114
# File 'lib/showbuilder/builders/model_table_row_builder.rb', line 107

def show_time_link_column(*methods)
  return show_header_column(methods) if is_header

  name = get_methods_time_value(model, methods)
   :td, :class => 'time' do
    show_column_link name, methods
  end
end