lib/ui_bibz/ui/ux/table/table.rb in ui_bibz-1.2.5.3 vs lib/ui_bibz/ui/ux/table/table.rb in ui_bibz-2.0.0.alpha

- old
+ new

@@ -27,21 +27,22 @@ # * +url+ - String # * +tap+ - Boolean # * +actionable+ - Boolean # * +sortable+ - Boolean # * +searchable+ - Boolean + # * +default_actions+ - Boolean # # ==== Signatures # # UiBibz::Ui::Ux::Table.new(store: @store) # # UiBibz::Ui::Ux::Table.new(store: @store, tap: true) do |t| # t.columns do |c| # c.column :id, name: '#' # end # t.actions do |a| - # a.action '', url: url, glyph: '' + # a.link '', url: url, glyph: '' # end # end # # ==== Examples # @@ -53,13 +54,13 @@ # c.column :name_fr', { link: edit_user_path(:id), order: 2 } # c.column :name_en' # c.column :status_id, { name: 'Status', format: lambda{ |records, record| "Test #{ record.id}"} } # end # t.actions do |a| - # a.action 'toto', url: users_path(:id), glyph: 'eye' - # a.action '---' - # a.action 'momo', url: users_path(:id), glyph: 'home' + # a.link 'toto', url: users_path(:id), glyph: 'eye' + # a.divider + # a.link 'momo', url: users_path(:id), glyph: 'home' # end # end.render # # ==== Helper # @@ -71,12 +72,12 @@ # cls.column(options = {}, html_options = {}) do # name # end # end # t.actions do |acs| - # acs.action(content, options = {}, html_options = {}) - # acs.action(options = {}, html_options = {}) do + # acs.link(content, options = {}, html_options = {}) + # acs.link(options = {}, html_options = {}) do # content # end # end # end class Table < UiBibz::Ui::Core::Component @@ -138,11 +139,11 @@ def type "table-#{ @options[:type] }" unless @options[:type].nil? end def table_html - content_tag(:table, class_and_html_options(["table", type])) do + content_tag(:table, html_options) do ths = cols.collect do |col| content_tag(:th, sort.header(col)) unless col.hidden? end @@ -167,9 +168,15 @@ content = content.strftime(col.date_format) unless col.date_format.nil? content = link_to content, action.inject_url(col.link, record) unless col.link.nil? content = col.format.call(@store.records, record) unless col.format.nil? content end + end + + private + + def component_html_classes + ["table", type] end end end