diff --git a/app/logical/table_builder.rb b/app/logical/table_builder.rb index 4438befef..e47de0e64 100644 --- a/app/logical/table_builder.rb +++ b/app/logical/table_builder.rb @@ -2,8 +2,9 @@ class TableBuilder class Column attr_reader :attribute, :name, :block, :header_attributes, :body_attributes - def initialize(attribute = nil, th: {}, td: {}, width: nil, name: nil, &block) + def initialize(attribute = nil, column: nil, th: {}, td: {}, width: nil, name: nil, &block) @attribute = attribute + @column = column @header_attributes = { width: width, **th } @body_attributes = td @block = block @@ -11,8 +12,12 @@ class TableBuilder @name = name || attribute @name = @name.to_s.titleize unless @name.is_a?(String) - if @name.present? - column_class = "#{@name.parameterize.dasherize}-column" + if @name.present? || @column.present? + if @column.present? + column_class = "#{@column}-column" + else + column_class = "#{@name.parameterize.dasherize}-column" + end @header_attributes[:class] = "#{column_class} #{@header_attributes[:class]}".strip @body_attributes[:class] = "#{column_class} #{@body_attributes[:class]}".strip end diff --git a/app/views/artist_commentaries/index.html.erb b/app/views/artist_commentaries/index.html.erb index c5c3ef765..fbecb4f14 100644 --- a/app/views/artist_commentaries/index.html.erb +++ b/app/views/artist_commentaries/index.html.erb @@ -5,7 +5,7 @@ <%= render "posts/partials/common/inline_blacklist" %> <%= table_for @commentaries, width: "100%" do |t| %> - <% t.column "Post", {width: "1%"} do |commentary| %> + <% t.column "Post", width: "1%" do |commentary| %> <%= PostPresenter.preview(commentary.post, :tags => "status:any") %> <% end %> <% t.column "Original" do |commentary| %> diff --git a/app/views/artist_commentary_versions/_listing.html.erb b/app/views/artist_commentary_versions/_listing.html.erb index f1963eed1..2f2e1f18d 100644 --- a/app/views/artist_commentary_versions/_listing.html.erb +++ b/app/views/artist_commentary_versions/_listing.html.erb @@ -1,7 +1,7 @@