vario 0.4.12 → 1.0.2

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: 5e58ac2e2f8d599f2c079997d4a1aff97eab6f942d3defabf2be5e761fbd153c
4
- data.tar.gz: 38b17c68f3d33f8c6244761249831457cb7c2e1d0659128b54bb65140ca82947
3
+ metadata.gz: ab3a37265b13857ec40a8637e489a10203a6bf334ef2a3efd8e1889873785e10
4
+ data.tar.gz: df72fe737e4df892c9478e3fa06f6fb63366e4260a9f95ad97dc34564d81a92b
5
5
  SHA512:
6
- metadata.gz: 18dac0cfad4d0e2d4dce4dc8cde21163fa068bb4f2f6c26db0eb87d040477f12eb8eb9a02716bab740a729ba0e300634994aef06512cf36a644b05f520059cf9
7
- data.tar.gz: 4fbdb499f8cb06c0ccc1e419efe323e7ee1b538495822762aff7c10d1c94ca9bc3fe046676d3b9927c44e04b0363b3e48757b244226e59a8cf03a342195fd908
6
+ metadata.gz: 6ddb16a62bbc85ff044a8844f91cc2579cb43aac5742091d045a14beee0561f73ee103f867ed81eb0e85d9d60bb7448769834231bebff34545483de3971ce232
7
+ data.tar.gz: 73146c9fe8a33c9510137e93b4d1a78ddf5a0bbe7d8a9b824b0d2a862303192c925f9e79410b7666ea94f1988b4894a1b32e8576ac5c6a1100a10d07eeb410af
@@ -10,9 +10,11 @@ module Vario
10
10
  def create
11
11
  @level = Level.new(@setting, level_params)
12
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)
13
15
  @setting.save
14
16
 
15
- respond_with @setting, collection_location: setting_path(@setting)
17
+ respond_with @setting, collection_location: -> { setting_path(@setting) }
16
18
  end
17
19
 
18
20
  def update
@@ -23,17 +25,17 @@ module Vario
23
25
 
24
26
  @level = @setting.levels.find { |level| level.id == params[:id] }
25
27
  @level.value = level_params[:value]
26
- @level.conditions = level_params[:conditions].to_h
28
+ @level.conditions = normalize_booleans(level_params[:conditions].to_h)
27
29
  @setting.save
28
30
 
29
- respond_with @setting, collection_location: setting_path(@setting)
31
+ respond_with @setting, collection_location: -> { setting_path(@setting) }
30
32
  end
31
33
 
32
34
  def destroy
33
35
  @setting.levels.reject! { |level| level.id == params[:id] }
34
36
  @setting.save
35
37
 
36
- respond_with @setting, collection_location: setting_path(@setting)
38
+ respond_with @setting, collection_location: -> { setting_path(@setting) }
37
39
  end
38
40
 
39
41
  def move
@@ -59,5 +61,13 @@ module Vario
59
61
  def level_params
60
62
  params.require(:level).permit(:value, value: [], conditions: {}, context: {})
61
63
  end
64
+
65
+ def normalize_booleans(conditions)
66
+ boolean_keys = Vario.config.keys.select {|k,v|v[:type] == :boolean}.keys
67
+ boolean_keys.each do |k|
68
+ conditions[k.to_sym] = conditions[k] == "1" ? true : false
69
+ end
70
+ conditions
71
+ end
62
72
  end
63
73
  end
@@ -1,9 +1,9 @@
1
1
  - ui_card_title = 'Settings' if ui_card_title.blank?
2
2
  - context = {} if context.blank?
3
3
 
4
- = sts.card title: ui_card_title, icon: 'fad fa-slider' do |card|
4
+ = sts.card :"vario_settings #{ui_card_title}", title: ui_card_title, icon: 'fad fa-slider' do |card|
5
5
  - settings_with_contexts.sort_by { |setting| setting[:setting].name}.each do |setting|
6
- - card.tab setting[:setting].name, title: setting[:setting].title, padding: true
6
+ - card.with_tab setting[:setting].name, title: setting[:setting].title, padding: true
7
7
  .grid.grid-cols-12.gap-4
8
8
  .col-span-12.prose
9
9
  p= setting[:setting].description
@@ -11,12 +11,6 @@
11
11
  = render partial: 'vario/settings/levels', locals: setting
12
12
  .col-span-12
13
13
  = render partial: 'vario/settings/new_level', locals: setting
14
-
15
- javascript:
16
- $(document).on('ajax:error', function(event) {
17
- window.alert('An error has occurred, your changes are likely not saved. Please try again.')
18
- })
19
-
20
14
  css:
21
15
  .row.level {
22
16
  min-height: 32px;
@@ -1,9 +1,9 @@
1
- = sts.card title: @title, icon: 'fad fa-sliders' do |card|
1
+ = sts.card :"vario_settings #{@title}", title: @title, icon: 'fad fa-sliders' do |card|
2
2
  .grid.grid-cols-12.gap-4
3
3
  .col-span-4
4
4
 
5
5
  - @groups.each do |group|
6
- - card.tab group[:name], padding: true
6
+ - card.with_tab group[:name], padding: true
7
7
  table.table
8
8
  thead
9
9
  th Name
@@ -15,7 +15,7 @@
15
15
  td= setting.levels.count
16
16
 
17
17
  - if @settings.without_group.present?
18
- - card.tab :ungrouped, padding: true
18
+ - card.with_tab :ungrouped, padding: true
19
19
  table.table
20
20
  thead
21
21
  th Name
@@ -1,6 +1,6 @@
1
- = sts.card title: @setting.title, icon: 'fad fa-sliders' do |card|
1
+ = sts.card :"vario_settings #{@setting.title}", title: @setting.title, icon: 'fad fa-sliders' do |card|
2
2
 
3
- - card.action
3
+ - card.with_action
4
4
  = link_to("Back", settings_path(settable: @setting.settable.to_sgid(for: 'Vario').to_s), class: 'button')
5
5
 
6
6
  .grid.grid-cols-12.gap-4
data/lib/vario/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vario
4
- VERSION = "0.4.12"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vario
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.12
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andre Meij
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-14 00:00:00.000000000 Z
11
+ date: 2024-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.2'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: grape-swagger
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1'
61
+ version: '2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1'
68
+ version: '2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: slim
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - andre@itsmeij.com
128
128
  executables: []
@@ -172,7 +172,7 @@ homepage: https://github.com/entdec/vario
172
172
  licenses:
173
173
  - MIT
174
174
  metadata: {}
175
- post_install_message:
175
+ post_install_message:
176
176
  rdoc_options: []
177
177
  require_paths:
178
178
  - lib
@@ -187,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  requirements: []
190
- rubygems_version: 3.3.7
191
- signing_key:
190
+ rubygems_version: 3.4.10
191
+ signing_key:
192
192
  specification_version: 4
193
193
  summary: Vario adds custom runtime configuration to your Rails app.
194
194
  test_files: []