Skip to content

Commit

Permalink
Allow columns to be defined as simple symbols
Browse files Browse the repository at this point in the history
When both the header and the data are defaulting to an AR attribute
passing just the symbol should suffice.
  • Loading branch information
elia committed Nov 29, 2023
1 parent a8662f9 commit 0004821
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion admin/app/components/solidus_admin/ui/table/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class Data < Struct.new(:rows, :class, :url, :prev, :next, :columns, :fade, :bat
def initialize(**args)
super

self.columns = columns.map { |column| Column.new(wrap: false, **column) }
self.columns = columns.map do |column|
column.is_a?(Symbol) ? Column.new(wrap: false, header: column, data: column) : Column.new(wrap: false, **column)
end
self.batch_actions = batch_actions.to_a.map { |action| BatchAction.new(**action) }
end

Expand Down

0 comments on commit 0004821

Please sign in to comment.