rails_layout 1.0.29 → 1.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.textile +4 -0
- data/README.textile +18 -2
- data/lib/generators/layout/install/install_generator.rb +22 -0
- data/lib/generators/layout/install/templates/bootstrap3-messages.html.erb +1 -1
- data/lib/generators/layout/install/templates/bootstrap3-messages.html.haml +1 -1
- data/lib/generators/layout/install/templates/bootstrap3-messages.html.slim +1 -1
- data/lib/generators/layout/install/templates/bootstrap4-application.html.erb +20 -0
- data/lib/generators/layout/install/templates/bootstrap4-application.html.haml +15 -0
- data/lib/generators/layout/install/templates/bootstrap4-application.html.slim +16 -0
- data/lib/generators/layout/install/templates/bootstrap4-forms.css.scss +36 -0
- data/lib/generators/layout/install/templates/bootstrap4-messages.html.erb +9 -0
- data/lib/generators/layout/install/templates/bootstrap4-messages.html.haml +6 -0
- data/lib/generators/layout/install/templates/bootstrap4-messages.html.slim +6 -0
- data/lib/generators/layout/install/templates/bootstrap4-navigation.html.erb +18 -0
- data/lib/generators/layout/install/templates/bootstrap4-navigation.html.haml +10 -0
- data/lib/generators/layout/install/templates/bootstrap4-navigation.html.slim +11 -0
- data/lib/generators/layout/install/templates/bootstrap4_and_overrides.css.scss +45 -0
- data/lib/generators/layout/navigation/navigation_generator.rb +73 -0
- data/lib/rails_layout/version.rb +1 -1
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f21c2a60c00dc216f735e4d41816cef36680cd53
|
4
|
+
data.tar.gz: 9c4863ea26a9f464790a40820927f589b899543f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbfc011348bbfd0f2c281392f0a6c7803f6fa14a70185aef2674e352dd352369381663fefddb43e644a80c6844819104079473e7c436d9c355982a3d421f1287
|
7
|
+
data.tar.gz: 9c727bb16379730aa9653146c9209b351d1e799ffb4376b03c90e5059e6eb1bd1c2ddd6de68aaf1d910335e56dad1d3e201f2dc57f966070b65c7fa872ce1441
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.1
|
data/CHANGELOG.textile
CHANGED
data/README.textile
CHANGED
@@ -3,6 +3,7 @@ h1. !http://railsapps.github.io/images/rails-36x36.jpg(RailsLayout Gem)! RailsLa
|
|
3
3
|
Use this gem to set up layout files for your choice of front-end framework:
|
4
4
|
|
5
5
|
* Zurb Foundation 5.3
|
6
|
+
* Bootstrap 4.0
|
6
7
|
* Bootstrap 3.3
|
7
8
|
|
8
9
|
It also will set up "Devise":https://github.com/plataformatec/devise views with styling for Bootstrap or Foundation.
|
@@ -27,6 +28,7 @@ h4. Generate Application Layout, Navigation, and Flash Message Files
|
|
27
28
|
|
28
29
|
* @$ rails generate layout:install foundation5@
|
29
30
|
* @$ rails generate layout:install foundation4@
|
31
|
+
* @$ rails generate layout:install bootstrap4@
|
30
32
|
* @$ rails generate layout:install bootstrap3@
|
31
33
|
* @$ rails generate layout:install bootstrap2@
|
32
34
|
* @$ rails generate layout:install simple@
|
@@ -35,6 +37,7 @@ h4. Generate Application Layout, Navigation, and Flash Message Files
|
|
35
37
|
h4. Add Links to the Navigation File
|
36
38
|
|
37
39
|
* @$ rails generate layout:navigation@
|
40
|
+
* @$ rails generate layout:navigation bootstrap4@
|
38
41
|
|
39
42
|
h4. Generate Devise Views
|
40
43
|
|
@@ -67,6 +70,12 @@ gem 'compass-rails'
|
|
67
70
|
gem 'zurb-foundation'
|
68
71
|
</pre>
|
69
72
|
|
73
|
+
h4. Bootstrap 4.0
|
74
|
+
|
75
|
+
<pre>
|
76
|
+
gem 'bootstrap', '~> 4.0.0.alpha3.1'
|
77
|
+
</pre>
|
78
|
+
|
70
79
|
h4. Bootstrap 3.3
|
71
80
|
|
72
81
|
<pre>
|
@@ -142,6 +151,7 @@ You can generate layout files suitable for use with the following front-end fram
|
|
142
151
|
|
143
152
|
* @foundation5@ - Zurb Foundation 5.3
|
144
153
|
* @foundation4@ - Zurb Foundation 4.0
|
154
|
+
* @bootstrap4@ - Bootstrap 4.0
|
145
155
|
* @bootstrap3@ - Bootstrap 3.3
|
146
156
|
* @bootstrap2@ - Bootstrap 2.3
|
147
157
|
* @simple@ - simple layout
|
@@ -168,7 +178,7 @@ h4. Note About the Navigation Partials
|
|
168
178
|
|
169
179
|
The *_navigation.html.erb* file contains framework-specific styling. Separating the files makes it easy to change the front-end framework without disturbing the links.
|
170
180
|
|
171
|
-
The *_navigation_links.html.erb* file is only a list of links. You can add additional links to this file as needed. It contains no framework-specific styling.
|
181
|
+
The *_navigation_links.html.erb* file is only a list of links. You can add additional links to this file as needed. It contains no framework-specific styling (except if you are using Bootstrap 4).
|
172
182
|
|
173
183
|
The *_nav_links_for_auth.html.erb* file is created if Devise or OmniAuth is installed.
|
174
184
|
|
@@ -265,7 +275,13 @@ and modify the file:
|
|
265
275
|
|
266
276
|
* "app/assets/javascripts/application.js":https://github.com/RailsApps/rails_layout/blob/master/lib/generators/layout/install/templates/foundation4-application.js
|
267
277
|
|
268
|
-
h3. Bootstrap 3.3 Layout
|
278
|
+
h3. Bootstrap 3.3 or 4.0 Layout
|
279
|
+
|
280
|
+
To create layout files for use with Bootstrap 4.0:
|
281
|
+
|
282
|
+
<pre>
|
283
|
+
$ rails generate layout:install bootstrap4
|
284
|
+
</pre>
|
269
285
|
|
270
286
|
To create layout files for use with Bootstrap 3.3:
|
271
287
|
|
@@ -37,6 +37,11 @@ module Layout
|
|
37
37
|
copy_file 'bootstrap-application.js', 'app/assets/javascripts/application.js'
|
38
38
|
remove_file 'app/assets/stylesheets/simple.css'
|
39
39
|
remove_file 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
40
|
+
when 'bootstrap4'
|
41
|
+
copy_file 'bootstrap4_and_overrides.css.scss', 'app/assets/stylesheets/1st_load_framework.css.scss'
|
42
|
+
copy_file 'bootstrap-application.js', 'app/assets/javascripts/application.js'
|
43
|
+
remove_file 'app/assets/stylesheets/simple.css'
|
44
|
+
remove_file 'app/assets/stylesheets/foundation_and_overrides.css.scss'
|
40
45
|
when 'foundation4'
|
41
46
|
copy_file 'foundation4_and_overrides.css.scss', 'app/assets/stylesheets/1st_load_framework.css.scss'
|
42
47
|
copy_file 'foundation4-application.js', 'app/assets/javascripts/application.js'
|
@@ -66,6 +71,8 @@ module Layout
|
|
66
71
|
# TODO
|
67
72
|
when 'bootstrap3'
|
68
73
|
append_file 'app/assets/stylesheets/1st_load_framework.css.scss', File.read("#{dir}/bootstrap3-forms.css.scss")
|
74
|
+
when 'bootstrap4'
|
75
|
+
append_file 'app/assets/stylesheets/1st_load_framework.css.scss', File.read("#{dir}/bootstrap4-forms.css.scss")
|
69
76
|
when 'foundation4'
|
70
77
|
# TODO
|
71
78
|
when 'foundation5'
|
@@ -94,8 +101,23 @@ module Layout
|
|
94
101
|
end
|
95
102
|
end
|
96
103
|
|
104
|
+
# Add navigation links
|
105
|
+
def add_navigation_links_for_bootstrap4
|
106
|
+
return unless framework_name == 'bootstrap4'
|
107
|
+
app = ::Rails.application
|
108
|
+
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
109
|
+
unless framework_name == 'none'
|
110
|
+
# ABOUT
|
111
|
+
append_file 'app/views/layouts/_navigation_links.html.erb', "<li class='nav-item'><%= link_to 'About', page_path('about'), class: 'nav-link' %></li>\n" if File.exists?("app/views/pages/about.html.#{ext}")
|
112
|
+
# CONTACT
|
113
|
+
append_file 'app/views/layouts/_navigation_links.html.erb', "<li class='nav-item'><%= link_to 'Contact', new_contact_path, class: 'nav-link' %></li>
|
114
|
+
\n" if File.exists?("app/views/contacts/new.html.#{ext}")
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
97
118
|
# Add navigation links
|
98
119
|
def add_navigation_links
|
120
|
+
return if framework_name == 'bootstrap4'
|
99
121
|
app = ::Rails.application
|
100
122
|
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
101
123
|
unless framework_name == 'none'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%# Rails flash messages styled for Bootstrap 3.0 %>
|
2
2
|
<% flash.each do |name, msg| %>
|
3
3
|
<% if msg.is_a?(String) %>
|
4
|
-
<div class="alert alert-<%= name.to_s == 'notice' ? 'success' : 'danger' %>">
|
4
|
+
<div class="alert alert-dismissible alert-<%= name.to_s == 'notice' ? 'success' : 'danger' %>">
|
5
5
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
6
6
|
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
7
7
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-# Rails flash messages styled for Bootstrap 3.0
|
2
2
|
- flash.each do |name, msg|
|
3
3
|
- if msg.is_a?(String)
|
4
|
-
%div{:class => "alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"}
|
4
|
+
%div{:class => "alert alert-dismissible alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"}
|
5
5
|
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
6
6
|
= content_tag :div, msg, :id => "flash_#{name}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/ Rails flash messages styled for Bootstrap 3.0
|
2
2
|
- flash.each do |name, msg|
|
3
3
|
- if msg.is_a?(String)
|
4
|
-
div class="alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"
|
4
|
+
div class="alert alert-dismissible alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"
|
5
5
|
button.close[type="button" data-dismiss="alert" aria-hidden="true"] ×
|
6
6
|
= content_tag :div, msg, :id => "flash_#{name}"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title><%%= content_for?(:title) ? yield(:title) : "<%= app_name.underscore.titleize %>" %></title>
|
6
|
+
<meta name="description" content="<%%= content_for?(:description) ? yield(:description) : "<%= app_name.underscore.titleize %>" %>">
|
7
|
+
<%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
8
|
+
<%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
9
|
+
<%%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<header>
|
13
|
+
<%%= render 'layouts/navigation' %>
|
14
|
+
</header>
|
15
|
+
<main role="main">
|
16
|
+
<%%= render 'layouts/messages' %>
|
17
|
+
<%%= yield %>
|
18
|
+
</main>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
|
5
|
+
%title= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
6
|
+
%meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"}
|
7
|
+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
8
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
9
|
+
= csrf_meta_tags
|
10
|
+
%body
|
11
|
+
%header
|
12
|
+
= render 'layouts/navigation'
|
13
|
+
%main{:role => "main"}
|
14
|
+
= render 'layouts/messages'
|
15
|
+
= yield
|
@@ -0,0 +1,16 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta[name="viewport" content="width=device-width, initial-scale=1.0"]
|
5
|
+
title
|
6
|
+
= content_for?(:title) ? yield(:title) : '<%= app_name.underscore.titleize %>'
|
7
|
+
meta name="description" content="#{content_for?(:description) ? yield(:description) : '<%= app_name.underscore.titleize %>'}"
|
8
|
+
== stylesheet_link_tag "application", :media => 'all', 'data-turbolinks-track' => true
|
9
|
+
== javascript_include_tag 'application', 'data-turbolinks-track' => true
|
10
|
+
== csrf_meta_tags
|
11
|
+
body
|
12
|
+
header
|
13
|
+
== render 'layouts/navigation'
|
14
|
+
main[role="main"]
|
15
|
+
== render 'layouts/messages'
|
16
|
+
== yield
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
// Styles for form views
|
3
|
+
// using Bootstrap
|
4
|
+
// generated by the rails_layout gem
|
5
|
+
.authform {
|
6
|
+
padding-top: 30px;
|
7
|
+
max-width: 320px;
|
8
|
+
margin: 0 auto;
|
9
|
+
}
|
10
|
+
.authform form {
|
11
|
+
@extend .well;
|
12
|
+
@extend .well-lg;
|
13
|
+
padding-bottom: 40px;
|
14
|
+
}
|
15
|
+
.authform .right {
|
16
|
+
float: right !important;
|
17
|
+
}
|
18
|
+
.authform .button {
|
19
|
+
@extend .btn;
|
20
|
+
@extend .btn-primary;
|
21
|
+
}
|
22
|
+
.authform fieldset {
|
23
|
+
@extend .well;
|
24
|
+
}
|
25
|
+
#error_explanation:not(:empty) {
|
26
|
+
@extend .alert;
|
27
|
+
@extend .alert-danger;
|
28
|
+
}
|
29
|
+
#error_explanation h2 {
|
30
|
+
font-size: 16px;
|
31
|
+
}
|
32
|
+
.button-xs {
|
33
|
+
@extend .btn;
|
34
|
+
@extend .btn-primary;
|
35
|
+
@extend .btn-xs;
|
36
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%# Rails flash messages styled for Bootstrap 4.0 %>
|
2
|
+
<% flash.each do |name, msg| %>
|
3
|
+
<% if msg.is_a?(String) %>
|
4
|
+
<div class="alert alert-<%= name.to_s == 'notice' ? 'success' : 'danger' %>" role="alert">
|
5
|
+
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
6
|
+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
-# Rails flash messages styled for Bootstrap 4.0
|
2
|
+
- flash.each do |name, msg|
|
3
|
+
- if msg.is_a?(String)
|
4
|
+
%div{:class => "alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}", :role => "alert"}
|
5
|
+
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
|
6
|
+
= content_tag :div, msg, :id => "flash_#{name}"
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/ Rails flash messages styled for Bootstrap 4.0
|
2
|
+
- flash.each do |name, msg|
|
3
|
+
- if msg.is_a?(String)
|
4
|
+
div class="alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"
|
5
|
+
button.close[type="button" data-dismiss="alert" aria-hidden="true"] ×
|
6
|
+
= content_tag :div, msg, :id => "flash_#{name}"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%# navigation styled for Bootstrap 4.0 %>
|
2
|
+
<div class="container">
|
3
|
+
<nav class="navbar navbar-dark bg-inverse">
|
4
|
+
<ul class="nav navbar-nav clearfix">
|
5
|
+
<li class="nav-item">
|
6
|
+
<button class="navbar-toggler hidden-sm-up nav-link" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar2" aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label="Toggle navigation">
|
7
|
+
☰
|
8
|
+
</button>
|
9
|
+
</li>
|
10
|
+
</ul>
|
11
|
+
<div class="collapse navbar-toggleable-xs" id="exCollapsingNavbar2">
|
12
|
+
<%= link_to "Rails bootstrap", root_path, class: 'navbar-brand' %>
|
13
|
+
<ul class="nav navbar-nav">
|
14
|
+
<%= render 'layouts/navigation_links' %>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
</nav>
|
18
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
-# navigation styled for Bootstrap 3.0
|
2
|
+
.container
|
3
|
+
%nav.navbar.navbar-dark.bg-inverse
|
4
|
+
%ul.nav.navbar-nav.clearfix
|
5
|
+
%li.nav-item
|
6
|
+
%button.navbar-toggler.hidden-sm-up.nav-link{"aria-controls" => "exCollapsingNavbar2", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#exCollapsingNavbar2", "data-toggle" => "collapse", :type => "button"}
|
7
|
+
\ ☰
|
8
|
+
#exCollapsingNavbar2.collapse.navbar-toggleable-xs
|
9
|
+
= link_to "Rails bootstrap", root_path, class: 'navbar-brand'
|
10
|
+
%ul.nav.navbar-nav= render 'layouts/navigation_links'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/ navigation styled for Bootstrap 4.0
|
2
|
+
.container
|
3
|
+
nav.navbar.navbar-dark.bg-inverse
|
4
|
+
ul.nav.navbar-nav.clearfix
|
5
|
+
li.nav-item
|
6
|
+
button.navbar-toggler.hidden-sm-up.nav-link aria-controls="exCollapsingNavbar2" aria-expanded="false" aria-label=("Toggle navigation") data-target="#exCollapsingNavbar2" data-toggle="collapse" type="button"
|
7
|
+
| ☰
|
8
|
+
#exCollapsingNavbar2.collapse.navbar-toggleable-xs
|
9
|
+
= link_to "Rails bootstrap", root_path, class: 'navbar-brand'
|
10
|
+
ul.nav.navbar-nav
|
11
|
+
= render 'layouts/navigation_links'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// import the CSS framework
|
2
|
+
// Do not use *= require in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.
|
3
|
+
@import "bootstrap";
|
4
|
+
|
5
|
+
// make all images responsive by default
|
6
|
+
img {
|
7
|
+
@extend .img-fluid;
|
8
|
+
margin: 0 auto;
|
9
|
+
}
|
10
|
+
// override for the 'Home' navigation link
|
11
|
+
.navbar-brand {
|
12
|
+
font-size: inherit;
|
13
|
+
}
|
14
|
+
|
15
|
+
// THESE ARE EXAMPLES YOU CAN MODIFY
|
16
|
+
// create your own classes
|
17
|
+
// to make views framework-neutral
|
18
|
+
.column {
|
19
|
+
@extend .col-md-6;
|
20
|
+
@extend .text-xs-center;
|
21
|
+
}
|
22
|
+
.form {
|
23
|
+
@extend .col-md-6;
|
24
|
+
}
|
25
|
+
.form-centered {
|
26
|
+
@extend .col-md-6;
|
27
|
+
@extend .text-xs-center;
|
28
|
+
}
|
29
|
+
.submit {
|
30
|
+
@extend .btn;
|
31
|
+
@extend .btn-primary;
|
32
|
+
@extend .btn-lg;
|
33
|
+
}
|
34
|
+
|
35
|
+
// apply styles to HTML elements
|
36
|
+
// to make views framework-neutral
|
37
|
+
main {
|
38
|
+
@extend .container;
|
39
|
+
margin-top: 30px; // accommodate the navbar
|
40
|
+
}
|
41
|
+
|
42
|
+
section {
|
43
|
+
@extend .row;
|
44
|
+
margin-top: 20px;
|
45
|
+
}
|
@@ -4,11 +4,84 @@ module Layout
|
|
4
4
|
module Generators
|
5
5
|
class NavigationGenerator < ::Rails::Generators::Base
|
6
6
|
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
argument :framework_name, :type => :string, :default => "simple"
|
7
8
|
|
8
9
|
desc "Adds links to a navigation bar."
|
9
10
|
|
11
|
+
# Add navigation links
|
12
|
+
def add_navigation_links_for_bootstrap4
|
13
|
+
return unless framework_name == 'bootstrap4'
|
14
|
+
app = ::Rails.application
|
15
|
+
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
16
|
+
copy_file "navigation_links.html.erb", "app/views/layouts/_navigation_links.html.erb"
|
17
|
+
# ABOUT
|
18
|
+
append_file 'app/views/layouts/_navigation_links.html.erb', "<li class='nav-item'><%= link_to 'About', page_path('about'), class: 'nav-link' %></li>\n" if File.exists?("app/views/pages/about.html.#{ext}")
|
19
|
+
# CONTACT
|
20
|
+
append_file 'app/views/layouts/_navigation_links.html.erb', "<li class='nav-item'><%= link_to 'Contact', new_contact_path, class: 'nav-link' %></li>\n" if File.exists?("app/views/contacts/new.html.#{ext}")
|
21
|
+
# DEVISE
|
22
|
+
if File.exists?('config/initializers/devise.rb')
|
23
|
+
create_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
|
24
|
+
<% if user_signed_in? %>
|
25
|
+
<li class='nav-item'><%= link_to 'Edit account', edit_user_registration_path, class: 'nav-link' %></li>
|
26
|
+
<li class='nav-item'><%= link_to 'Sign out', destroy_user_session_path, :method=>'delete', class: 'nav-link' %></li>
|
27
|
+
<% else %>
|
28
|
+
<li class='nav-item'><%= link_to 'Sign in', new_user_session_path, class: 'nav-link' %></li>
|
29
|
+
<li class='nav-item'><%= link_to 'Sign up', new_user_registration_path, class: 'nav-link' %></li>
|
30
|
+
<% end %>
|
31
|
+
LINKS
|
32
|
+
end
|
33
|
+
end
|
34
|
+
# OMNIAUTH
|
35
|
+
if File.exists?('config/initializers/omniauth.rb')
|
36
|
+
create_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
|
37
|
+
<% if user_signed_in? %>
|
38
|
+
<li class='nav-item'><%= link_to 'Sign out', signout_path, class: 'nav-link' %></li>
|
39
|
+
<% else %>
|
40
|
+
<li class='nav-item'><%= link_to 'Sign in', signin_path, class: 'nav-link' %></li>
|
41
|
+
<% end %>
|
42
|
+
LINKS
|
43
|
+
end
|
44
|
+
end
|
45
|
+
# USERS
|
46
|
+
if Dir.glob("app/views/users/index.html.{#{ext},erb}").any?
|
47
|
+
if User.column_names.include? 'role'
|
48
|
+
# suitable for role-based authorization
|
49
|
+
append_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
|
50
|
+
<% if user_signed_in? %>
|
51
|
+
<% if current_user.try(:admin?) %>
|
52
|
+
<li class='nav-item'><%= link_to 'Users', users_path, class: 'nav-link' %></li>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
55
|
+
LINKS
|
56
|
+
end
|
57
|
+
else
|
58
|
+
# suitable for simple authentication
|
59
|
+
append_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
|
60
|
+
<% if user_signed_in? %>
|
61
|
+
<li class='nav-item'><%= link_to 'Users', users_path, class: 'nav-link' %></li>
|
62
|
+
<% end %>
|
63
|
+
LINKS
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
# UPMIN (administrative dashboard)
|
68
|
+
if File.exists?('config/initializers/upmin.rb')
|
69
|
+
navlink = " <li class='nav-item'><%= link_to 'Admin', '/admin', class: 'nav-link' %></li>"
|
70
|
+
inject_into_file 'app/views/layouts/_nav_links_for_auth.html.erb', navlink + "\n", :after => "<% if current_user.try(:admin?) %>\n"
|
71
|
+
end
|
72
|
+
# ADMINSTRATE (administrative dashboard)
|
73
|
+
if File.exists?('config/railscomposer.yml')
|
74
|
+
if Rails.application.config_for(:railscomposer)['dashboard'] == 'administrate'
|
75
|
+
navlink = " <li class='nav-item'><%= link_to 'Admin', '/admin', class: 'nav-link' %></li>
|
76
|
+
"
|
77
|
+
inject_into_file 'app/views/layouts/_nav_links_for_auth.html.erb', navlink + "\n", :after => "<% if current_user.try(:admin?) %>\n"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
10
82
|
# Add navigation links
|
11
83
|
def add_navigation_links
|
84
|
+
return if framework_name == 'bootstrap4'
|
12
85
|
app = ::Rails.application
|
13
86
|
ext = app.config.generators.options[:rails][:template_engine] || :erb
|
14
87
|
copy_file "navigation_links.html.erb", "app/views/layouts/_navigation_links.html.erb"
|
data/lib/rails_layout/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_layout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kehoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,6 +85,17 @@ files:
|
|
85
85
|
- lib/generators/layout/install/templates/bootstrap3-navigation.html.haml
|
86
86
|
- lib/generators/layout/install/templates/bootstrap3-navigation.html.slim
|
87
87
|
- lib/generators/layout/install/templates/bootstrap3_and_overrides.css.scss
|
88
|
+
- lib/generators/layout/install/templates/bootstrap4-application.html.erb
|
89
|
+
- lib/generators/layout/install/templates/bootstrap4-application.html.haml
|
90
|
+
- lib/generators/layout/install/templates/bootstrap4-application.html.slim
|
91
|
+
- lib/generators/layout/install/templates/bootstrap4-forms.css.scss
|
92
|
+
- lib/generators/layout/install/templates/bootstrap4-messages.html.erb
|
93
|
+
- lib/generators/layout/install/templates/bootstrap4-messages.html.haml
|
94
|
+
- lib/generators/layout/install/templates/bootstrap4-messages.html.slim
|
95
|
+
- lib/generators/layout/install/templates/bootstrap4-navigation.html.erb
|
96
|
+
- lib/generators/layout/install/templates/bootstrap4-navigation.html.haml
|
97
|
+
- lib/generators/layout/install/templates/bootstrap4-navigation.html.slim
|
98
|
+
- lib/generators/layout/install/templates/bootstrap4_and_overrides.css.scss
|
88
99
|
- lib/generators/layout/install/templates/foundation4-application.html.erb
|
89
100
|
- lib/generators/layout/install/templates/foundation4-application.html.haml
|
90
101
|
- lib/generators/layout/install/templates/foundation4-application.html.slim
|
@@ -149,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
160
|
version: '0'
|
150
161
|
requirements: []
|
151
162
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.4
|
163
|
+
rubygems_version: 2.6.4
|
153
164
|
signing_key:
|
154
165
|
specification_version: 4
|
155
166
|
summary: Rails generator creates application layout files for Bootstrap and other
|