myg 2.7.0 → 2.8.0

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: 46652e6ad7944576ea5cd122a5eaf0c07e0a698b5d3326451e07cf2ade54e5da
4
- data.tar.gz: 821c2dcf533c86ba2d21260a2a658043fe6fe539baec4fb350dfd426f4e73d54
3
+ metadata.gz: '0937cd38045815e560f8ded6c453a74e26161dbdde4691b73ffab3304efb2592'
4
+ data.tar.gz: f81786ef6b57c306c0ebd927c49d1ebd76ca68ce6227538b523693389dffd31e
5
5
  SHA512:
6
- metadata.gz: 8241de5af2e7f67df4249462bf8fa70730a4b9631672831fb1abe705d88fc3f8ee6a3b034103156765d0d4847e1a12c8708ff3d093e772ccb029ae5c0fbd7ee2
7
- data.tar.gz: e1180b08215359428d6e98d68dc133c49bb452b746d46a56cf29d40369e5a947b5225549a629ad2c8646aedadd0c5b6b243ce3ef5efbafecdb7440d2dc61b529
6
+ metadata.gz: 8d75557e81cca423422f549a8c77a406efc19389c954e031390a459a5b17ce0521786ce81ac74fde229cbf2e444c15d5d74099072a903aa89af1c5cef6507e64
7
+ data.tar.gz: 16c64180d567121ffdce95cbb207445148650350cae3d7fc19856a7ba609044b8d498e2734c6bafcba25cb3de30808ada4026eaebcd790bc0499b08a46624d04
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 2.8.0 - 2018/03/17
8
+
9
+ * enhancements
10
+ * added `identifier` option to form components
11
+
7
12
  ### 2.7.0 - 2018/03/16
8
13
 
9
14
  * features
@@ -1,8 +1,9 @@
1
1
  <% class_name = options.delete :class_name %>
2
2
  <% attribute = options.delete :attribute %>
3
+ <% identifier = options.delete :identifier %>
3
4
  <% values = options.delete(:values) || [0, 1] %>
4
5
  <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
5
- <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
6
+ <% id = [class_name, identifier, attribute].map { |s| s.to_s.downcase }.join('_') %>
6
7
  <% wrapper_html = {
7
8
  class: ['myg-checkbox mdc-checkbox', options.dig(:wrapper_html, :class), ('mdc-checkbox--disabled' if options.dig(:input_html, :disabled))].join(' ')
8
9
  } %>
@@ -4,17 +4,20 @@
4
4
  <% if options[:floating_label] %><% input_html = {
5
5
  class_name: options[:class_name],
6
6
  attribute: options[:attribute],
7
+ identifier: options[:identifier],
7
8
  placeholder: options[:floating_label]
8
9
  } %><% else %><% input_html = {
9
10
  class_name: options[:class_name],
10
- attribute: options[:attribute]
11
+ attribute: options[:attribute],
12
+ identifier: options[:identifier]
11
13
  } %><% end %>
12
14
  <% input_defaults = {
13
15
  type: ('file' if options[:file])
14
16
  } %>
15
17
  <% label_html = {
16
18
  class_name: options[:class_name],
17
- attribute: options[:attribute]
19
+ attribute: options[:attribute],
20
+ identifier: options[:identifier]
18
21
  } %>
