ui_bibz 3.0.0.beta10 → 3.0.0.beta11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0b4963785be829c23f3f560fdc03346b3ee8beba96998a95b7ecf15ba20d7bf
4
- data.tar.gz: 0e37bab962b5fb777493fbe861cf21efd0acb2c6072cda35c8c0c24686ecee77
3
+ metadata.gz: 5109c403d8f9d306f2f973b619ef117bd7e3df4bb036358e47744058fc553718
4
+ data.tar.gz: 3e1af30e67ffb1c68ae033110241da17a457aa7e1b0ebc797ca521f8d3d54991
5
5
  SHA512:
6
- metadata.gz: d5a557c7bd724918100d60570f86fdd9a49b0862bc2735f11a450a524dc97569929fbc1753cbc69a71c864df51aeb5eaae67f02daff2a712cadb088d10e5961d
7
- data.tar.gz: a892279deea5157f18bb6f37fb6eed213ab979890e652d35058da21696e0d000c9ce8305bd48433fcb56f8fcb571840ee4a850e78b240c935dc5a5a98b952bb7
6
+ metadata.gz: e0bf93e9f8098b12c510c9aa3280506b893d54c6a05dad6338c4e5198ac23b9d27725403497db8171fbc7eb7e0b40358cdacc4238d1311ad2d0e02b19f6afc2b
7
+ data.tar.gz: dcb82ceeed6c63c19ecf35b95014ccf78f12a702507598a6b29e1ea5665d7767e8d0224630cc2eadf46f1699e7d6917533e391d02cd82b3452bdffabfb417557
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.beta10)
4
+ ui_bibz (3.0.0.beta11)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -182,9 +182,9 @@ GEM
182
182
  ruby_parser (3.15.1)
183
183
  sexp_processor (~> 4.9)
184
184
  sexp_processor (4.15.2)
185
- simple_form (5.0.3)
186
- actionpack (>= 5.0)
187
- activemodel (>= 5.0)
185
+ simple_form (5.1.0)
186
+ actionpack (>= 5.2)
187
+ activemodel (>= 5.2)
188
188
  simplecov (0.21.2)
189
189
  docile (~> 1.1)
190
190
  simplecov-html (~> 0.11)
data/lib/ui_bibz/infos.rb CHANGED
@@ -12,6 +12,6 @@ module UiBibz
12
12
  REPO = 'git+https://github.com/thooams/ui_bibz.git'
13
13
  EMAIL = 'thomas@hummel.link'
14
14
  AUTHOR = 'Thooams [Thomas HUMMEL]'
15
- VERSION = '3.0.0.beta10'
15
+ VERSION = '3.0.0.beta11'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -68,6 +68,7 @@ module UiBibz::Ui::Core::Forms::Choices
68
68
  def checkbox_html_options
69
69
  {
70
70
  disabled: disabled?,
71
+ checked: options[:state] == :active,
71
72
  indeterminate: options[:indeterminate],
72
73
  "data-action": options[:action],
73
74
  class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
@@ -116,5 +116,7 @@ module UiBibz::Ui::Core::Forms::Choices
116
116
  def input_id
117
117
  @input_id ||= @options[:id] || generate_id('choice')
118
118
  end
119
+
120
+ def state; end
119
121
  end
120
122
  end
@@ -65,7 +65,8 @@ module UiBibz::Ui::Core::Forms::Choices
65
65
 
66
66
  def checkbox_html_options
67
67
  {
68
- disabled: options[:state] == :disabled,
68
+ disabled: disabled?,
69
+ checked: options[:state] == :active,
69
70
  "data-action": options[:action],
70
71
  class: UiBibz::Utils::Screwdriver.join_classes('form-check-input', input_status)
71
72
  }
@@ -21,6 +21,16 @@ class SimpleFormTest < ActionView::TestCase
21
21
  @user = @users.first
22
22
  end
23
23
 
24
+ test 'simple form input' do
25
+ actual = simple_form_for @user do |f|
26
+ f.input :name_fr
27
+ end
28
+
29
+ expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group string optional user_name_fr\"><label class=\"control-label string optional\" for=\"user_name_fr\">Name fr</label><input class=\"form-control string optional\" type=\"text\" value=\"test1\" name=\"user[name_fr]\" id=\"user_name_fr\" /></div></form>"
30
+
31
+ assert_equal expected, actual
32
+ end
33
+
24
34
  test 'auto complete field input in simple form' do
25
35
  actual = simple_form_for @user do |f|
26
36
  f.input :name_fr, as: :ui_auto_complete_field, collection: @users, label_method: :name_fr
@@ -11,7 +11,7 @@ class ChoiceGroupTest < ActionView::TestCase
11
11
  bc.choice 'Checkbox 2', state: :active
12
12
  end
13
13
 
14
- expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Checkbox 1</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Checkbox 2</label></div>"
14
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Checkbox 1</label><input type=\"checkbox\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Checkbox 2</label></div>"
15
15
 
16
16
  assert_equal expected, actual.render
17
17
  end
@@ -22,7 +22,7 @@ class ChoiceGroupTest < ActionView::TestCase
22
22
  bc.choice 'Radio 2', state: :active
23
23
  end
24
24
 
25
- expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
25
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-secondary btn\" for=\"#{actual.items.first.input_options[:id]}\">Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"btn-secondary btn\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
26
26
 
27
27
  assert_equal expected, actual.render
28
28
  end
@@ -32,7 +32,7 @@ class ChoiceGroupTest < ActionView::TestCase
32
32
  bc.choice 'Radio 1', glyph: 'diamond', status: :primary
33
33
  bc.choice 'Radio 2', state: :active
34
34
  end
35
- expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-outline-primary btn btn-lg\" for=\"#{actual.items.first.input_options[:id]}\"><i class=\"glyph fas fa-diamond\"></i> Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"active btn-outline-secondary btn btn-lg\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
35
+ expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice btn-group-toggle\"><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" name=\"#{actual.items.first.input_options[:name]}\" id=\"#{actual.items.first.input_options[:id]}\" /><label class=\"btn-outline-primary btn btn-lg\" for=\"#{actual.items.first.input_options[:id]}\"><i class=\"glyph fas fa-diamond\"></i> Radio 1</label><input type=\"radio\" autocomplete=\"off\" class=\"btn-check\" checked=\"checked\" name=\"#{actual.items.last.input_options[:name]}\" id=\"#{actual.items.last.input_options[:id]}\" /><label class=\"btn-outline-secondary btn btn-lg\" aria-pressed=\"true\" for=\"#{actual.items.last.input_options[:id]}\">Radio 2</label></div>"
36
36
 
37
37
  assert_equal expected, actual.render
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ui_bibz
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta10
4
+ version: 3.0.0.beta11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thooams [Thomas HUMMEL]
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails