ez-settings 0.2.3 → 0.2.4

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: 1f55bd8dda018755a4db33fd94e9232669074afdc7af2029de8e5728e92ff80a
4
- data.tar.gz: c0f36d36db6adeae4880bdb7ef4598c1c9ba4bbaadb1f8bd9ca52c0e27d868f4
3
+ metadata.gz: ec5f2fa00686e7a7d220ff1944d4c0c481ccfb47b3a282285858ccc1c90468f0
4
+ data.tar.gz: 8d5037d087086a8c045ef18ec9ce5c917892587f14a7bc567a47a623d7f0a711
5
5
  SHA512:
6
- metadata.gz: 5a50de648b5c2d1ce8ef1773f9fee0f9967352ef91775d76535fc2e652b358110d90c0fa6d9e2f802df5f17d09c4b4fbd0ad35af785926b26cb31a47d2358d3f
7
- data.tar.gz: 73a21c257b75f87b41708795dc57a1b2167d4c3f37412448afa79d4b5d55933ba0438a6f200d4cce1d003376d05b8ae4490e25f7b734283be42355cedbc1b425
6
+ metadata.gz: 4c5d9592cd289a2acd0683154eea446b3d8330adf9e0effca9dbe68129cd76312c8ccf34d8d60a6c1fbb109ad7f5aae223f0e8d3dd850369c18be991c1dbff4b
7
+ data.tar.gz: 87773d528bcc1f72c362aa3d77c568591c8311e6db673feb84bf004ce443731c3a2a182e2c0667b28c2332aa5ac828101c6025b654e4b5bd10149f214119fc24
data/README.md CHANGED
@@ -62,7 +62,7 @@ app = Ez::Settings::Interface.define :app do # :app - interface name
62
62
  group :showcase, on_change: ->(changes) { YourHandler.call(changes) } do
63
63
  key :string, default: -> { 'simple string' }
64
64
  key :bool, type: :boolean, default: -> { true }
65
- key :integer, type: :integer, default: -> { 777 }
65
+ key :integer, type: :integer, default: -> { 777 }, min: 0, suffix: 'USD', wrapper: :custom_wrapper
66
66
  key :select, type: :select, default: -> { 'foo' }, collection: %w(foo bar baz)
67
67
  key :not_validate, required: false, presence: false
68
68
  key :not_for_ui, required: false, ui: false
@@ -74,6 +74,9 @@ app = Ez::Settings::Interface.define :app do # :app - interface name
74
74
  # :default value (as callable objects)
75
75
  # :required - be or not (all keys are required by default)
76
76
  # :ui visible or not (all keys are UI visible by default)
77
+ # :min - the minimum value for the element
78
+ # :suffix - unit of measurement
79
+ # :wrapper - custom wrapper for simple_form
77
80
  end
78
81
 
79
82
  # After defining settings interface groups/keys you need to configure it:
@@ -63,7 +63,7 @@ module Ez::Settings
63
63
  group_page_form_select_wrapper: 'ez-settings-group-form-select-wrapper',
64
64
  group_page_actions_wrapper: 'ez-settings-group-actions-wrapper',
65
65
  group_page_actions_save_button: 'ez-settings-group-actions-save-btn',
66
- group_page_actions_cancel_link: 'ez-settings-group-actions-cancel-link',
66
+ group_page_actions_cancel_link: 'ez-settings-group-actions-cancel-link'
67
67
  }.merge(interface.config.custom_css_map)
68
68
  end
69
69
 
@@ -10,9 +10,7 @@
10
10
 
11
11
  - group.ui_keys.each do |key|
12
12
  div class="#{css_for :overview_page_section_content}"
13
-
14
13
  div class="#{css_for :overview_page_section_content_key}"
15
14
  = i18n_key_label(key)
16
-
17
15
  div class="#{css_for :overview_page_section_content_value}"
18
- = group.store(interface.config.backend).send(key.name)
16
+ = "#{group.store(interface.config.backend).send(key.name)} #{key.suffix}"
@@ -1,4 +1,4 @@
1
1
  div class=(css_for :group_page_form_field_row)
2
2
  div id=(css_for "#{interface.name}-#{model.group}-#{model.name}-wrapper".to_sym)
3
- div class=(css_for "group_page_form_#{model.type}_wrapper".to_sym)
4
- = form.input model.name, html_options
3
+ div class=(css_for "group_page_form_#{model.type}_wrapper".to_sym)
4
+ = form.input model.name, html_options
@@ -14,7 +14,12 @@ module Ez::Settings
14
14
  include_blank: model.default.present?,
15
15
  required: model.required?,
16
16
  checked_value: true.to_s,
17
- unchecked_value: false.to_s
17
+ unchecked_value: false.to_s,
18
+ wrapper: model.wrapper,
19
+ right_label: model.suffix,
20
+ input_html: {
21
+ min: model.min
22
+ }
18
23
  }.merge(model.options)
19
24
  end
20
25
  end
@@ -2,7 +2,8 @@ module Ez::Settings
2
2
  class Interface
3
3
  class Key
4
4
  attr_reader :name, :group, :interface, :type, :default,
5
- :ui, :required, :collection, :options
5
+ :ui, :required, :collection, :options, :suffix,
6
+ :min, :wrapper
6
7
 
7
8
  def initialize(name, params)
8
9
  @name = name
@@ -14,6 +15,9 @@ module Ez::Settings
14
15
  @required = params.fetch(:required, true)
15
16
  @collection = params.fetch(:collection, [])
16
17
  @options = params.fetch(:options, {})
18
+ @suffix = params.fetch(:suffix, nil)
19
+ @min = params.fetch(:min, nil)
20
+ @wrapper = params.fetch(:wrapper, nil)
17
21
  end
18
22
 
19
23
  # Alias all boolean-like options to predicates methods, please
@@ -1,5 +1,5 @@
1
1
  module Ez
2
2
  module Settings
3
- VERSION = '0.2.3'
3
+ VERSION = '0.2.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez-settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodya Sveredyuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-28 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ez-core