active_element 0.0.28 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/app/views/layouts/active_element.html.erb +1 -2
- data/lib/active_element/components/util/record_path.rb +11 -3
- data/lib/active_element/default_controller/search.rb +8 -0
- data/lib/active_element/field_options.rb +6 -1
- data/lib/active_element/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: 1469f981b1ca1a72146c9e6a241d79ba89151468deb8cc23a6f684eeb491b0a1
|
4
|
+
data.tar.gz: acdbd91537ee25169fb7639f083661b70fa04d536ebf96cf24c4bb50bbcac087
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6d03d68afd27853fa96de0ae0fabd0cbb3dbad46d329eacdfc45c523c770fe9d85649191f5d2215f6b4a494fa14169b2986ac39ca8f25f07547ed5a62599e5
|
7
|
+
data.tar.gz: 79751155402da2ab9f72710db51517d214cf55b15e4240c444d3489d33f703e944123e1fa9146d5c2a8c47c8426bb42269801dba30c230c7f1f231ed248cba9a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_element (0.0.
|
4
|
+
active_element (0.0.30)
|
5
5
|
bootstrap (~> 5.3.0alpha3)
|
6
6
|
kaminari (~> 1.2)
|
7
7
|
paintbrush (~> 0.1.2)
|
@@ -150,7 +150,7 @@ GEM
|
|
150
150
|
mini_mime (1.1.5)
|
151
151
|
mini_portile2 (2.8.2)
|
152
152
|
minitest (5.18.1)
|
153
|
-
net-imap (0.4.
|
153
|
+
net-imap (0.4.17)
|
154
154
|
date
|
155
155
|
net-protocol
|
156
156
|
net-pop (0.1.2)
|
@@ -76,7 +76,7 @@
|
|
76
76
|
<meta name="active_element_controller_path" content="<%= controller_path %>">
|
77
77
|
|
78
78
|
<%= stylesheet_link_tag 'active_element/active_element' %>
|
79
|
-
<%= javascript_include_tag 'active_element/active_element' %>
|
79
|
+
<%= javascript_include_tag 'active_element/active_element', 'data-turbo-track': 'reload', 'data-turbolinks-track': 'reload' %>
|
80
80
|
|
81
81
|
<% if Rails.application.assets&.find_asset('application.css').present? %>
|
82
82
|
<%= stylesheet_link_tag 'application' %>
|
@@ -122,7 +122,6 @@
|
|
122
122
|
<%= render_active_element_hook 'active_element/after_content' %>
|
123
123
|
|
124
124
|
<% if !respond_to?(:javascript_importmap_tags) && Rails.application.assets&.find_asset('application.js').present? %>
|
125
|
-
<%= javascript_include_tag 'active_element/active_element', 'data-turbo-track': 'reload', 'data-turbolinks-track': 'reload' %>
|
126
125
|
<%= javascript_include_tag 'application', 'data-turbo-track': 'reload', 'data-turbolinks-track': 'reload' %>
|
127
126
|
<% end %>
|
128
127
|
</body>
|
@@ -65,7 +65,7 @@ module ActiveElement
|
|
65
65
|
attr_reader :record, :controller, :type
|
66
66
|
|
67
67
|
def record_path(**kwargs) # rubocop:disable Metrics/AbcSize
|
68
|
-
return nil if record.nil?
|
68
|
+
return nil if record.nil? || default_record_path.nil?
|
69
69
|
|
70
70
|
controller.helpers.public_send(default_record_path, *path_arguments, **kwargs)
|
71
71
|
rescue NoMethodError
|
@@ -90,8 +90,16 @@ module ActiveElement
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def default_record_path
|
93
|
-
|
94
|
-
|
93
|
+
if record.try(:active_element_controller_name).present?
|
94
|
+
record.active_element_controller_name
|
95
|
+
.constantize.controller_path
|
96
|
+
.underscore
|
97
|
+
.singularize.tr('/', '_') + '_path'
|
98
|
+
else
|
99
|
+
"#{record_path_prefix}#{namespace_prefix}#{record_name}_path"
|
100
|
+
end
|
101
|
+
rescue NameError
|
102
|
+
nil
|
95
103
|
end
|
96
104
|
|
97
105
|
def record_path_for(name)
|
@@ -53,6 +53,14 @@ module ActiveElement
|
|
53
53
|
attr_reader :controller, :model
|
54
54
|
|
55
55
|
def string_like_column?(key)
|
56
|
+
exact = controller.active_element.state.field_options&.find do |field, options_proc|
|
57
|
+
field_options = FieldOptions.new(key)
|
58
|
+
options_proc.call(field_options, nil, controller)
|
59
|
+
field_options.exact_match
|
60
|
+
end
|
61
|
+
|
62
|
+
return false if exact
|
63
|
+
|
56
64
|
[:string, :text].include?(
|
57
65
|
model.columns.find { |column| column.name.to_s == key.to_s }&.type&.to_sym
|
58
66
|
)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ActiveElement
|
2
2
|
class FieldOptions
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :options, :value, :exact_match
|
4
|
+
attr_writer :type
|
4
5
|
attr_reader :field
|
5
6
|
|
6
7
|
def self.from_state(field, state, record, controller)
|
@@ -16,5 +17,9 @@ module ActiveElement
|
|
16
17
|
@field = field
|
17
18
|
@options = {}
|
18
19
|
end
|
20
|
+
|
21
|
+
def type
|
22
|
+
@type || :text_field
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_element
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap
|