myg 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -0
- data/app/views/mozaic/myg/_checkbox.html.erb +26 -25
- data/app/views/mozaic/myg/_form-field.html.erb +13 -4
- data/app/views/mozaic/myg/_tabs.html.erb +3 -3
- data/app/views/mozaic/myg/_titlebar.html.erb +12 -0
- data/lib/generators/myg/tabs_generator.rb +3 -3
- data/lib/generators/templates/install/stylesheets/_myg.sass +2 -0
- data/lib/generators/templates/tabs/_tabs.html.erb +1 -1
- data/lib/myg/railtie.rb +1 -0
- data/lib/myg/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66ef34aff3aa0db415984360e708fec7e9ef1e9a51f2ee8e8586df1d8c439536
|
4
|
+
data.tar.gz: f88a8fc86c73d011ea1eafd9ab54e067e372330e7a0652905cb9b778bf42c0e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c12b67b108bb9e46e551353a0b1914ea0d5981f0dee9eb7d686b0eb171fa51ca32459ba242c406a8130326ad865dac1f417b8d411bc99ce0a5e8bb8ddd9228d3
|
7
|
+
data.tar.gz: '09894914422a24c4e4ade92cf4e8c2bb7c363704e9f56bd171f467e8dd8c47b94ed8143ca6cd21f9d33cf5eaf8dde2bca8ec1238bfee1429cf8eb372e741def2'
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -83,6 +83,7 @@ These are the components currently supported by Myg on Rails:
|
|
83
83
|
* [`slider`](components/myg/slider.md)
|
84
84
|
* [`switch`](components/myg/switch.md)
|
85
85
|
* [`tabs`](components/myg/tabs.md)
|
86
|
+
* [`titlebar`](components/myg/titlebar.md)
|
86
87
|
* [`toast`](components/myg/toast.md)
|
87
88
|
* [`toolbar`](components/myg/toolbar.md)
|
88
89
|
|
@@ -1,25 +1,26 @@
|
|
1
|
-
<% class_name = options.delete :class_name %>
|
2
|
-
<% attribute = options.delete :attribute %>
|
3
|
-
<%
|
4
|
-
<%
|
5
|
-
<%
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
name: name,
|
13
|
-
id: id
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<%=
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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-checkbox mdc-checkbox', options.dig(:wrapper_html, :class), ('mdc-checkbox--disabled' if options.dig(:input_html, :disabled))].join(' ')
|
8
|
+
} %>
|
9
|
+
<% input_html = {
|
10
|
+
type: 'checkbox',
|
11
|
+
class: ['mdc-checkbox__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-checkbox__background">
|
21
|
+
<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
|
22
|
+
<path class="mdc-checkbox__checkmark__path" fill="none" stroke="white" d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
|
23
|
+
</svg>
|
24
|
+
<div class="mdc-checkbox__mixedmark"></div>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
@@ -1,13 +1,15 @@
|
|
1
1
|
<% wrapper_html = {
|
2
|
-
class: ['myg-form-field', ('myg-form-field--inline-label' if options[:inline_label]), ('myg-form-field--floating-label' if options[:floating_label]), options.dig(:wrapper_html, :class)].join(' ')
|
2
|
+
class: ['myg-form-field', ('myg-form-field--inline-label' if options[:inline_label]), ('myg-form-field--floating-label' if options[:floating_label]), ('myg-form-field--file' if options[:file]), options.dig(:wrapper_html, :class)].join(' ')
|
3
3
|
} %>
|
4
4
|
<% if options[:floating_label] %><% input_html = {
|
5
5
|
class_name: options[:class_name],
|
6
6
|
attribute: options[:attribute],
|
7
|
+
type: ('file' if options[:file]),
|
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
|
+
type: ('file' if options[:file])
|
11
13
|
} %><% end %>
|
12
14
|
<% label_html = {
|
13
15
|
class_name: options[:class_name],
|
@@ -32,7 +34,15 @@
|
|
32
34
|
<% end %>
|
33
35
|
<% end %>
|
34
36
|
<% end %>
|
35
|
-
|
37
|
+
<% if options[:floating_label] %>
|
38
|
+
<%= content_tag 'div', class: 'myg-input--container' do %>
|
39
|
+
<%= component "myg/#{options[:as]}", (options[:input_html] || {}).merge(input_html) %>
|
40
|
+
<%= component 'myg/label', (options[:label_html] || {}).merge(label_html) do %><%= options[:floating_label] %><% end %>
|
41
|
+
<% end %>
|
42
|
+
<% else %>
|
43
|
+
<%= component "myg/#{options[:as]}", (options[:input_html] || {}).merge(input_html) %>
|
44
|
+
<% if options[:file] %><%= component 'myg/label', (options[:label_html] || {}).merge(label_html) do %><%= options[:file] %><% end %><% end %>
|
45
|
+
<% end %>
|
36
46
|
<% if options[:inline_label] %>
|
37
47
|
<% unless options[:inline_label].is_a? Array %>
|
38
48
|
<%= component 'myg/label', (options[:label_html] || {}).merge(label_html) do %><%= options[:inline_label] %><% end %>
|
@@ -44,5 +54,4 @@
|
|
44
54
|
<% end %>
|
45
55
|
<% end %>
|
46
56
|
<% end %>
|
47
|
-
<% if options[:floating_label] %><%= component 'myg/label', (options[:label_html] || {}).merge(label_html) do %><%= options[:floating_label] %><% end %><% end %>
|
48
57
|
<% end %>
|
@@ -10,11 +10,11 @@
|
|
10
10
|
<% tab_html = {
|
11
11
|
class: ['mdc-tab', options.dig(:tab_html, :class), ('mdc-tab--active' if tab[:active])].join(' '),
|
12
12
|
aria: {
|
13
|
-
controls: tab[:
|
13
|
+
controls: tab[:name].underscore
|
14
14
|
},
|
15
15
|
role: 'tab'
|
16
16
|
} %>
|
17
|
-
<%= link_to tab[:name], tab[:href] || "##{tab[:
|
17
|
+
<%= link_to tab[:name], tab[:href] || "##{tab[:name].underscore}", (options[:tab_html] || {}).merge(tab_html) %>
|
18
18
|
<% end %>
|
19
19
|
<span class="mdc-tab-bar__indicator"></span>
|
20
20
|
<% end %>
|
@@ -29,7 +29,7 @@
|
|
29
29
|
<% options[:tabs]&.each do |tab| %>
|
30
30
|
<% panel_html = {
|
31
31
|
class: ['myg-tabs--panel', options.dig(:panel_html, :class), ('myg-tabs--shown' if tab[:active])].join(' '),
|
32
|
-
id: tab[:
|
32
|
+
id: tab[:name].underscore,
|
33
33
|
role: 'tabpanel',
|
34
34
|
aria: {
|
35
35
|
hidden: (tab[:active] ? false : true)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% html = {
|
2
|
+
class: ['myg-titlebar welcomer', options[:class]].join(' ')
|
3
|
+
} %>
|
4
|
+
|
5
|
+
<%= content_tag 'div', options.merge(html) do %>
|
6
|
+
<%= block %>
|
7
|
+
<% if options[:close] %>
|
8
|
+
<div class="welcomer--close">
|
9
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"><g transform="translate(0, 0)"><polygon fill="#fff" points="10.1,4.5 8,6.6 5.9,4.5 4.5,5.9 6.6,8 4.5,10.1 5.9,11.5 8,9.4 10.1,11.5 11.5,10.1 9.4,8 11.5,5.9 "></polygon></g></svg>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -14,9 +14,9 @@ class Myg::TabsGenerator < Rails::Generators::Base
|
|
14
14
|
def create_templates
|
15
15
|
template '_tabs.html.erb', "app/views/#{options[:controller]}/_tabs.html.erb"
|
16
16
|
options[:method_names]&.each do |name|
|
17
|
-
@name = name[:
|
18
|
-
template 'tab.html.erb', "app/views/#{options[:controller]}
|
19
|
-
template '_tab.html.erb', "app/views/#{options[:controller]}
|
17
|
+
@name = name[:name].underscore
|
18
|
+
template 'tab.html.erb', "app/views/#{options[:controller]}/#{@name}.html.erb"
|
19
|
+
template '_tab.html.erb', "app/views/#{options[:controller]}/_#{@name}.html.erb"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -60,9 +60,11 @@
|
|
60
60
|
// +myg-label--classes
|
61
61
|
// +myg-layout--classes
|
62
62
|
// +myg-radio--classes
|
63
|
+
// +myg-switch--classes
|
63
64
|
// +myg-tabs--classes
|
64
65
|
// +myg-text--classes
|
65
66
|
// +myg-theme--classes
|
67
|
+
// +myg-titlebar--classes
|
66
68
|
// +myg-toast--classes
|
67
69
|
// +myg-toolbar--classes
|
68
70
|
// +myg-tooltip--classes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h1>Title</h1>
|
2
2
|
|
3
|
-
<%%= component 'myg/tabs', async: true, success: local_assigns[:success], tabs: <%= options[:method_names]&.map! { |t| { name: t.titleize, href:
|
3
|
+
<%%= component 'myg/tabs', async: true, success: local_assigns[:success], tabs: <%= options[:method_names]&.map! { |t| { name: t.titleize, href: '' } } %> do %>
|
4
4
|
<p>An error occured</p>
|
5
5
|
<%% end %>
|
data/lib/myg/railtie.rb
CHANGED
@@ -15,6 +15,7 @@ module Myg
|
|
15
15
|
config.define_component 'myg/slider', discrete: false, disabled: false, value: 0, min: 0, max: 50, label: 'Select value'
|
16
16
|
config.define_component 'myg/switch'
|
17
17
|
config.define_component 'myg/tabs', async: false
|
18
|
+
config.define_component 'myg/titlebar', close: true
|
18
19
|
config.define_component 'myg/toast'
|
19
20
|
config.define_component 'myg/toolbar'
|
20
21
|
end
|
data/lib/myg/version.rb
CHANGED
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.
|
4
|
+
version: 2.6.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-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- app/views/mozaic/myg/_slider.html.erb
|
116
116
|
- app/views/mozaic/myg/_switch.html.erb
|
117
117
|
- app/views/mozaic/myg/_tabs.html.erb
|
118
|
+
- app/views/mozaic/myg/_titlebar.html.erb
|
118
119
|
- app/views/mozaic/myg/_toast.html.erb
|
119
120
|
- app/views/mozaic/myg/_toolbar.html.erb
|
120
121
|
- lib/generators/myg/install_generator.rb
|