semantic_ui_views_generator 0.0.1

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.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +69 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +9 -0
  5. data/Gemfile.lock +89 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +102 -0
  8. data/Rakefile +10 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/generators/semantic/install_generator.rb +67 -0
  12. data/lib/generators/semantic/templates/initializers/simple_form.rb +223 -0
  13. data/lib/generators/semantic/templates/layouts/application.html.erb.tt +36 -0
  14. data/lib/generators/semantic/templates/layouts/application.html.haml.tt +31 -0
  15. data/lib/generators/semantic/templates/layouts/application.html.slim.tt +33 -0
  16. data/lib/generators/semantic/templates/scaffolds/erb/_form.html.erb +21 -0
  17. data/lib/generators/semantic/templates/scaffolds/erb/edit.html.erb.tt +10 -0
  18. data/lib/generators/semantic/templates/scaffolds/erb/index.html.erb.tt +34 -0
  19. data/lib/generators/semantic/templates/scaffolds/erb/new.html.erb.tt +9 -0
  20. data/lib/generators/semantic/templates/scaffolds/erb/show.html.erb.tt +15 -0
  21. data/lib/generators/semantic/templates/scaffolds/haml/_form.html.haml +14 -0
  22. data/lib/generators/semantic/templates/scaffolds/haml/edit.html.haml.tt +10 -0
  23. data/lib/generators/semantic/templates/scaffolds/haml/index.html.haml.tt +27 -0
  24. data/lib/generators/semantic/templates/scaffolds/haml/new.html.haml.tt +9 -0
  25. data/lib/generators/semantic/templates/scaffolds/haml/show.html.haml.tt +15 -0
  26. data/lib/generators/semantic/templates/scaffolds/slim/_form.html.slim +14 -0
  27. data/lib/generators/semantic/templates/scaffolds/slim/edit.html.slim.tt +10 -0
  28. data/lib/generators/semantic/templates/scaffolds/slim/index.html.slim.tt +27 -0
  29. data/lib/generators/semantic/templates/scaffolds/slim/new.html.slim.tt +9 -0
  30. data/lib/generators/semantic/templates/scaffolds/slim/show.html.slim.tt +15 -0
  31. data/lib/generators/semantic/templates/shared/_messages.html.erb +12 -0
  32. data/lib/generators/semantic/templates/shared/_pagination.html.erb +7 -0
  33. data/lib/generators/semantic/templates/shared/_pagination.html.haml +4 -0
  34. data/lib/generators/semantic/templates/shared/_pagination.html.slim +4 -0
  35. data/lib/generators/semantic/templates/simple_form/_form.html.erb +18 -0
  36. data/lib/generators/semantic/templates/simple_form/_form.html.haml +13 -0
  37. data/lib/generators/semantic/templates/simple_form/_form.html.slim +14 -0
  38. data/lib/semantic_ui_views_generator.rb +6 -0
  39. data/lib/semantic_ui_views_generator/version.rb +3 -0
  40. data/semantic_ui_views_generator.gemspec +39 -0
  41. metadata +141 -0
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta content="IE=Edge" http-equiv="X-UA-Compatible" />
6
+ <meta content="width=device-width, initial-scale=1.0" name="viewport" />
7
+ <%- if options[:metatags] %>
8
+ <%%= display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>' %>
9
+ <%- else -%>
10
+ <title>Semantic UI template</title>
11
+ <% end -%>
12
+ <%%= csrf_meta_tags %>
13
+ <%%= csp_meta_tag %>
14
+ <%- if options[:skip_turbolinks] -%>
15
+ <%%= stylesheet_link_tag 'application', media: 'all' %>
16
+ <%%= javascript_include_tag 'application' %>
17
+ <%- else -%>
18
+ <%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
19
+ <%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
20
+ <%- end -%>
21
+ <!--IE Polyfill for CSS Elements-->
22
+ <!--HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries-->
23
+ <!--[if lt IE 9]>
24
+ <%%= javascript_include_tag "https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js", "https://oss.maxcdn.com/respond/1.4.2/respond.min.js" %>
25
+ <![endif]-->
26
+ <!--[if lte IE 8]>
27
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ie8/0.8.0/ie8.js"></script>
28
+ <![endif]-->
29
+ </head>
30
+ <body>
31
+ <div class="ui main container">
32
+ <%%= render 'shared/messages' %>
33
+ <%%= yield %>
34
+ </div>
35
+ </body>
36
+ </html>
@@ -0,0 +1,31 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
+ %meta{charset: "utf-8"}/
6
+ %meta{content: "IE=Edge", "http-equiv" => "X-UA-Compatible"}/
7
+ %meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
8
+ <%- if options[:metatags] %>
9
+ = display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>'
10
+ <% else %>
11
+ title Semantic UI template
12
+ <% end %>
13
+ = csrf_meta_tags
14
+ = csp_meta_tag
15
+ <%- if options[:skip_turbolinks] -%>
16
+ = stylesheet_link_tag 'application', media: 'all'
17
+ = javascript_include_tag 'application'
18
+ <%- else -%>
19
+ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
20
+ = javascript_include_tag 'application', 'data-turbolinks-track' => true
21
+ <%- end -%>
22
+ / IE Polyfill for CSS Elements
23
+ / HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries
24
+ /[if lt IE 9]
25
+ <haml_loud> javascript_include_tag &quot;https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js&quot;, &quot;https://oss.maxcdn.com/respond/1.4.2/respond.min.js&quot; </haml_loud>
26
+ /[if lte IE 8]
27
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ie8/0.8.0/ie8.js"></script>
28
+ %body
29
+ .ui.main.container
30
+ = render 'shared/messages'
31
+ = yield
@@ -0,0 +1,33 @@
1
+ doctype html
2
+ html
3
+ head
4
+ meta charset="utf-8"
5
+ meta content="IE=Edge" http-equiv="X-UA-Compatible"
6
+ meta content="width=device-width, initial-scale=1.0" name="viewport"
7
+ <%- if options[:metatags] %>
8
+ = display_meta_tags site: '<%= Rails.application.class.parent.to_s.titleize %>'
9
+ <% else %>
10
+ title Semantic UI template
11
+ <% end %>
12
+ = csrf_meta_tags
13
+ = csp_meta_tag
14
+ <%- if options[:skip_turbolinks] -%>
15
+ = stylesheet_link_tag 'application', media: 'all'
16
+ = javascript_include_tag 'application'
17
+ <%- else -%>
18
+ = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
19
+ = javascript_include_tag 'application', 'data-turbolinks-track' => true
20
+ <%- end -%>
21
+ /! IE Polyfill for CSS Elements
22
+ /! HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries
23
+ /[if lt IE 9]
24
+ script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"
25
+ script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"
26
+ /[if lte IE 8]
27
+ // a library PolyFill for earlier IE Versions
28
+ // https://github.com/WebReflection/ie8
29
+ script src="https://cdnjs.cloudflare.com/ajax/libs/ie8/0.8.0/ie8.js"
30
+ body
31
+ .ui.main.container
32
+ = render 'shared/messages'
33
+ = yield
@@ -0,0 +1,21 @@
1
+ <%%= form_with(model: @<%= singular_table_name %>, local: true, class: 'ui form') do |f| %>
2
+ <%% if @<%= singular_table_name %>.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
5
+ <ul>
6
+ <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
7
+ <li><%%= message %></li>
8
+ <%% end %>
9
+ </ul>
10
+ </div>
11
+ <%% end %>
12
+ <% attributes.each do |attribute| -%>
13
+ <div class="field">
14
+ <%%= f.label :<%= attribute.name %> %>
15
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
16
+ </div>
17
+ <% end -%>
18
+ <div class="actions">
19
+ <%%= f.submit class: 'ui button' %>
20
+ </div>
21
+ <%% end %>
@@ -0,0 +1,10 @@
1
+ <%- if options[:metatags] -%>
2
+ <h3 class="ui header"><%%%= title('Editing <%%= singular_table_name.titleize %>') %></h3>
3
+ <%- else -%>
4
+ <h3 class="ui header">Editing <%%= singular_table_name.titleize %></h3>
5
+ <%- end -%>
6
+
7
+ <%%%= render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %> %>
8
+
9
+ <%%%= link_to 'Show', @<%%= singular_table_name %> %> |
10
+ <%%%= link_to 'Back', <%%= index_helper %>_path %>
@@ -0,0 +1,34 @@
1
+ <%- if options[:metatags] -%>
2
+ <h3 class="ui header"><%%%= title('<%%= plural_table_name.titleize %>') %></h3>
3
+ <%- else -%>
4
+ <h3 class="ui header"><%%= plural_table_name.titleize %></h3>
5
+ <%- end -%>
6
+
7
+ <table class="ui celled table">
8
+ <thead>
9
+ <tr>
10
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
11
+ <th><%%= attribute.human_name %></th>
12
+ <%% end -%>
13
+ <th colspan="3"></th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <%%% @<%%= plural_table_name %>.each do |<%%= singular_table_name %>| %>
18
+ <tr>
19
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
20
+ <td><%%%= <%%= singular_table_name %>.<%%= attribute.column_name %> %></td>
21
+ <%% end -%>
22
+ <td><%%%= link_to 'Show', <%%= model_resource_name %> %></td>
23
+ <td><%%%= link_to 'Edit', edit_<%%= singular_route_name %>_path(<%%= singular_table_name %>) %></td>
24
+ <td><%%%= link_to 'Destroy', <%%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' } %></td>
25
+ </tr>
26
+ <%%% end %>
27
+ </tbody>
28
+ </table>
29
+
30
+ <% if options[:pagination] -%>
31
+ <%%%= render 'shared/pagination' %>
32
+ <% end -%>
33
+ <br>
34
+ <%%%= link_to 'New <%%= singular_table_name.titleize %>', new_<%%= singular_route_name %>_path %>
@@ -0,0 +1,9 @@
1
+ <%- if options[:metatags] -%>
2
+ <h3 class="ui header"><%%%= title('New <%%= singular_table_name.titleize %>') %></h3>
3
+ <%- else -%>
4
+ <h3 class="ui header">New <%%= singular_table_name.titleize %></h3>
5
+ <%- end -%>
6
+
7
+ <%%%= render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %> %>
8
+
9
+ <%%%= link_to 'Back', <%%= index_helper %>_path %>
@@ -0,0 +1,15 @@
1
+ <%- if options[:metatags] -%>
2
+ <h3 class="ui header"><%%%= title('<%%= singular_table_name.titleize %>') %></h3>
3
+ <%- else -%>
4
+ <h3 class="ui header">Show <%%= singular_table_name.titleize %></h3>
5
+ <%- end -%>
6
+
7
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
8
+ <p>
9
+ <strong><%%= attribute.human_name %>:</strong>
10
+ <%%%= @<%%= singular_table_name %>.<%%= attribute.name %> %>
11
+ </p>
12
+ <%% end -%>
13
+
14
+ <%%%= link_to 'Edit', edit_<%%= singular_table_name %>_path(@<%%= singular_table_name %>) %> |
15
+ <%%%= link_to 'Back', <%%= index_helper %>_path %>
@@ -0,0 +1,14 @@
1
+ = form_with(model: @<%= singular_table_name %>, local: true, class: 'ui form') do |f|
2
+ - if @<%= singular_table_name %>.errors.any?
3
+ #error_explanation
4
+ %h2= "#{pluralize(@<%= singular_table_name %>.errors.count, 'error')} prohibited this <%= singular_table_name %> from being saved:"
5
+ %ul
6
+ - <%= singular_table_name %>.errors.full_messages.each do |message|
7
+ %li= message
8
+ <% attributes.each do |attribute| -%>
9
+ .field
10
+ = f.label :<%= attribute.name %>
11
+ = f.<%= attribute.field_type %> :<%= attribute.name %>
12
+ <% end -%>
13
+ .actions
14
+ = f.submit class: 'ui button'
@@ -0,0 +1,10 @@
1
+ <%- if options[:metatags] -%>
2
+ %h3.ui.header= title('Editing<%%= singular_table_name.titleize %>')
3
+ <%- else -%>
4
+ %h3.ui.header Editing<%%= singular_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ = render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %>
8
+ = link_to 'Show', @<%%= singular_table_name %>
9
+ |
10
+ = link_to 'Back', <%%= index_helper %>_path
@@ -0,0 +1,27 @@
1
+ <%- if options[:metatags] -%>
2
+ %h3.ui.header= title('<%%= plural_table_name.titleize %>')
3
+ <%- else -%>
4
+ %h3.ui.header <%%= plural_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ %table.ui.celled.table
8
+ %thead
9
+ %tr
10
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
11
+ %th{scope: "col"} <%%= attribute.human_name %>
12
+ <%% end -%>
13
+ %th{colspan: "3"}
14
+ %tbody
15
+ - @<%%= plural_table_name %>.each do |<%%= singular_table_name %>|
16
+ %tr
17
+ <%% attributes.each do |attribute| -%>
18
+ %td= <%%= singular_table_name %>.<%%= attribute.name %>
19
+ <%% end -%>
20
+ %td= link_to 'Show', <%%= singular_table_name %>
21
+ %td= link_to 'Edit', edit_<%%= singular_table_name %>_path(<%%= singular_table_name %>)
22
+ %td= link_to 'Destroy', <%%= singular_table_name %>, data: { confirm: 'Are you sure?' }, method: :delete
23
+ <% if options[:pagination] -%>
24
+ = render 'shared/pagination'
25
+ <% end -%>
26
+ %br
27
+ = link_to 'New <%%= singular_table_name.titleize %>', new_<%%= singular_route_name %>_path
@@ -0,0 +1,9 @@
1
+ <%- if options[:metatags] -%>
2
+ %h3.ui.header= title('New <%%= singular_table_name.titleize %>')
3
+ <%- else -%>
4
+ %h3.ui.header New<%%= singular_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ = render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %>
8
+
9
+ = link_to 'Back', <%%= index_helper %>_path
@@ -0,0 +1,15 @@
1
+ <%- if options[:metatags] -%>
2
+ %h3.ui.header= title('Show <%%= singular_table_name.titleize %>')
3
+ <%- else -%>
4
+ %h3.ui.header Show <%%= singular_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
8
+ %p
9
+ %strong <%%= attribute.human_name %>:&nbsp;
10
+ = @<%%= singular_table_name %>.<%%= attribute.name %>
11
+ <%% end -%>
12
+
13
+ = link_to 'Edit', edit_<%%= singular_table_name %>_path(@<%%= singular_table_name %>)
14
+ |
15
+ = link_to 'Back', <%%= index_helper %>_path
@@ -0,0 +1,14 @@
1
+ = form_with(model: @<%= singular_table_name %>, local: true, class: 'ui form') do |f|
2
+ - if @<%= singular_table_name %>.errors.any?
3
+ #error_explanation
4
+ h2 = "#{pluralize(@<%= singular_table_name %>.errors.count, 'error')} prohibited this <%= singular_table_name %> from being saved:"
5
+ ul
6
+ - <%= singular_table_name %>.errors.full_messages.each do |message|
7
+ li = message
8
+ <% attributes.each do |attribute| -%>
9
+ .field
10
+ = f.label :<%= attribute.name %>
11
+ = f.<%= attribute.field_type %> :<%= attribute.name %>
12
+ <% end -%>
13
+ .actions
14
+ = f.submit class: 'ui button'
@@ -0,0 +1,10 @@
1
+ <%- if options[:metatags] -%>
2
+ h3.ui.header = title('Editing<%%= singular_table_name.titleize %>')
3
+ <%- else -%>
4
+ h3.ui.header Editing<%%= singular_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ = render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %>
8
+ = link_to 'Show', @<%%= singular_table_name %>
9
+ '&nbsp;|
10
+ = link_to 'Back', <%%= index_helper %>_path
@@ -0,0 +1,27 @@
1
+ <%- if options[:metatags] -%>
2
+ h3.ui.header = title('<%%= plural_table_name.titleize %>')
3
+ <%- else -%>
4
+ h3.ui.header <%%= plural_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ table.ui.celled.table
8
+ thead
9
+ tr
10
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
11
+ th scope="col" <%%= attribute.human_name %>
12
+ <%% end -%>
13
+ th colspan="3"
14
+ tbody
15
+ - @<%%= plural_table_name %>.each do |<%%= singular_table_name %>|
16
+ tr
17
+ <%% attributes.each do |attribute| -%>
18
+ td = <%%= singular_table_name %>.<%%= attribute.name %>
19
+ <%% end -%>
20
+ td = link_to 'Show', <%%= singular_table_name %>
21
+ td = link_to 'Edit', edit_<%%= singular_table_name %>_path(<%%= singular_table_name %>)
22
+ td = link_to 'Destroy', <%%= singular_table_name %>, data: { confirm: 'Are you sure?' }, method: :delete
23
+ <% if options[:pagination] -%>
24
+ = render 'shared/pagination'
25
+ <% end -%>
26
+ br
27
+ = link_to 'New <%%= singular_table_name.titleize %>', new_<%%= singular_route_name %>_path
@@ -0,0 +1,9 @@
1
+ <%- if options[:metatags] -%>
2
+ h3.ui.header = title('New <%%= singular_table_name.titleize %>')
3
+ <%- else -%>
4
+ h3.ui.header New<%%= singular_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ = render 'form', <%%= singular_table_name %>: @<%%= singular_table_name %>
8
+
9
+ = link_to 'Back', <%%= index_helper %>_path
@@ -0,0 +1,15 @@
1
+ <%- if options[:metatags] -%>
2
+ h3.ui.header = title('Show <%%= singular_table_name.titleize %>')
3
+ <%- else -%>
4
+ h3.ui.header Show <%%= singular_table_name.titleize %>
5
+ <%- end -%>
6
+
7
+ <%% attributes.reject(&:password_digest?).each do |attribute| -%>
8
+ p
9
+ strong <%%= attribute.human_name %>:&nbsp;
10
+ = @<%%= singular_table_name %>.<%%= attribute.name %>
11
+ <%% end -%>
12
+
13
+ = link_to 'Edit', edit_<%%= singular_table_name %>_path(@<%%= singular_table_name %>)
14
+ '&nbsp;|
15
+ = link_to 'Back', <%%= index_helper %>_path
@@ -0,0 +1,12 @@
1
+ <% if flash.any? %>
2
+ <% flash.each do | msg_type, message | %>
3
+ <% flash.delete(:timedout) %>
4
+ <%- next unless !message.nil? && message.to_s.length.positive? %>
5
+ <div class="ui <%= flash_class(msg_type) %> message transition">
6
+ <i class="close icon"></i>
7
+ <div class="header">
8
+ <%= message %>
9
+ </div>
10
+ </div>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%- if !@pagy.nil? && @pagy.pages > 1 %>
2
+ <div class="ui one column stackable center aligned page grid">
3
+ <div class="column twelve wide">
4
+ <%== pagy_semantic_nav(@pagy) %>
5
+ </div>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,4 @@
1
+ - if !@pagy.nil? && @pagy.pages > 1
2
+ .ui.one.column.stackable.center.aligned.page.grid
3
+ .column.twelve.wide
4
+ = pagy_semantic_nav(@pagy).html_safe
@@ -0,0 +1,4 @@
1
+ - if !@pagy.nil? && @pagy.pages > 1
2
+ .ui.one.column.stackable.center.aligned.page.grid
3
+ .column.twelve.wide
4
+ == pagy_semantic_nav(@pagy)
@@ -0,0 +1,18 @@
1
+ <%%= simple_form_for(@<%= singular_table_name %>, class: "ui form") do |f| %>
2
+ <%% if @<%= singular_table_name %>.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
5
+ <ul>
6
+ <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
7
+ <li><%%= message %></li>
8
+ <%% end %>
9
+ </ul>
10
+ </div>
11
+ <%% end %>
12
+ <%- attributes.each do |attribute| -%>
13
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
14
+ <%- end -%>
15
+ <div class="actions">
16
+ <%%= f.button :submit, class: 'ui button' %>
17
+ </div>
18
+ <%% end %>
@@ -0,0 +1,13 @@
1
+ = simple_form_for(@<%= singular_table_name %>, class: "ui form") do |f|
2
+ - if @<%= singular_table_name %>.errors.any? %>
3
+ #error_explanation"
4
+ %h2
5
+ = pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:
6
+ %ul
7
+ - <%= singular_table_name %>.errors.full_messages.each do |message|
8
+ %li= message
9
+ <%- attributes.each do |attribute| -%>
10
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
11
+ <%- end -%>
12
+ .actions
13
+ = f.button :submit, class: 'ui button'