tybo 0.3.20 → 0.3.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85ed3bbf8ec48128263b509e2d994dc5db8bb9c9e46ce1ad811a3d87d7ee3bfd
4
- data.tar.gz: db1e30bc88f1c93ac90da0fd29d35012d1fe044f70205eed62db83a1c53fcf68
3
+ metadata.gz: 21a067a8c25ed4f8b9c31d26fa293cfdac168ce166fae0de0478bd402ab4c66d
4
+ data.tar.gz: 9fdaffaab9c6081fbadb2c5a20ec514bee9b5d310fad5021feef284a743299df
5
5
  SHA512:
6
- metadata.gz: 9a1693fc7f40b108b5eb4fb78964276efa90b12f04c23bc3fe9745a82290f44736c0522e0535e51399dc56400a2ec2459e0674c3227d4b78aa73fcfc9d6f545f
7
- data.tar.gz: a2f35bfbd8de7944c44cd5fffef5f3da6f16174baadc6ce063ae2a9bf3816b9fd4ed215a3c11efd12a4e934b28d014fefc5580282f2b18bb8c13cde14380c4db
6
+ metadata.gz: 00e0196ca9fba976da0ac461996368f15e375bde02e4acca66c6f60213a78ad48e2ec35fa07f14561fa2844039d2a80521febb980a37a49da083baf4703d2638
7
+ data.tar.gz: 44c7b62d0b79f2d332eee6f9a5cfc0a1a8125d0d326d2046d6799f4542e8e8b6ef1540b5978690d43d1e3b4bebc321395767802f1ff3884281efac2ffbe775c3
@@ -1,3 +1,8 @@
1
- <th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 hover:cursor-pointer">
2
- <%= sort_link(@q, @column_name, {label: @label, default_order: :asc}) %>
3
- </th>
1
+ <% if @column_name %>
2
+ <th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 hover:cursor-pointer">
3
+ <%= sort_link(@q, @column_name, @label, default_order: :asc) %>
4
+ </th>
5
+ <% else %>
6
+ <th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
7
+ </th>
8
+ <% end %>
@@ -1,17 +1,20 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'ransack/helpers/form_helper'
3
4
 
4
5
  module Tables
5
6
  class ActiveRecordThComponent < ViewComponent::Base
6
7
  include Ransack::Helpers::FormHelper
7
8
 
8
- def initialize(column_name:, ransack_object: )
9
+ def initialize(ransack_object: nil, column_name: nil)
9
10
  @column_name = column_name
10
11
  @q = ransack_object
11
12
  @label = label
12
13
  end
13
14
 
14
15
  def label
16
+ return unless @column_name
17
+
15
18
  I18n.t("bo.#{@q.object.klass.to_s.underscore}.attributes.#{@column_name}")
16
19
  end
17
20
  end
@@ -3,8 +3,8 @@
3
3
  <%- bo_model.column_names.each do |column| -%>
4
4
  <%%= thead.with_active_record_th(column_name: '<%= column %>', ransack_object: @q) %>
5
5
  <%- end -%>
6
- <%%= thead.with_active_record_th(column_name: '', ransack_object: @q) %>
7
- <%%= thead.with_active_record_th(column_name: '', ransack_object: @q) %>
6
+ <%%= thead.with_active_record_th %>
7
+ <%%= thead.with_active_record_th %>
8
8
  <%% end %>
9
9
 
10
10
  <%% table.with_tbody do |tbody| %>
data/lib/tybo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tybo
2
- VERSION = '0.3.20'
2
+ VERSION = '0.3.22'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tybo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Delpierre