tybo 0.3.19 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/components/tables/active_record_th_component.html.erb +8 -3
- data/app/components/tables/active_record_th_component.rb +4 -1
- data/app/components/tables/th_component.html.erb +1 -1
- data/config/initializers/ransack.rb +12 -0
- data/lib/generators/bo/templates/_table.html.erb +2 -2
- data/lib/tybo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46c7ccf81962eadc08fc8ce5fbe0262a4f72a8d6e8fd404ab164a9d886ac9c1f
|
|
4
|
+
data.tar.gz: 3f24d05f562105a4702dde1fcddc89a5b52838b3ee51d6fbd68f6f3cf804cc71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f7e133c1ecd51dc506093844eedb6afa1f65e8b8c6c63e04b915f552fa85c779ab66e3939703848b522d7d19f21de7561e61a6392c5eb9a238f930f09b7e79d
|
|
7
|
+
data.tar.gz: 5d7fa0ad9cf593d03c6b64bd3809c1daf4d91f7021b4280ce3fc2720b42a59c22ef7b499f27eb3aa1633bfb069480b1945b1ecfc6363ed2375596801601cb580
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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(
|
|
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
|
|
@@ -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
|
|
7
|
-
<%%= thead.with_active_record_th
|
|
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
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.
|
|
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-
|
|
12
|
+
date: 2024-08-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|