class Showbuilder::Builders::ModelViewBuilder
Attributes
model[R]
Public Class Methods
new(model, template)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 12 def initialize(model, template) @model = model @template = template end
Public Instance Methods
build_model_view(&block)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 17 def build_model_view(&block) unless @model return end self.content_tag(:table, :class => "table table-bordered nohead") do @template.capture(self, &block) end end
show_currency(method)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 58 def show_currency(method) self.show_method_field(method) do |value| self.currency_string(value) end end
show_date(method)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 52 def show_date(method) self.show_method_field(method) do |value| self.date_string(value) end end
show_method_field(*method, &block)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 70 def show_method_field(*method, &block) method_label = self.show_current_itext(method) method_value = self.call_object_methods(model, method) if block method_value = block.call(method_value) end self.contents_tag :tr do |contents| contents << self.content_tag(:td, method_label.to_s) contents << self.content_tag(:td, method_value.to_s) end end
show_percent(method)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 64 def show_percent(method) self.show_method_field(method) do |value| self.percent_string(value) end end
show_text(*methods)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 26 def show_text(*methods) self.show_method_field(*methods) do |value| self.safe_html_string(value) end end
show_text_link(link_method, text_method)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 32 def show_text_link(link_method, text_method) methods = [link_method, text_method] method_label = self.show_current_itext(methods) method_value = self.call_object_methods(model, methods) method_link = self.call_object_methods(model, link_method) self.contents_tag :tr do |contents| contents << self.content_tag(:td, method_label.to_s) contents << self.content_tag(:td) do self.show_model_link_to(method_value.to_s, method_link) end end end
show_time(method)
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 46 def show_time(method) self.show_method_field(method) do |value| self.time_string(value) end end
Protected Instance Methods
show_current_itext_base()
click to toggle source
# File lib/showbuilder/builders/model_view_builder.rb, line 85 def show_current_itext_base self.model.class.to_s.underscore end