tybo 0.3.19 → 0.3.21

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: 5fa22fc601913bf1aae5be6248ff79547787487e9ee1aba09d1c90284611b07b
4
- data.tar.gz: e80f52b39e0457de3aadc41341a68da323f80f850724d1766912267c29231835
3
+ metadata.gz: 46c7ccf81962eadc08fc8ce5fbe0262a4f72a8d6e8fd404ab164a9d886ac9c1f
4
+ data.tar.gz: 3f24d05f562105a4702dde1fcddc89a5b52838b3ee51d6fbd68f6f3cf804cc71
5
5
  SHA512:
6
- metadata.gz: '090d568923ef0c9554d115ec23d3e5b0d42502ecaca06dd7fb4430f5a854c7d35eba1049be9cec0c1ccf6c819e4e7985f56e3a22a404a76ca518fdcb06cef0c5'
7
- data.tar.gz: 728c0c5c3d7260b88f5756456f307863e427441c924bb42cd8626ffed46e0e5a97b5b0d5457ecfc29a2fd8042bd4503fa1659a9e1eac35ef30924848e9ce0fda
6
+ metadata.gz: 4f7e133c1ecd51dc506093844eedb6afa1f65e8b8c6c63e04b915f552fa85c779ab66e3939703848b522d7d19f21de7561e61a6392c5eb9a238f930f09b7e79d
7
+ data.tar.gz: 5d7fa0ad9cf593d03c6b64bd3809c1daf4d91f7021b4280ce3fc2720b42a59c22ef7b499f27eb3aa1633bfb069480b1945b1ecfc6363ed2375596801601cb580
@@ -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: @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
@@ -1,3 +1,3 @@
1
- <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
1
+ <th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
2
2
  <%= content %>
3
3
  </th>
@@ -10,4 +10,16 @@ Ransack.configure do |config|
10
10
  formatter: proc { |v| v.end_of_day },
11
11
  validator: proc { |v| v.present? },
12
12
  type: :date
13
+
14
+ config.custom_arrows = {
15
+ default_arrow: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="inline-block w-4 h-4 align-middle">
16
+ <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
17
+ </svg>',
18
+ up_arrow: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline-block w-4 h-4 align-middle">
19
+ <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 15.75 7.5-7.5 7.5 7.5" />
20
+ </svg>',
21
+ down_arrow: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="inline-block w-4 h-4 align-middle">
22
+ <path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
23
+ </svg>'
24
+ }
13
25
  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.19'
2
+ VERSION = '0.3.21'
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.19
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Delpierre
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-27 00:00:00.000000000 Z
12
+ date: 2024-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails