tramway 3.1.2.8 → 4.0.1.1
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/README.md +134 -18
- data/app/assets/builds/tailwind.css +2 -0
- data/app/assets/javascripts/tramway/tramway.js +202 -1
- data/app/assets/stylesheets/font-awesome.css +2337 -0
- data/app/assets/tailwind/application.css +29 -0
- data/app/components/tramway/chat_component.html.haml +1 -1
- data/app/components/tramway/containers/main_component.rb +1 -3
- data/app/components/tramway/containers/narrow_component.rb +5 -4
- data/app/components/tramway/form/builder.rb +1 -2
- data/app/components/tramway/grid/card_component.html.haml +2 -0
- data/app/components/tramway/grid/card_component.rb +37 -0
- data/app/components/tramway/grid_component.html.haml +18 -0
- data/app/components/tramway/grid_component.rb +76 -0
- data/app/components/tramway/native_text_component.rb +1 -2
- data/app/components/tramway/nav/item_component.rb +4 -2
- data/app/components/tramway/navbar_component.html.haml +131 -102
- data/app/components/tramway/navbar_component.rb +84 -2
- data/app/components/tramway/table/cell_component.rb +9 -1
- data/app/components/tramway/table/header_component.rb +23 -2
- data/app/components/tramway/table/row_component.rb +27 -10
- data/app/components/tramway/table_component.rb +28 -1
- data/app/controllers/tramway/entities_controller.rb +13 -6
- data/app/views/tramway/entities/_list.html.haml +2 -1
- data/app/views/tramway/layouts/application.html.haml +8 -6
- data/config/routes.rb +1 -2
- data/config/tailwind.config.js +57 -0
- data/lib/generators/tramway/install/font_awesome_helpers.rb +39 -0
- data/lib/generators/tramway/install/install_generator.rb +133 -66
- data/lib/generators/tramway/install/layout_helpers.rb +95 -0
- data/lib/tramway/configs/entities/page.rb +1 -0
- data/lib/tramway/engine.rb +12 -0
- data/lib/tramway/errors.rb +45 -0
- data/lib/tramway/forms/validations.rb +1 -2
- data/lib/tramway/helpers/navbar_helper.rb +3 -1
- data/lib/tramway/helpers/table_helper.rb +27 -0
- data/lib/tramway/helpers/views_helper.rb +26 -2
- data/lib/tramway/pg_searchable.rb +62 -0
- data/lib/tramway/searchable.rb +8 -26
- data/lib/tramway/version.rb +1 -1
- metadata +44 -4
data/lib/tramway/searchable.rb
CHANGED
|
@@ -1,43 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'tramway/pg_searchable'
|
|
4
|
+
|
|
3
5
|
module Tramway
|
|
4
|
-
# Searchable module provides a class method `tramway_search` for ActiveRecord models to
|
|
5
|
-
# across all string and text columns using
|
|
6
|
+
# Searchable module provides a class method `tramway_search` for ActiveRecord models to
|
|
7
|
+
# perform a generic search across all string and text columns, using the `pg_search` gem.
|
|
8
|
+
# It is the fallback Tramway::EntitiesController uses when a model does not define its
|
|
9
|
+
# own `.search` scope. See Tramway::PgSearchable for the PostgreSQL requirement.
|
|
6
10
|
module Searchable
|
|
7
11
|
extend ActiveSupport::Concern
|
|
8
12
|
|
|
9
13
|
class_methods do
|
|
10
14
|
def tramway_search(query)
|
|
11
|
-
|
|
12
|
-
columns_to_search = searchable_column_names
|
|
13
|
-
|
|
14
|
-
return all if tokens.empty? || columns_to_search.empty?
|
|
15
|
-
|
|
16
|
-
where(
|
|
17
|
-
Arel.sql("to_tsvector('simple', #{tsvector_expression(columns_to_search)}) @@ to_tsquery('simple', ?)"),
|
|
18
|
-
tsquery_expression(tokens)
|
|
19
|
-
)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
private
|
|
15
|
+
return all if query.blank?
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
query.to_s.scan(/[[:alnum:]]+/)
|
|
17
|
+
Tramway::PgSearchable.call(self, query)
|
|
26
18
|
end
|
|
27
19
|
|
|
28
20
|
def searchable_column_names
|
|
29
21
|
columns.select { |column| column.type.in?(%i[string text]) }.map(&:name)
|
|
30
22
|
end
|
|
31
|
-
|
|
32
|
-
def tsvector_expression(column_names)
|
|
33
|
-
column_names.map do |column_name|
|
|
34
|
-
"coalesce(#{connection.quote_column_name(column_name)}, '')"
|
|
35
|
-
end.join(" || ' ' || ")
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def tsquery_expression(tokens)
|
|
39
|
-
tokens.map { |token| "#{token}:*" }.join(' & ')
|
|
40
|
-
end
|
|
41
23
|
end
|
|
42
24
|
end
|
|
43
25
|
end
|
data/lib/tramway/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tramway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kalashnikovisme
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: font-awesome-rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: haml-rails
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,13 +94,27 @@ dependencies:
|
|
|
80
94
|
- - ">="
|
|
81
95
|
- !ruby/object:Gem::Version
|
|
82
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: pg_search
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
83
111
|
- !ruby/object:Gem::Dependency
|
|
84
112
|
name: rails
|
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
|
86
114
|
requirements:
|
|
87
115
|
- - ">="
|
|
88
116
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
117
|
+
version: '8'
|
|
90
118
|
- - "<"
|
|
91
119
|
- !ruby/object:Gem::Version
|
|
92
120
|
version: '9'
|
|
@@ -96,7 +124,7 @@ dependencies:
|
|
|
96
124
|
requirements:
|
|
97
125
|
- - ">="
|
|
98
126
|
- !ruby/object:Gem::Version
|
|
99
|
-
version: '
|
|
127
|
+
version: '8'
|
|
100
128
|
- - "<"
|
|
101
129
|
- !ruby/object:Gem::Version
|
|
102
130
|
version: '9'
|
|
@@ -138,7 +166,10 @@ files:
|
|
|
138
166
|
- MIT-LICENSE
|
|
139
167
|
- README.md
|
|
140
168
|
- Rakefile
|
|
169
|
+
- app/assets/builds/tailwind.css
|
|
141
170
|
- app/assets/javascripts/tramway/tramway.js
|
|
171
|
+
- app/assets/stylesheets/font-awesome.css
|
|
172
|
+
- app/assets/tailwind/application.css
|
|
142
173
|
- app/components/tailwind_component.html.haml
|
|
143
174
|
- app/components/tailwind_component.rb
|
|
144
175
|
- app/components/tramway/actions_buttons_container_component.html.haml
|
|
@@ -207,6 +238,10 @@ files:
|
|
|
207
238
|
- app/components/tramway/form/tramway_select/selected_item_template_component.rb
|
|
208
239
|
- app/components/tramway/form/tramway_select_component.html.haml
|
|
209
240
|
- app/components/tramway/form/tramway_select_component.rb
|
|
241
|
+
- app/components/tramway/grid/card_component.html.haml
|
|
242
|
+
- app/components/tramway/grid/card_component.rb
|
|
243
|
+
- app/components/tramway/grid_component.html.haml
|
|
244
|
+
- app/components/tramway/grid_component.rb
|
|
210
245
|
- app/components/tramway/native_text_component.html.haml
|
|
211
246
|
- app/components/tramway/native_text_component.rb
|
|
212
247
|
- app/components/tramway/nav/item/button_component.html.haml
|
|
@@ -266,7 +301,9 @@ files:
|
|
|
266
301
|
- config/routes.rb
|
|
267
302
|
- config/tailwind.config.js
|
|
268
303
|
- docs/AGENTS.md
|
|
304
|
+
- lib/generators/tramway/install/font_awesome_helpers.rb
|
|
269
305
|
- lib/generators/tramway/install/install_generator.rb
|
|
306
|
+
- lib/generators/tramway/install/layout_helpers.rb
|
|
270
307
|
- lib/kaminari/helpers/tag.rb
|
|
271
308
|
- lib/rules/turbo_html_attributes_rules.rb
|
|
272
309
|
- lib/tasks/tramway_tasks.rake
|
|
@@ -286,6 +323,7 @@ files:
|
|
|
286
323
|
- lib/tramway/duck_typing.rb
|
|
287
324
|
- lib/tramway/duck_typing/active_record_compatibility.rb
|
|
288
325
|
- lib/tramway/engine.rb
|
|
326
|
+
- lib/tramway/errors.rb
|
|
289
327
|
- lib/tramway/forms/class_helper.rb
|
|
290
328
|
- lib/tramway/forms/fields.rb
|
|
291
329
|
- lib/tramway/forms/normalizations.rb
|
|
@@ -296,8 +334,10 @@ files:
|
|
|
296
334
|
- lib/tramway/helpers/form_helper.rb
|
|
297
335
|
- lib/tramway/helpers/navbar_helper.rb
|
|
298
336
|
- lib/tramway/helpers/routes_helper.rb
|
|
337
|
+
- lib/tramway/helpers/table_helper.rb
|
|
299
338
|
- lib/tramway/helpers/views_helper.rb
|
|
300
339
|
- lib/tramway/navbar.rb
|
|
340
|
+
- lib/tramway/pg_searchable.rb
|
|
301
341
|
- lib/tramway/searchable.rb
|
|
302
342
|
- lib/tramway/utils/field.rb
|
|
303
343
|
- lib/tramway/utils/render.rb
|
|
@@ -326,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
326
366
|
- !ruby/object:Gem::Version
|
|
327
367
|
version: '0'
|
|
328
368
|
requirements: []
|
|
329
|
-
rubygems_version: 4.0.
|
|
369
|
+
rubygems_version: 4.0.20
|
|
330
370
|
specification_version: 4
|
|
331
371
|
summary: Tramway Rails Engine
|
|
332
372
|
test_files: []
|