lib/dining-table/presenters/html_presenter.rb in dining-table-1.1.1 vs lib/dining-table/presenters/html_presenter.rb in dining-table-1.1.2
- old
+ new
@@ -11,11 +11,11 @@
def initialize( options = {} )
super
self.base_tags_configuration = HTMLPresenterConfiguration::TagsConfiguration.from_hash( default_options )
base_tags_configuration.merge_hash( options )
- self.output = ''
+ self.output = ''.html_safe
end
def identifier
:html
end
@@ -47,11 +47,10 @@
set_up_row_configuration( table.index, object )
add_tag(:start, :tr, row_options)
columns.each do |column|
value = column.value( object )
configuration = cell_configuration( tags_configuration, column, table.index, object )
- #render_cell( value, column.options_for( identifier ) )
render_cell( value, configuration )
end
add_tag(:end, :tr)
end
@@ -60,11 +59,10 @@
add_tag(:start, :thead, tag_options(:thead))
add_tag(:start, :tr, row_options)
columns.each do |column|
value = column.header
configuration = cell_configuration( tags_configuration, column, :header, nil )
- #render_header_cell( value, column.options_for( identifier ) )
render_header_cell( value, configuration )
end
add_tag(:end, :tr)
add_tag(:end, :thead)
end
@@ -76,20 +74,19 @@
add_tag(:start, :tfoot, tag_options(:tfoot))
add_tag(:start, :tr, row_options)
columns.each_with_index do |column, index|
value = footers[index]
configuration = cell_configuration( tags_configuration, column, :footer, nil )
- #render_footer_cell( value, column.options_for( identifier ) )
render_footer_cell( value, configuration )
end
add_tag(:end, :tr)
add_tag(:end, :tfoot)
end
end
def output
- @output.respond_to?(:html_safe) ? @output.html_safe : @output
+ @output
end
def table_config(&block)
self.table_config_block = block
end
@@ -108,14 +105,14 @@
string = send("#{ type.to_s }_tag", tag, options)
output_ << string
end
def start_tag(tag, options = {})
- "<#{ tag.to_s }#{ options_string(options) }>"
+ "<#{ tag.to_s }#{ options_string(options) }>".html_safe
end
def end_tag(tag, options = {})
- "</#{ tag.to_s }>"
+ "</#{ tag.to_s }>".html_safe
end
def render_cell( string, configuration )
render_general_cell( string, configuration, :td)
end
\ No newline at end of file