vario 1.0.7 → 2.0.0
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 +68 -1
- data/Rakefile +0 -4
- data/app/assets/stylesheets/vario/application.css +316 -0
- data/app/assets/tailwind/vario/engine.css +6 -0
- data/app/controllers/vario/application_controller.rb +9 -2
- data/app/controllers/vario/topics_controller.rb +131 -0
- data/app/controllers/vario/values_controller.rb +27 -0
- data/app/javascript/vario/application.js +18 -0
- data/app/javascript/vario/controllers/refinements_controller.js +29 -0
- data/app/javascript/vario/controllers/search_controller.js +63 -0
- data/app/javascript/vario/controllers/sortable_controller.js +61 -0
- data/app/javascript/vario/controllers/tabs_controller.js +19 -0
- data/app/javascript/vario/controllers/topic_controller.js +40 -0
- data/app/models/vario/conditions.rb +158 -0
- data/app/models/vario/refinement.rb +38 -0
- data/app/models/vario/setting.rb +64 -3
- data/app/policies/vario/topic_policy.rb +37 -0
- data/app/views/vario/shared/_card.html.erb +25 -0
- data/app/views/vario/topics/_applies.html.erb +49 -0
- data/app/views/vario/topics/_nav.html.erb +28 -0
- data/app/views/vario/topics/_refinements.html.erb +41 -0
- data/app/views/vario/topics/_setting.html.erb +9 -0
- data/app/views/vario/topics/index.html.erb +3 -0
- data/app/views/vario/topics/show.html.erb +31 -0
- data/app/views/vario/values/_form.html.erb +20 -0
- data/config/importmap.rb +4 -0
- data/config/locales/en.yml +50 -0
- data/config/locales/nl.yml +50 -0
- data/config/routes.rb +11 -6
- data/db/migrate/20261118190000_add_value_to_vario_settings.rb +8 -0
- data/db/migrate/20261118190100_create_vario_refinements.rb +19 -0
- data/lib/generators/vario/topics_from_config/topics_from_config_generator.rb +189 -0
- data/lib/tasks/vario_tasks.rake +30 -0
- data/lib/vario/action_view_helpers.rb +119 -16
- data/lib/vario/active_record_helpers.rb +3 -2
- data/lib/vario/api.rb +49 -60
- data/lib/vario/backup.rb +50 -0
- data/lib/vario/card.rb +27 -0
- data/lib/vario/config.rb +36 -11
- data/lib/vario/context_variables.rb +69 -0
- data/lib/vario/converter.rb +113 -0
- data/lib/vario/engine.rb +27 -0
- data/lib/vario/migrator.rb +83 -0
- data/lib/vario/resolver.rb +71 -0
- data/lib/vario/settable.rb +41 -23
- data/lib/vario/settable_topic.rb +37 -0
- data/lib/vario/settings_reader.rb +45 -15
- data/lib/vario/topic.rb +299 -0
- data/lib/vario/topic_reader.rb +42 -0
- data/lib/vario/types.rb +64 -0
- data/lib/vario/version.rb +1 -1
- data/lib/vario.rb +16 -0
- metadata +116 -34
- data/app/controllers/vario/levels_controller.rb +0 -82
- data/app/controllers/vario/settings_controller.rb +0 -35
- data/app/views/vario/levels/_form.html.slim +0 -53
- data/app/views/vario/levels/create.js.erb +0 -4
- data/app/views/vario/levels/destroy.js.erb +0 -4
- data/app/views/vario/levels/update.js.erb +0 -4
- data/app/views/vario/settings/_levels.html.slim +0 -22
- data/app/views/vario/settings/_new_level.html.slim +0 -7
- data/app/views/vario/settings/_settings.html.slim +0 -24
- data/app/views/vario/settings/index.html.slim +0 -28
- data/app/views/vario/settings/levels.html.slim +0 -1
- data/app/views/vario/settings/show.html.slim +0 -13
data/lib/vario.rb
CHANGED
|
@@ -2,6 +2,16 @@ require_relative 'vario/engine'
|
|
|
2
2
|
require_relative 'vario/config'
|
|
3
3
|
require_relative 'vario/settable'
|
|
4
4
|
require_relative 'vario/settings_reader'
|
|
5
|
+
require_relative 'vario/card'
|
|
6
|
+
require_relative 'vario/types'
|
|
7
|
+
require_relative 'vario/topic'
|
|
8
|
+
require_relative 'vario/settable_topic'
|
|
9
|
+
require_relative 'vario/resolver'
|
|
10
|
+
require_relative 'vario/converter'
|
|
11
|
+
require_relative 'vario/migrator'
|
|
12
|
+
require_relative 'vario/backup'
|
|
13
|
+
require_relative 'vario/topic_reader'
|
|
14
|
+
require_relative 'vario/context_variables'
|
|
5
15
|
require_relative 'vario/action_view_helpers'
|
|
6
16
|
require_relative 'vario/active_record_helpers'
|
|
7
17
|
require_relative 'vario/api'
|
|
@@ -17,6 +27,12 @@ module Vario
|
|
|
17
27
|
@config = Vario::Config.new
|
|
18
28
|
yield config
|
|
19
29
|
end
|
|
30
|
+
|
|
31
|
+
# Signs what a page of the host's gives the settings it renders
|
|
32
|
+
# (render_vario_settings)
|
|
33
|
+
def verifier
|
|
34
|
+
Rails.application.message_verifier('vario/values')
|
|
35
|
+
end
|
|
20
36
|
end
|
|
21
37
|
|
|
22
38
|
# Include helpers
|
metadata
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vario
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andre Meij
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: entdec-view_components
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.2'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: form_components
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 0.1.9
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 0.1.9
|
|
13
40
|
- !ruby/object:Gem::Dependency
|
|
14
41
|
name: grape
|
|
15
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,61 +66,95 @@ dependencies:
|
|
|
39
66
|
- !ruby/object:Gem::Version
|
|
40
67
|
version: '0.33'
|
|
41
68
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rails
|
|
69
|
+
name: importmap-rails
|
|
43
70
|
requirement: !ruby/object:Gem::Requirement
|
|
44
71
|
requirements:
|
|
45
72
|
- - ">="
|
|
46
73
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
74
|
+
version: '2'
|
|
48
75
|
type: :runtime
|
|
49
76
|
prerelease: false
|
|
50
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
78
|
requirements:
|
|
52
79
|
- - ">="
|
|
53
80
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
81
|
+
version: '2'
|
|
55
82
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
83
|
+
name: liquid
|
|
57
84
|
requirement: !ruby/object:Gem::Requirement
|
|
58
85
|
requirements:
|
|
59
|
-
- - "
|
|
86
|
+
- - ">="
|
|
60
87
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
88
|
+
version: '5.5'
|
|
89
|
+
- - "<"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '6'
|
|
62
92
|
type: :runtime
|
|
63
93
|
prerelease: false
|
|
64
94
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
95
|
requirements:
|
|
66
|
-
- - "
|
|
96
|
+
- - ">="
|
|
67
97
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
98
|
+
version: '5.5'
|
|
99
|
+
- - "<"
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '6'
|
|
69
102
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
103
|
+
name: liquidum
|
|
71
104
|
requirement: !ruby/object:Gem::Requirement
|
|
72
105
|
requirements:
|
|
73
106
|
- - ">="
|
|
74
107
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
108
|
+
version: '1.3'
|
|
76
109
|
type: :runtime
|
|
77
110
|
prerelease: false
|
|
78
111
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
112
|
requirements:
|
|
80
113
|
- - ">="
|
|
81
114
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
115
|
+
version: '1.3'
|
|
83
116
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
117
|
+
name: positioning
|
|
85
118
|
requirement: !ruby/object:Gem::Requirement
|
|
86
119
|
requirements:
|
|
87
120
|
- - "~>"
|
|
88
121
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
90
|
-
type: :
|
|
122
|
+
version: '0.4'
|
|
123
|
+
type: :runtime
|
|
91
124
|
prerelease: false
|
|
92
125
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
126
|
requirements:
|
|
94
127
|
- - "~>"
|
|
95
128
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
129
|
+
version: '0.4'
|
|
130
|
+
- !ruby/object:Gem::Dependency
|
|
131
|
+
name: pundit
|
|
132
|
+
requirement: !ruby/object:Gem::Requirement
|
|
133
|
+
requirements:
|
|
134
|
+
- - ">="
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: '2.3'
|
|
137
|
+
type: :runtime
|
|
138
|
+
prerelease: false
|
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - ">="
|
|
142
|
+
- !ruby/object:Gem::Version
|
|
143
|
+
version: '2.3'
|
|
144
|
+
- !ruby/object:Gem::Dependency
|
|
145
|
+
name: rails
|
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
|
147
|
+
requirements:
|
|
148
|
+
- - ">="
|
|
149
|
+
- !ruby/object:Gem::Version
|
|
150
|
+
version: '7.1'
|
|
151
|
+
type: :runtime
|
|
152
|
+
prerelease: false
|
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
154
|
+
requirements:
|
|
155
|
+
- - ">="
|
|
156
|
+
- !ruby/object:Gem::Version
|
|
157
|
+
version: '7.1'
|
|
97
158
|
- !ruby/object:Gem::Dependency
|
|
98
159
|
name: pg
|
|
99
160
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,7 +183,6 @@ dependencies:
|
|
|
122
183
|
- - ">="
|
|
123
184
|
- !ruby/object:Gem::Version
|
|
124
185
|
version: '0'
|
|
125
|
-
description:
|
|
126
186
|
email:
|
|
127
187
|
- andre@itsmeij.com
|
|
128
188
|
executables: []
|
|
@@ -132,26 +192,36 @@ files:
|
|
|
132
192
|
- MIT-LICENSE
|
|
133
193
|
- README.md
|
|
134
194
|
- Rakefile
|
|
195
|
+
- app/assets/stylesheets/vario/application.css
|
|
196
|
+
- app/assets/tailwind/vario/engine.css
|
|
135
197
|
- app/controllers/vario/application_controller.rb
|
|
136
|
-
- app/controllers/vario/
|
|
137
|
-
- app/controllers/vario/
|
|
198
|
+
- app/controllers/vario/topics_controller.rb
|
|
199
|
+
- app/controllers/vario/values_controller.rb
|
|
138
200
|
- app/helpers/vario/application_helper.rb
|
|
201
|
+
- app/javascript/vario/application.js
|
|
202
|
+
- app/javascript/vario/controllers/refinements_controller.js
|
|
203
|
+
- app/javascript/vario/controllers/search_controller.js
|
|
204
|
+
- app/javascript/vario/controllers/sortable_controller.js
|
|
205
|
+
- app/javascript/vario/controllers/tabs_controller.js
|
|
206
|
+
- app/javascript/vario/controllers/topic_controller.js
|
|
139
207
|
- app/jobs/vario/application_job.rb
|
|
140
208
|
- app/mailers/vario/application_mailer.rb
|
|
141
209
|
- app/models/vario/application_record.rb
|
|
142
210
|
- app/models/vario/condition.rb
|
|
211
|
+
- app/models/vario/conditions.rb
|
|
143
212
|
- app/models/vario/level.rb
|
|
213
|
+
- app/models/vario/refinement.rb
|
|
144
214
|
- app/models/vario/setting.rb
|
|
145
|
-
- app/
|
|
146
|
-
- app/views/vario/
|
|
147
|
-
- app/views/vario/
|
|
148
|
-
- app/views/vario/
|
|
149
|
-
- app/views/vario/
|
|
150
|
-
- app/views/vario/
|
|
151
|
-
- app/views/vario/
|
|
152
|
-
- app/views/vario/
|
|
153
|
-
- app/views/vario/
|
|
154
|
-
-
|
|
215
|
+
- app/policies/vario/topic_policy.rb
|
|
216
|
+
- app/views/vario/shared/_card.html.erb
|
|
217
|
+
- app/views/vario/topics/_applies.html.erb
|
|
218
|
+
- app/views/vario/topics/_nav.html.erb
|
|
219
|
+
- app/views/vario/topics/_refinements.html.erb
|
|
220
|
+
- app/views/vario/topics/_setting.html.erb
|
|
221
|
+
- app/views/vario/topics/index.html.erb
|
|
222
|
+
- app/views/vario/topics/show.html.erb
|
|
223
|
+
- app/views/vario/values/_form.html.erb
|
|
224
|
+
- config/importmap.rb
|
|
155
225
|
- config/locales/en.yml
|
|
156
226
|
- config/locales/nl.yml
|
|
157
227
|
- config/routes.rb
|
|
@@ -159,20 +229,33 @@ files:
|
|
|
159
229
|
- db/migrate/20180706130136_remove_fields_from_settings.rb
|
|
160
230
|
- db/migrate/20180706155055_add_keys_to_setting.rb
|
|
161
231
|
- db/migrate/20211027040546_unique_levels.rb
|
|
232
|
+
- db/migrate/20261118190000_add_value_to_vario_settings.rb
|
|
233
|
+
- db/migrate/20261118190100_create_vario_refinements.rb
|
|
234
|
+
- lib/generators/vario/topics_from_config/topics_from_config_generator.rb
|
|
235
|
+
- lib/tasks/vario_tasks.rake
|
|
162
236
|
- lib/vario.rb
|
|
163
237
|
- lib/vario/action_view_helpers.rb
|
|
164
238
|
- lib/vario/active_record_helpers.rb
|
|
165
239
|
- lib/vario/api.rb
|
|
240
|
+
- lib/vario/backup.rb
|
|
241
|
+
- lib/vario/card.rb
|
|
166
242
|
- lib/vario/config.rb
|
|
243
|
+
- lib/vario/context_variables.rb
|
|
244
|
+
- lib/vario/converter.rb
|
|
167
245
|
- lib/vario/engine.rb
|
|
246
|
+
- lib/vario/migrator.rb
|
|
247
|
+
- lib/vario/resolver.rb
|
|
168
248
|
- lib/vario/settable.rb
|
|
249
|
+
- lib/vario/settable_topic.rb
|
|
169
250
|
- lib/vario/settings_reader.rb
|
|
251
|
+
- lib/vario/topic.rb
|
|
252
|
+
- lib/vario/topic_reader.rb
|
|
253
|
+
- lib/vario/types.rb
|
|
170
254
|
- lib/vario/version.rb
|
|
171
255
|
homepage: https://github.com/entdec/vario
|
|
172
256
|
licenses:
|
|
173
257
|
- MIT
|
|
174
258
|
metadata: {}
|
|
175
|
-
post_install_message:
|
|
176
259
|
rdoc_options: []
|
|
177
260
|
require_paths:
|
|
178
261
|
- lib
|
|
@@ -187,8 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
187
270
|
- !ruby/object:Gem::Version
|
|
188
271
|
version: '0'
|
|
189
272
|
requirements: []
|
|
190
|
-
rubygems_version: 3.
|
|
191
|
-
signing_key:
|
|
273
|
+
rubygems_version: 3.6.9
|
|
192
274
|
specification_version: 4
|
|
193
275
|
summary: Vario adds custom runtime configuration to your Rails app.
|
|
194
276
|
test_files: []
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
require_dependency 'vario/application_controller'
|
|
2
|
-
|
|
3
|
-
module Vario
|
|
4
|
-
class LevelsController < ApplicationController
|
|
5
|
-
self.responder = Auxilium::Responder
|
|
6
|
-
respond_to :html, :js
|
|
7
|
-
|
|
8
|
-
before_action :set_objects
|
|
9
|
-
|
|
10
|
-
def create
|
|
11
|
-
@level = Level.new(@setting, level_params)
|
|
12
|
-
@setting.levels.unshift @level
|
|
13
|
-
@level.conditions = normalize_booleans(level_params[:conditions].to_h)
|
|
14
|
-
@level.conditions = normalize_booleans(level_params[:conditions].to_h)
|
|
15
|
-
@setting.save
|
|
16
|
-
if request.referer.present? && URI.parse(request.referer).path != setting_path(@setting)
|
|
17
|
-
redirect_to request.referer
|
|
18
|
-
else
|
|
19
|
-
respond_with @setting, collection_location: -> { setting_path(@setting) }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def update
|
|
24
|
-
if params[:commit] == 'delete'
|
|
25
|
-
self.action_name = 'destroy'
|
|
26
|
-
return destroy
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
@level = @setting.levels.find { |level| level.id == params[:id] }
|
|
30
|
-
@level.value = level_params[:value]
|
|
31
|
-
@level.conditions = normalize_booleans(level_params[:conditions].to_h)
|
|
32
|
-
@setting.save
|
|
33
|
-
if request.referer.present? && URI.parse(request.referer).path != setting_path(@setting)
|
|
34
|
-
redirect_to request.referer
|
|
35
|
-
else
|
|
36
|
-
respond_with @setting, collection_location: -> { setting_path(@setting) }
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def destroy
|
|
41
|
-
@setting.levels.reject! { |level| level.id == params[:id] }
|
|
42
|
-
@setting.save
|
|
43
|
-
if request.referer.present? && URI.parse(request.referer).path != setting_path(@setting)
|
|
44
|
-
redirect_to request.referer
|
|
45
|
-
else
|
|
46
|
-
respond_with @setting, collection_location: -> { setting_path(@setting) }
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def move
|
|
51
|
-
oldIndex = @setting.levels.find_index { |level| level.id == params[:id] }
|
|
52
|
-
newIndex = params[:index]
|
|
53
|
-
@level = @setting.levels[oldIndex]
|
|
54
|
-
@level.move(oldIndex - newIndex)
|
|
55
|
-
|
|
56
|
-
render json: { old: oldIndex, new: newIndex }
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
private
|
|
60
|
-
|
|
61
|
-
def set_objects
|
|
62
|
-
@context = params.dig(:level, :context) || {}
|
|
63
|
-
@setting = Setting.find(params[:setting_id])
|
|
64
|
-
if respond_to? :add_breadcrumb
|
|
65
|
-
add_breadcrumb I18n.t('breadcrumbs.vario.settings.index'), breadcrumb_settings_path(@setting)
|
|
66
|
-
add_breadcrumb @setting.name, setting_path(@setting)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def level_params
|
|
71
|
-
params.require(:level).permit(:value, value: [], conditions: {}, context: {})
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def normalize_booleans(conditions)
|
|
75
|
-
boolean_keys = Vario.config.keys.select {|k,v|v[:type] == :boolean}.keys
|
|
76
|
-
boolean_keys.each do |k|
|
|
77
|
-
conditions[k.to_sym] = conditions[k] == "1" ? true : false
|
|
78
|
-
end
|
|
79
|
-
conditions
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require_dependency 'vario/application_controller'
|
|
2
|
-
|
|
3
|
-
module Vario
|
|
4
|
-
class SettingsController < ApplicationController
|
|
5
|
-
def index
|
|
6
|
-
if respond_to?(:add_breadcrumb)
|
|
7
|
-
add_breadcrumb I18n.t('breadcrumbs.vario.settings.index'), settings_path(settable: params[:settable])
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
@settable = GlobalID::Locator.locate_signed(params[:settable], for: 'Vario')
|
|
11
|
-
@title = 'Settings'
|
|
12
|
-
@title = "#{@title} for #{@settable.class.name} #{@settable.name}" if @settable.respond_to?(:name)
|
|
13
|
-
Vario.config.pre_create_settings(@settable)
|
|
14
|
-
|
|
15
|
-
@settings = Setting.where(settable: @settable).order(:name).includes(:settable)
|
|
16
|
-
@groups = @settings.map(&:name).select { |setting| setting =~ /\./ }.map { |setting| setting.split('.').first }
|
|
17
|
-
@groups = @groups.find_all { |g| Vario.config.show_group?(g) }
|
|
18
|
-
@groups = @groups.each_with_object(Hash.new(0)) { |v, h| h[v] += 1; }.map { |k, v| { name: k, settings: v } }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def show
|
|
22
|
-
@setting = Setting.find(params[:id])
|
|
23
|
-
|
|
24
|
-
if respond_to?(:add_breadcrumb)
|
|
25
|
-
add_breadcrumb I18n.t('breadcrumbs.vario.settings.index'), breadcrumb_settings_path(@setting)
|
|
26
|
-
add_breadcrumb @setting.name, setting_path(@setting)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def levels
|
|
31
|
-
@setting = Setting.find(params[:id])
|
|
32
|
-
render :levels, layout: false
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
- label = nil if label.blank?
|
|
2
|
-
- context = {} if context.blank?
|
|
3
|
-
- draggable = true if draggable.nil?
|
|
4
|
-
|
|
5
|
-
= sts.form_for([setting, level], id: level.id, url: polymorphic_path([vario, setting, level]), remote: true, title: label, footer: false, header: label.present?, padding: label.present?) do |f|
|
|
6
|
-
- context.each do |key, value|
|
|
7
|
-
= f.fields_for :context do |ff|
|
|
8
|
-
= ff.input key, as: :hidden, input_html: { value: value }
|
|
9
|
-
- level.conditions_for(context).each do |condition|
|
|
10
|
-
= f.fields_for :conditions do |ff|
|
|
11
|
-
= ff.input condition.key, as: :hidden, input_html: { value: context[condition.key.to_sym] }
|
|
12
|
-
.grid.grid-cols-12.gap-4
|
|
13
|
-
.col-span-1
|
|
14
|
-
- if draggable
|
|
15
|
-
button.draggable
|
|
16
|
-
i class="fal fa-grip-lines" style="margin-top: 8px; margin-left: 16px;"
|
|
17
|
-
.col-span-6
|
|
18
|
-
.grid.grid-cols-12.gap-4
|
|
19
|
-
- level.conditions_not_for(context).each do |condition|
|
|
20
|
-
div class="col-span-#{[12 / level.conditions_not_for(context).size, 3].max}"
|
|
21
|
-
= f.fields_for :conditions do |ff|
|
|
22
|
-
- case condition.key_data[:type]
|
|
23
|
-
- when :select
|
|
24
|
-
= ff.input condition.key, as: :dropdown, label: condition.key, collection: condition.collection, include_blank: true, required: false, input_html: { id: "#{condition.key}_#{level.id}", value: condition.value }
|
|
25
|
-
- when :boolean
|
|
26
|
-
= ff.input condition.key, as: :switch, label: condition.key, value: condition.value, required: false
|
|
27
|
-
- else
|
|
28
|
-
= ff.input condition.key, label: condition.key, required: false, input_html: { value: context[condition.key.to_sym] }
|
|
29
|
-
|
|
30
|
-
.col-span-2
|
|
31
|
-
- case setting.type
|
|
32
|
-
- when :array
|
|
33
|
-
- if setting.collection.present?
|
|
34
|
-
= f.input :value, as: :select, input_html: { multiple: true, id: "value_#{level.id}" }, collection: [["All", 'all']] + setting.collection, required: false
|
|
35
|
-
- else
|
|
36
|
-
= f.input :value, as: :text, input_html: { rows: 10, style: 'height: auto' }, hint: 'Multiple values possible, separate with "," or new lines.'
|
|
37
|
-
- when :integer
|
|
38
|
-
= f.input :value, as: :number
|
|
39
|
-
- when :boolean
|
|
40
|
-
= f.input :value, as: :switch
|
|
41
|
-
- when :text
|
|
42
|
-
= f.input :value, as: :editor, mode: 'text/plain'
|
|
43
|
-
- when :hash
|
|
44
|
-
= f.input :value, as: :editor, mode: 'application/yaml'
|
|
45
|
-
- else
|
|
46
|
-
- if setting.collection.present?
|
|
47
|
-
= f.input :value, as: :dropdown, collection: setting.collection, required: false
|
|
48
|
-
- else
|
|
49
|
-
= f.input :value
|
|
50
|
-
.col-span-1.p-3
|
|
51
|
-
= f.button t('.save'), value: 'save'
|
|
52
|
-
.col-span-1.p-3
|
|
53
|
-
= f.button t('.delete'), value: 'delete' unless label.present?
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<% if @setting.saved_changes? %>
|
|
2
|
-
document.querySelector("[data-id='<%= @setting.id %>_levels']").innerHTML = "<%= escape_javascript(render(partial: 'vario/settings/levels', locals: { setting: @setting, context: @context })) %>"
|
|
3
|
-
document.querySelector("[data-id='<%= @setting.id %>_new_level']").innerHTML = "<%= escape_javascript(render(partial: 'vario/settings/new_level', locals: { setting: @setting, context: @context })) %>"
|
|
4
|
-
<% end %>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<% if @setting.saved_changes? %>
|
|
2
|
-
document.querySelector("[data-id='<%= @setting.id %>_levels']").innerHTML = "<%= escape_javascript(render(partial: 'vario/settings/levels', locals: { setting: @setting, context: @context })) %>"
|
|
3
|
-
document.querySelector("[data-id='<%= @setting.id %>_new_level']").innerHTML = "<%= escape_javascript(render(partial: 'vario/settings/new_level', locals: { setting: @setting, context: @context })) %>"
|
|
4
|
-
<% end %>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<% if @setting.saved_changes? %>
|
|
2
|
-
document.querySelector("[data-id='<%= @setting.id %>_levels']").innerHTML = "<%= escape_javascript(render(partial: 'vario/settings/levels', locals: { setting: @setting, context: @context })) %>"
|
|
3
|
-
document.querySelector("[data-id='<%= @setting.id %>_new_level']").innerHTML = "<%= escape_javascript(render(partial: 'vario/settings/new_level', locals: { setting: @setting, context: @context })) %>"
|
|
4
|
-
<% end %>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
- context = {} if context.blank?
|
|
2
|
-
|
|
3
|
-
div data-id="#{setting.id}_levels"
|
|
4
|
-
.grid.grid-cols-12.gap-4 data-controller='draggable' data-draggable-handle='.draggable'
|
|
5
|
-
- setting.levels.each do |level|
|
|
6
|
-
.col-span-12 data-draggable-url="#{vario.move_setting_level_path(setting_id: setting.id, id: level.id)}" class= "#{"hidden" unless level.with_context_values?(context)}"
|
|
7
|
-
= render partial: 'vario/levels/form', locals: { setting: setting, level: level, context: context }
|
|
8
|
-
|
|
9
|
-
- function_name = "reload_#{setting.id.gsub('-', '')}"
|
|
10
|
-
javascript:
|
|
11
|
-
function #{{function_name}}() {
|
|
12
|
-
document.querySelector("[data-id='#{setting.id}_levels']").addEventListener('draggable.success', function(e) {
|
|
13
|
-
fetch("#{vario.levels_setting_path(setting)}")
|
|
14
|
-
.then(response => response.text())
|
|
15
|
-
.then(function(html) {
|
|
16
|
-
e.detail.element.outerHTML = html
|
|
17
|
-
#{{function_name}}()
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#{{function_name}}()
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
- context = {} if context.blank?
|
|
2
|
-
- level = setting.new_level
|
|
3
|
-
|
|
4
|
-
div data-id="#{setting.id}_new_level"
|
|
5
|
-
.grid.grid-cols-12.gap-4
|
|
6
|
-
.col-span-12 class="#{"hidden" if level.conditions_not_for(context).size == 0 && setting.levels.find { |level| level.with_context_values?(context)}.present?}"
|
|
7
|
-
= render partial: 'vario/levels/form', locals: { setting: setting, level: level, label: 'New level', context: context, draggable: false }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
- ui_card_title = 'Settings' if ui_card_title.blank?
|
|
2
|
-
- context = {} if context.blank?
|
|
3
|
-
|
|
4
|
-
= sts.card :"vario_settings #{ui_card_title}", title: ui_card_title, icon: 'fad fa-slider' do |card|
|
|
5
|
-
- settings_with_contexts.sort_by { |setting| setting[:setting].name}.each do |setting|
|
|
6
|
-
- card.with_tab setting[:setting].name, title: setting[:setting].title, padding: true
|
|
7
|
-
.grid.grid-cols-12.gap-4
|
|
8
|
-
.col-span-12.prose
|
|
9
|
-
p= setting[:setting].description
|
|
10
|
-
.col-span-12
|
|
11
|
-
= render partial: 'vario/settings/levels', locals: setting
|
|
12
|
-
.col-span-12
|
|
13
|
-
= render partial: 'vario/settings/new_level', locals: setting
|
|
14
|
-
css:
|
|
15
|
-
.row.level {
|
|
16
|
-
min-height: 32px;
|
|
17
|
-
padding: 4px 0;
|
|
18
|
-
}
|
|
19
|
-
.row.level:nth-of-type(even) {
|
|
20
|
-
background-color: #f9f9f9;
|
|
21
|
-
}
|
|
22
|
-
.row.level:nth-of-type(odd) {
|
|
23
|
-
background-color: #f0f0f0;
|
|
24
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
= sts.card :"vario_settings #{@title}", title: @title, icon: 'fad fa-sliders' do |card|
|
|
2
|
-
.grid.grid-cols-12.gap-4
|
|
3
|
-
.col-span-4
|
|
4
|
-
|
|
5
|
-
- @groups.each do |group|
|
|
6
|
-
- card.with_tab group[:name], padding: true
|
|
7
|
-
table.table
|
|
8
|
-
thead
|
|
9
|
-
th Name
|
|
10
|
-
th Levels
|
|
11
|
-
tbody
|
|
12
|
-
- @settings.for_group(group[:name]).each do |setting|
|
|
13
|
-
tr
|
|
14
|
-
td= link_to(setting.setting_name.humanize, setting_path(setting))
|
|
15
|
-
td= setting.levels.count
|
|
16
|
-
|
|
17
|
-
- if @settings.without_group.present?
|
|
18
|
-
- card.with_tab :ungrouped, padding: true
|
|
19
|
-
table.table
|
|
20
|
-
thead
|
|
21
|
-
th Name
|
|
22
|
-
th Levels
|
|
23
|
-
tbody
|
|
24
|
-
- @settings.without_group.each do |setting|
|
|
25
|
-
tr
|
|
26
|
-
td= link_to(setting.setting_name.humanize, setting_path(setting))
|
|
27
|
-
td= setting.levels.count
|
|
28
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
= render partial: 'vario/settings/levels', locals: { setting: @setting }
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
= sts.card :"vario_settings #{@setting.title}", title: @setting.title, icon: 'fad fa-sliders' do |card|
|
|
2
|
-
|
|
3
|
-
- card.with_action
|
|
4
|
-
= link_to("Back", settings_path(settable: @setting.settable.to_sgid(for: 'Vario').to_s), class: 'button')
|
|
5
|
-
|
|
6
|
-
.grid.grid-cols-12.gap-4
|
|
7
|
-
.col-span-12.prose
|
|
8
|
-
- if @setting.default.present?
|
|
9
|
-
p= "#{@setting.description} (default: #{[*@setting.default].join(', ')})"
|
|
10
|
-
- else
|
|
11
|
-
p= @setting.description
|
|
12
|
-
.col-span-12= render partial: 'vario/settings/levels', locals: { setting: @setting }
|
|
13
|
-
.col-span-12= render partial: 'vario/settings/new_level', locals: { setting: @setting }
|