19
22
  <% label_secondary_html = label_html.merge({
20
23
  class: ['myg-label--secondary', options.dig(:label_html, :class)].join(' ')
@@ -1,14 +1,15 @@
1
- <% class_name = options.delete :class_name %>
2
- <% attribute = options.delete :attribute %>
3
- <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
4
- <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
5
- <% html = {
6
- class: ['myg-input', options[:class]].join(' '),
7
- name: name,
8
- id: id
9
- } %>
10
- <% defaults = {
11
- type: (attribute.to_s == 'email' || attribute.to_s == 'password' ? attribute : 'text')
12
- } %>
13
-
14
- <%= tag 'input', defaults.merge(options.merge(html)) %>
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% identifier = options.delete :identifier %>
4
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
5
+ <% id = [class_name, identifier, attribute].map { |s| s.to_s.downcase }.join('_') %>
6
+ <% html = {
7
+ class: ['myg-input', options[:class]].join(' '),
8
+ name: name,
9
+ id: id
10
+ } %>
11
+ <% defaults = {
12
+ type: (attribute.to_s == 'email' || attribute.to_s == 'password' ? attribute : 'text')
13
+ } %>
14
+
15
+ <%= tag 'input', defaults.merge(options.merge(html)) %>
@@ -1,6 +1,7 @@
1
1
  <% class_name = options.delete :class_name %>
2
2
  <% attribute = options.delete :attribute %>
3
- <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
3
+ <% identifier = options.delete :identifier %>
4
+ <% id = [class_name, identifier, attribute].map { |s| s.to_s.downcase }.join('_') %>
4
5
  <% html = {
5
6
  class: ['myg-label', options[:class]].join(' '),
6
7
  for: id
@@ -1,23 +1,24 @@
1
- <% class_name = options.delete :class_name %>
2
- <% attribute = options.delete :attribute %>
3
- <% value = options.delete :value %>
4
- <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
5
- <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}_#{value}" : "#{attribute}_#{value}" %>
6
- <% wrapper_html = {
7
- class: ['myg-radio mdc-radio', options.dig(:wrapper_html, :class), ('mdc-radio--disabled' if options.dig(:input_html, :disabled))].join(' ')
8
- } %>
9
- <% input_html = {
10
- type: 'radio',
11
- class: ['mdc-radio__native-control', options.dig(:input_html, :class)].join(' '),
12
- value: value,
13
- name: name,
14
- id: id
15
- } %>
16
-
17
- <%= content_tag 'div', (options[:wrapper_html] || {}).merge(wrapper_html) do %>
18
- <%= tag 'input', (options[:input_html] || {}).merge(input_html) %>
19
- <div class="mdc-radio__background">
20
- <div class="mdc-radio__outer-circle"></div>
21
- <div class="mdc-radio__inner-circle"></div>
22
- </div>
23
- <% end %>
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% identifier = options.delete :identifier %>
4
+ <% value = options.delete :value %>
5
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
6
+ <% id = [class_name, identifier, attribute, value].map { |s| s.to_s.downcase }.join('_') %>
7
+ <% wrapper_html = {
8
+ class: ['myg-radio mdc-radio', options.dig(:wrapper_html, :class), ('mdc-radio--disabled' if options.dig(:input_html, :disabled))].join(' ')
9
+ } %>
10
+ <% input_html = {
11
+ type: 'radio',
12
+ class: ['mdc-radio__native-control', options.dig(:input_html, :class)].join(' '),
13
+ value: value,
14
+ name: name,
15
+ id: id
16
+ } %>
17
+
18
+ <%= content_tag 'div', (options[:wrapper_html] || {}).merge(wrapper_html) do %>
19
+ <%= tag 'input', (options[:input_html] || {}).merge(input_html) %>
20
+ <div class="mdc-radio__background">
21
+ <div class="mdc-radio__outer-circle"></div>
22
+ <div class="mdc-radio__inner-circle"></div>
23
+ </div>
24
+ <% end %>
@@ -1,23 +1,24 @@
1
- <% class_name = options.delete :class_name %>
2
- <% attribute = options.delete :attribute %>
3
- <% values = options.delete(:values) || [0, 1] %>
4
- <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
5
- <% id = class_name ? "#{class_name.to_s.downcase}_#{attribute}" : "#{attribute}" %>
6
- <% wrapper_html = {
7
- class: ['myg-switch mdc-switch', options.dig(:wrapper_html, :class)].join(' ')
8
- } %>
9
- <% input_html = {
10
- type: 'checkbox',
11
- class: ['mdc-switch__native-control', options.dig(:input_html, :class)].join(' '),
12
- name: name,
13
- id: id,
14
- value: values.last
15
- } %>
16
-
17
- <%= content_tag 'div', (options[:wrapper_html] || {}).merge(wrapper_html) do %>
18
- <input value="<%= values.first %>" type="hidden" name="<%= name %>" />
19
- <%= tag 'input', (options[:input_html] || {}).merge(input_html) %>
20
- <div class="mdc-switch__background">
21
- <div class="mdc-switch__knob"></div>
22
- </div>
23
- <% end %>
1
+ <% class_name = options.delete :class_name %>
2
+ <% attribute = options.delete :attribute %>
3
+ <% identifier = options.delete :identifier %>
4
+ <% values = options.delete(:values) || [0, 1] %>
5
+ <% name = class_name ? "#{class_name.to_s.downcase}[#{attribute}]" : "#{attribute}" %>
6
+ <% id = [class_name, identifier, attribute].map { |s| s.to_s.downcase }.join('_') %>
7
+ <% wrapper_html = {
8
+ class: ['myg-switch mdc-switch', options.dig(:wrapper_html, :class)].join(' ')
9
+ } %>
10
+ <% input_html = {
11
+ type: 'checkbox',
12
+ class: ['mdc-switch__native-control', options.dig(:input_html, :class)].join(' '),
13
+ name: name,
14
+ id: id,
15
+ value: values.last
16
+ } %>
17
+
18
+ <%= content_tag 'div', (options[:wrapper_html] || {}).merge(wrapper_html) do %>
19
+ <input value="<%= values.first %>" type="hidden" name="<%= name %>" />
20
+ <%= tag 'input', (options[:input_html] || {}).merge(input_html) %>
21
+ <div class="mdc-switch__background">
22
+ <div class="mdc-switch__knob"></div>
23
+ </div>
24
+ <% end %>
data/lib/myg/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Myg
2
2
 
3
- VERSION = '2.7.0'
3
+ VERSION = '2.8.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties