myg 2.10.3 → 2.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +143 -143
  4. data/app/helpers/myg/theme_helper.rb +38 -34
  5. data/app/views/mozaic/myg/_button.html.erb +5 -5
  6. data/app/views/mozaic/myg/_checkbox.html.erb +27 -27
  7. data/app/views/mozaic/myg/_drawer.html.erb +2 -2
  8. data/app/views/mozaic/myg/_form-field.html.erb +64 -64
  9. data/app/views/mozaic/myg/_hint.html.erb +7 -7
  10. data/app/views/mozaic/myg/_input.html.erb +15 -15
  11. data/app/views/mozaic/myg/_label.html.erb +12 -12
  12. data/app/views/mozaic/myg/_progress.html.erb +15 -15
  13. data/app/views/mozaic/myg/_radio.html.erb +24 -24
  14. data/app/views/mozaic/myg/_slider.html.erb +22 -22
  15. data/app/views/mozaic/myg/_switch.html.erb +24 -24
  16. data/app/views/mozaic/myg/_tabs.html.erb +43 -43
  17. data/app/views/mozaic/myg/_textarea.html.erb +14 -12
  18. data/app/views/mozaic/myg/_titlebar.html.erb +12 -12
  19. data/app/views/mozaic/myg/_toast.html.erb +10 -10
  20. data/app/views/mozaic/myg/_toolbar.html.erb +2 -2
  21. data/lib/generators/myg/install_generator.rb +72 -46
  22. data/lib/generators/myg/tabs_generator.rb +30 -23
  23. data/lib/generators/myg/theme_generator.rb +9 -5
  24. data/lib/generators/templates/install/initializer.rb +35 -36
  25. data/lib/generators/templates/install/javascripts/action-button.js +9 -9
  26. data/lib/generators/templates/install/javascripts/button.js +9 -9
  27. data/lib/generators/templates/install/javascripts/card.js +9 -9
  28. data/lib/generators/templates/install/javascripts/checkbox.js +9 -9
  29. data/lib/generators/templates/install/javascripts/dialog.js +9 -9
  30. data/lib/generators/templates/install/javascripts/drawer.js +9 -9
  31. data/lib/generators/templates/install/javascripts/dropdown.js +9 -9
  32. data/lib/generators/templates/install/javascripts/footer.js +9 -9
  33. data/lib/generators/templates/install/javascripts/form-field.js +9 -9
  34. data/lib/generators/templates/install/javascripts/index.js.erb +24 -24
  35. data/lib/generators/templates/install/javascripts/menu.js +9 -9
  36. data/lib/generators/templates/install/javascripts/modal.js +9 -9
  37. data/lib/generators/templates/install/javascripts/progress.js +9 -9
  38. data/lib/generators/templates/install/javascripts/radio.js +9 -9
  39. data/lib/generators/templates/install/javascripts/select.js +9 -9
  40. data/lib/generators/templates/install/javascripts/sidebar.js +9 -9
  41. data/lib/generators/templates/install/javascripts/slide.js +9 -9
  42. data/lib/generators/templates/install/javascripts/slider.js +9 -9
  43. data/lib/generators/templates/install/javascripts/tabs.js +9 -9
  44. data/lib/generators/templates/install/javascripts/text.js +9 -9
  45. data/lib/generators/templates/install/javascripts/theme.js +9 -9
  46. data/lib/generators/templates/install/javascripts/titlebar.js +9 -9
  47. data/lib/generators/templates/install/javascripts/toast.js +9 -9
  48. data/lib/generators/templates/install/javascripts/toolbar.js +9 -9
  49. data/lib/generators/templates/install/javascripts/tooltip.js +9 -9
  50. data/lib/generators/templates/install/stylesheets/myg.scss +107 -0
  51. data/lib/generators/templates/install/stylesheets/theme/_custom.scss +30 -0
  52. data/lib/generators/templates/install/stylesheets/theme/theme.scss +3 -0
  53. data/lib/generators/templates/install/stylesheets/variables/_action-button.scss +3 -3
  54. data/lib/generators/templates/install/stylesheets/variables/_animate.scss +15 -16
  55. data/lib/generators/templates/install/stylesheets/variables/_base.scss +16 -17
  56. data/lib/generators/templates/install/stylesheets/variables/_font.scss +6 -6
  57. data/lib/generators/templates/install/stylesheets/variables/_footer.scss +3 -3
  58. data/lib/generators/templates/install/stylesheets/variables/_grid.scss +15 -15
  59. data/lib/generators/templates/install/stylesheets/variables/_layout.scss +4 -4
  60. data/lib/generators/templates/install/stylesheets/variables/_spacing.scss +1 -1
  61. data/lib/generators/templates/install/stylesheets/variables/_text.scss +48 -48
  62. data/lib/generators/templates/install/stylesheets/variables/_theme.scss +38 -7
  63. data/lib/generators/templates/tabs/_tab.html.erb +1 -1
  64. data/lib/generators/templates/tabs/_tabs.html.erb +5 -5
  65. data/lib/generators/templates/tabs/tab.html.erb +1 -1
  66. data/lib/generators/templates/theme/stylesheets/_theme.scss.erb +30 -27
  67. data/lib/myg.rb +5 -5
  68. data/lib/myg/configuration.rb +38 -39
  69. data/lib/myg/engine.rb +8 -6
  70. data/lib/myg/railtie.rb +36 -34
  71. data/lib/myg/version.rb +3 -3
  72. data/vendor/assets/javascripts/myg.js +40 -16513
  73. data/vendor/assets/stylesheets/myg.css +33154 -696
  74. metadata +46 -36
  75. data/CHANGELOG.md +0 -170
  76. data/lib/generators/templates/install/javascripts/input.js +0 -9
  77. data/lib/generators/templates/install/stylesheets/_myg.sass +0 -77
  78. data/lib/generators/templates/install/stylesheets/_variables.sass +0 -12
  79. data/lib/generators/templates/install/stylesheets/myg.sass +0 -8
  80. data/lib/generators/templates/install/stylesheets/theme/_default.scss +0 -30
  81. data/lib/generators/templates/install/stylesheets/theme/theme.sass +0 -2
@@ -1,12 +1,14 @@
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('_').tr('[', '_').tr(']', '_') %>
6
- <% html = {
7
- class: ['myg-input__textarea', options[:class]].join(' '),
8
- name: name,
9
- id: id
10
- } %>
11
-
12
- <%= content_tag 'textarea', options.merge(html) do %><%= block %><% end %>
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('_').tr('[', '_').tr(']', '_') %>
6
+ <% html = {
7
+ class: ['myg-input__textarea', options[:class]].join(' '),
8
+ name: name,
9
+ id: id
10
+ } %>
11
+
12
+ <%= content_tag 'textarea', options.merge(html) do %>
13
+ <%= block %>
14
+ <% end %>
@@ -1,12 +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 %>
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 %>
@@ -1,15 +1,15 @@
1
1
  <% html = {
2
- class: ['myg-toast mdc-snackbar mdc-snackbar--align-start', options[:class]].join(' '),
3
- aria: {
4
- live: 'assertive',
5
- atomic: true,
6
- hidden: true
7
- }
2
+ class: ['myg-toast mdc-snackbar mdc-snackbar--align-start', options[:class]].join(' '),
3
+ aria: {
4
+ live: 'assertive',
5
+ atomic: true,
6
+ hidden: true
7
+ }
8
8
  } %>
9
9
 
10
10
  <%= content_tag 'div', options.merge(html) do %>
11
- <div class="mdc-snackbar__text"></div>
12
- <div class="mdc-snackbar__action-wrapper">
13
- <button type="button" class="mdc-snackbar__action-button"></button>
14
- </div>
11
+ <div class="mdc-snackbar__text"></div>
12
+ <div class="mdc-snackbar__action-wrapper">
13
+ <button type="button" class="mdc-snackbar__action-button"></button>
14
+ </div>
15
15
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <% html = {
2
- class: ['myg-toolbar mdc-toolbar', options[:class]].join(' ')
2
+ class: ['myg-toolbar mdc-toolbar', options[:class]].join(' ')
3
3
  } %>
4
4
 
5
5
  <%= content_tag 'header', options.merge(html) do %>
6
- <%= block %>
6
+ <%= block %>
7
7
  <% end %>
@@ -1,64 +1,90 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/migration'
3
5
 
4
- class Myg::InstallGenerator < Rails::Generators::Base
5
-
6
+ module Myg
7
+ class InstallGenerator < Rails::Generators::Base
6
8
  include Rails::Generators::Migration
7
9
 
8
10
  source_root File.join File.dirname(__FILE__), '../templates/install'
9
11
  desc 'Install Myg on Rails'
10
12
 
11
13
  def create_initializer
12
- template 'initializer.rb', 'config/initializers/myg.rb'
14
+ template 'initializer.rb', 'config/initializers/myg.rb'
13
15
  end
14
16
 
17
+ # rubocop:disable Metrics/AbcSize
18
+ # rubocop:disable Metrics/MethodLength
15
19
  def create_stylesheets
16
- template 'stylesheets/myg.sass', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/myg.sass"
17
- template 'stylesheets/_myg.sass', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/_myg.sass"
18
- template 'stylesheets/_variables.sass', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/_variables.sass"
19
- template 'stylesheets/variables/_action-button.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_action-button.scss"
20
- template 'stylesheets/variables/_animate.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_animate.scss"
21
- template 'stylesheets/variables/_base.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_base.scss"
22
- template 'stylesheets/variables/_font.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_font.scss"
23
- template 'stylesheets/variables/_footer.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_footer.scss"
24
- template 'stylesheets/variables/_grid.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_grid.scss"
25
- template 'stylesheets/variables/_layout.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_layout.scss"
26
- template 'stylesheets/variables/_spacing.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_spacing.scss"
27
- template 'stylesheets/variables/_text.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_text.scss"
28
- template 'stylesheets/variables/_theme.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/variables/_theme.scss"
29
- template 'stylesheets/theme/theme.sass', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/theme/theme.sass"
30
- template 'stylesheets/theme/_default.scss', "#{Myg.configuration&.stylesheets_dir || 'app/assets/stylesheets/myg'}/theme/_default.scss"
20
+ template 'stylesheets/myg.scss', "#{stylesheets_dir}/myg.scss"
21
+ template 'stylesheets/variables/_action-button.scss',
22
+ "#{stylesheets_dir}/variables/_action-button.scss"
23
+ template 'stylesheets/variables/_animate.scss',
24
+ "#{stylesheets_dir}/variables/_animate.scss"
25
+ template 'stylesheets/variables/_base.scss',
26
+ "#{stylesheets_dir}/variables/_base.scss"
27
+ template 'stylesheets/variables/_font.scss',
28
+ "#{stylesheets_dir}/variables/_font.scss"
29
+ template 'stylesheets/variables/_footer.scss',
30
+ "#{stylesheets_dir}/variables/_footer.scss"
31
+ template 'stylesheets/variables/_grid.scss',
32
+ "#{stylesheets_dir}/variables/_grid.scss"
33
+ template 'stylesheets/variables/_layout.scss',
34
+ "#{stylesheets_dir}/variables/_layout.scss"
35
+ template 'stylesheets/variables/_spacing.scss',
36
+ "#{stylesheets_dir}/variables/_spacing.scss"
37
+ template 'stylesheets/variables/_text.scss',
38
+ "#{stylesheets_dir}/variables/_text.scss"
39
+ template 'stylesheets/variables/_theme.scss',
40
+ "#{stylesheets_dir}/variables/_theme.scss"
41
+ template 'stylesheets/theme/theme.scss',
42
+ "#{stylesheets_dir}/theme/theme.scss"
43
+ template 'stylesheets/theme/_custom.scss',
44
+ "#{stylesheets_dir}/theme/_custom.scss"
31
45
  end
32
46
 
33
47
  def create_javascripts
34
- template 'javascripts/index.js.erb', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/index.js"
35
- unless Myg.configuration&.es6 == false
36
- template 'javascripts/action-button.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/action-button.js"
37
- template 'javascripts/button.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/button.js"
38
- template 'javascripts/card.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/card.js"
39
- template 'javascripts/checkbox.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/checkbox.js"
40
- template 'javascripts/dialog.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/dialog.js"
41
- template 'javascripts/drawer.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/drawer.js"
42
- template 'javascripts/dropdown.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/dropdown.js"
43
- template 'javascripts/footer.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/footer.js"
44
- template 'javascripts/form-field.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/form-field.js"
45
- template 'javascripts/input.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/input.js"
46
- template 'javascripts/menu.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/menu.js"
47
- template 'javascripts/modal.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/modal.js"
48
- template 'javascripts/progress.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/progress.js"
49
- template 'javascripts/radio.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/radio.js"
50
- template 'javascripts/select.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/select.js"
51
- template 'javascripts/sidebar.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/sidebar.js"
52
- template 'javascripts/slide.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/slide.js"
53
- template 'javascripts/slider.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/slider.js"
54
- template 'javascripts/tabs.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/tabs.js"
55
- template 'javascripts/text.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/text.js"
56
- template 'javascripts/theme.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/theme.js"
57
- template 'javascripts/titlebar.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/titlebar.js"
58
- template 'javascripts/toast.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/toast.js"
59
- template 'javascripts/toolbar.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/toolbar.js"
60
- template 'javascripts/tooltip.js', "#{Myg.configuration&.javascripts_dir || 'app/assets/javascripts/myg'}/tooltip.js"
61
- end
48
+ template 'javascripts/index.js.erb', "#{javascripts_dir}/index.js"
49
+
50
+ return unless Myg.configuration&.es6
51
+ template 'javascripts/action-button.js',
52
+ "#{javascripts_dir}/action-button.js"
53
+ template 'javascripts/button.js', "#{javascripts_dir}/button.js"
54
+ template 'javascripts/card.js', "#{javascripts_dir}/card.js"
55
+ template 'javascripts/checkbox.js', "#{javascripts_dir}/checkbox.js"
56
+ template 'javascripts/dialog.js', "#{javascripts_dir}/dialog.js"
57
+ template 'javascripts/drawer.js', "#{javascripts_dir}/drawer.js"
58
+ template 'javascripts/dropdown.js', "#{javascripts_dir}/dropdown.js"
59
+ template 'javascripts/footer.js', "#{javascripts_dir}/footer.js"
60
+ template 'javascripts/form-field.js', "#{javascripts_dir}/form-field.js"
61
+ template 'javascripts/menu.js', "#{javascripts_dir}/menu.js"
62
+ template 'javascripts/modal.js', "#{javascripts_dir}/modal.js"
63
+ template 'javascripts/progress.js', "#{javascripts_dir}/progress.js"
64
+ template 'javascripts/radio.js', "#{javascripts_dir}/radio.js"
65
+ template 'javascripts/select.js', "#{javascripts_dir}/select.js"
66
+ template 'javascripts/sidebar.js', "#{javascripts_dir}/sidebar.js"
67
+ template 'javascripts/slide.js', "#{javascripts_dir}/slide.js"
68
+ template 'javascripts/slider.js', "#{javascripts_dir}/slider.js"
69
+ template 'javascripts/tabs.js', "#{javascripts_dir}/tabs.js"
70
+ template 'javascripts/text.js', "#{javascripts_dir}/text.js"
71
+ template 'javascripts/theme.js', "#{javascripts_dir}/theme.js"
72
+ template 'javascripts/titlebar.js', "#{javascripts_dir}/titlebar.js"
73
+ template 'javascripts/toast.js', "#{javascripts_dir}/toast.js"
74
+ template 'javascripts/toolbar.js', "#{javascripts_dir}/toolbar.js"
75
+ template 'javascripts/tooltip.js', "#{javascripts_dir}/tooltip.js"
62
76
  end
77
+ # rubocop:enable Metrics/AbcSize
78
+ # rubocop:enable Metrics/MethodLength
79
+
80
+ private
63
81
 
82
+ def stylesheets_dir
83
+ stylesheets_dir
84
+ end
85
+
86
+ def javascripts_dir
87
+ javascripts_dir
88
+ end
89
+ end
64
90
  end
@@ -1,23 +1,30 @@
1
- require 'rails/generators'
2
- require 'rails/generators/migration'
3
-
4
- class Myg::TabsGenerator < Rails::Generators::Base
5
-
6
- include Rails::Generators::Migration
7
-
8
- source_root File.join File.dirname(__FILE__), '../templates/tabs'
9
- desc 'Generate a Myg tabs template'
10
-
11
- class_option :controller, desc: 'Tabs controller', type: :string, aliases: '-c'
12
- class_option :method_names, desc: 'Tab method names', type: :array, aliases: '-m'
13
-
14
- def create_templates
15
- template '_tabs.html.erb', "app/views/#{options[:controller]}/_tabs.html.erb"
16
- options[:method_names]&.each do |name|
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
- end
21
- end
22
-
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators'
4
+ require 'rails/generators/migration'
5
+
6
+ module Myg
7
+ class TabsGenerator < Rails::Generators::Base
8
+ include Rails::Generators::Migration
9
+
10
+ source_root File.join File.dirname(__dir__), 'templates/tabs'
11
+ desc 'Generate a Myg tabs template'
12
+
13
+ class_option :controller, desc: 'Tabs controller', type: :string,
14
+ aliases: '-c'
15
+ class_option :method_names, desc: 'Tab method names', type: :array,
16
+ aliases: '-m'
17
+
18
+ def create_templates
19
+ template '_tabs.html.erb', "app/views/#{options[:controller]}/"\
20
+ '_tabs.html.erb'
21
+ options[:method_names]&.each do |name|
22
+ @name = name[:name].underscore
23
+ template 'tab.html.erb', "app/views/#{options[:controller]}/"\
24
+ "#{@name}.html.erb"
25
+ template '_tab.html.erb', "app/views/#{options[:controller]}/"\
26
+ "_#{@name}.html.erb"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,17 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
  require 'rails/generators/migration'
3
5
 
4
- class Myg::ThemeGenerator < Rails::Generators::Base
5
-
6
+ module Myg
7
+ class ThemeGenerator < Rails::Generators::Base
6
8
  include Rails::Generators::Migration
7
9
 
8
- source_root File.join File.dirname(__FILE__), '../templates/theme'
10
+ source_root File.join File.dirname(__dir__), 'templates/theme'
9
11
  desc 'Add Myg theme'
10
12
 
11
13
  class_option :name, desc: 'Theme name', type: :string, aliases: '-n'
12
14
 
13
15
  def create_assets
14
- template 'stylesheets/_theme.scss.erb', "#{Myg.configuration.stylesheets_dir}/theme/_#{options[:name]}.scss"
16
+ template 'stylesheets/_theme.scss.erb',
17
+ "#{Myg.configuration.stylesheets_dir}/theme/"\
18
+ "_#{options[:name]}.scss"
15
19
  end
16
-
20
+ end
17
21
  end
@@ -1,36 +1,35 @@
1
- Myg.configure do |config|
2
-
3
- # Path to Myg javascripts directory
4
- # config.javascripts_dir = 'app/assets/javascripts/myg'
5
-
6
- # Path to Myg stylehseets directory
7
- # config.stylesheets_dir = 'app/assets/stylesheets/myg'
8
-
9
- # Enable or disable Webpack (ES6)
10
- # config.es6 = true
11
-
12
-
13
- ##### MYG-THEME #####
14
-
15
- # Array of available themes
16
- # config.themes = ['default']
17
-
18
- # Default theme
19
- # config.theme = 'default'
20
-
21
- ### Automatic themes ###
22
-
23
- # Enable automatic themes
24
- # config.theme_auto = false
25
-
26
- # Day theme
27
- # config.theme_day = 'light'
28
- # Night theme
29
- # config.theme_night = 'dark'
30
-
31
- # Beginning of daytime
32
- # config.theme_day_time = '6:00 am'
33
- # Beginning of nighttime
34
- # config.theme_night_time = '6:00 pm'
35
-
36
- end
1
+ # frozen_string_literal: true
2
+
3
+ Myg.configure do |config|
4
+ # Path to Myg javascripts directory
5
+ # config.javascripts_dir = 'app/assets/javascripts/myg'
6
+
7
+ # Path to Myg stylehseets directory
8
+ # config.stylesheets_dir = 'app/assets/stylesheets/myg'
9
+
10
+ # Enable or disable Webpack (ES6)
11
+ # config.es6 = true
12
+
13
+ ##### MYG-THEME #####
14
+
15
+ # Array of available themes
16
+ # config.themes = ['default']
17
+
18
+ # Default theme
19
+ # config.theme = 'default'
20
+
21
+ ### Automatic themes ###
22
+
23
+ # Enable automatic themes
24
+ # config.theme_auto = false
25
+
26
+ # Day theme
27
+ # config.theme_day = 'light'
28
+ # Night theme
29
+ # config.theme_night = 'dark'
30
+
31
+ # Beginning of daytime
32
+ # config.theme_day_time = '6:00 am'
33
+ # Beginning of nighttime
34
+ # config.theme_night_time = '6:00 pm'
35
+ end
@@ -1,9 +1,9 @@
1
- import MygActionButton from 'myg-action-button';
2
-
3
- ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach( (event) => {
4
- document.removeEventListener( event, init );
5
- document.addEventListener( event, init );
6
- })
7
- function init() {
8
- const mygActionButton = MygActionButton.init( document.querySelector('.myg-action-button'), {} );
9
- }
1
+ import MygActionButton from 'myg-action-button';
2
+
3
+ ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach((event) => {
4
+ document.removeEventListener(event, init);
5
+ document.addEventListener(event, init);
6
+ });
7
+ function init() {
8
+ const mygActionButton = MygActionButton.init(document.querySelector('.myg-action-button'), {});
9
+ }
@@ -1,9 +1,9 @@
1
- import MygButton from 'myg-button';
2
-
3
- ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach( (event) => {
4
- document.removeEventListener( event, init );
5
- document.addEventListener( event, init );
6
- })
7
- function init() {
8
- const mygButtons = MygButton.initAll( document.querySelectorAll('.myg-button'), {} );
9
- }
1
+ import MygButton from 'myg-button';
2
+
3
+ ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach((event) => {
4
+ document.removeEventListener(event, init);
5
+ document.addEventListener(event, init);
6
+ });
7
+ function init() {
8
+ const mygButtons = MygButton.initAll(document.querySelectorAll('.myg-button'), {});
9
+ }
@@ -1,9 +1,9 @@
1
- import MygCard from 'myg-card';
2
-
3
- ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach( (event) => {
4
- document.removeEventListener( event, init );
5
- document.addEventListener( event, init );
6
- })
7
- function init() {
8
- const mygCards = MygCard.initAll( document.querySelectorAll('.myg-card'), {} );
9
- }
1
+ import MygCard from 'myg-card';
2
+
3
+ ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach((event) => {
4
+ document.removeEventListener(event, init);
5
+ document.addEventListener(event, init);
6
+ });
7
+ function init() {
8
+ const mygCards = MygCard.initAll(document.querySelectorAll('.myg-card'), {});
9
+ }
@@ -1,9 +1,9 @@
1
- import MygCheckbox from 'myg-checkbox';
2
-
3
- ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach( (event) => {
4
- document.removeEventListener( event, init );
5
- document.addEventListener( event, init );
6
- })
7
- function init() {
8
- const mygCheckboxes = MygCheckbox.initAll( document.querySelectorAll('.myg-checkbox'), {} );
9
- }
1
+ import MygCheckbox from 'myg-checkbox';
2
+
3
+ ['turbolinks:load', 'modalist:render', 'myg-tabs:render'].forEach((event) => {
4
+ document.removeEventListener(event, init);
5
+ document.addEventListener(event, init);
6
+ });
7
+ function init() {
8
+ const mygCheckboxes = MygCheckbox.initAll(document.querySelectorAll('.myg-checkbox'), {});
9
+ }