bootswatch_rails 3.3.7.4 → 3.3.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootswatch_rails/version.rb +1 -1
- data/lib/generators/bootswatch_rails/install/install_generator.rb +61 -21
- data/lib/generators/bootswatch_rails/install/templates/custom.html.erb +20 -0
- data/lib/generators/bootswatch_rails/install/templates/theme.html.erb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1927fd3e6076243a3153378c4d92b9dba666690
|
4
|
+
data.tar.gz: de6ab442b3893d0d8f414e41f1fe89e0061b52ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70dce1f103ef3e9defece6b1bc15abf47c9d8bf6ef1a262aa3e0483c146bfcb2bca04afad3fb1f9229680f13bd7ad578b0b223a95ef782ea8274ca8448f34454
|
7
|
+
data.tar.gz: a7fbb58a508ecf0d3dd667c7b235d3fcac4c4eb74450dede492aab6d1ae5b85314d06559604f9ed70a3285317db2b480c9f809b268a93de4a2bd908fdad40b18
|
@@ -4,7 +4,7 @@ module BootswatchRails
|
|
4
4
|
FONT_AWESOME = "4.6.2"
|
5
5
|
DATATABLES = "1.10.12"
|
6
6
|
RESPONSIVE = "2.1.0"
|
7
|
-
VERSION = "3.3.7.
|
7
|
+
VERSION = "3.3.7.5"
|
8
8
|
|
9
9
|
THEMES = [:cerulean, :cosmo, :custom, :cyborg, :darkly, :flatly, :journal, :lumen, :paper, :readable, :sandstone, :simplex, :slate, :spacelab, :superhero, :united, :yeti]
|
10
10
|
DEFAULT = 0
|
@@ -7,36 +7,70 @@ module BootswatchRails
|
|
7
7
|
class_option :ui, type: :boolean, default: false,
|
8
8
|
desc: 'Include jQuery-ui (requires jquery-ui-rails gem)'
|
9
9
|
class_option :dt, type: :boolean, default: false,
|
10
|
-
desc: 'Include the jQuery DataTables plugin'
|
10
|
+
desc: 'Include the jQuery DataTables plugin (and responsive)'
|
11
11
|
class_option :cdn, type: :string, default: 'none',
|
12
|
-
banner: 'none
|
12
|
+
banner: 'none/google/microsoft/jquery/yandex',
|
13
13
|
desc: 'Use CDN (requires jquery[-ui]-rails-cdn gems)'
|
14
|
-
class_option :
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
class_option :auth, type: :string, default: 'sorcery',
|
15
|
+
banner: 'none/devise resource (e.g. user)/sorcery',
|
16
|
+
desc: 'Setup some authentication logic for sorcery or devise'
|
17
|
+
class_option :layout, type: :string, default: 'custom',
|
18
|
+
banner: 'custom(just div.row)/single(col-lg-12)/sidebar(content_for)',
|
19
|
+
desc: 'Install default application layout'
|
19
20
|
source_root File.expand_path("../templates", __FILE__)
|
20
21
|
|
21
22
|
def update_application_controller
|
22
23
|
file = "app/controllers/application_controller.rb"
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
if options.auth == "none"
|
25
|
+
lines = [
|
26
|
+
""
|
27
|
+
]
|
28
|
+
elsif options.auth == "sorcery"
|
29
|
+
lines = [
|
30
|
+
"",
|
31
|
+
" before_action :require_login"
|
32
|
+
]
|
33
|
+
else
|
34
|
+
lines = [
|
35
|
+
"",
|
36
|
+
" before_action :authenticate_#{options.auth}!"
|
37
|
+
]
|
38
|
+
end
|
39
|
+
lines += [
|
40
|
+
"",
|
41
|
+
" private",
|
26
42
|
"",
|
27
43
|
" def default_theme",
|
28
44
|
" BootswatchRails::THEMES[BootswatchRails::DEFAULT].to_s",
|
29
45
|
" end",
|
30
|
-
" helper_method :default_theme"
|
31
|
-
"",
|
32
|
-
" def current_theme",
|
33
|
-
" @current_theme = current_user.theme if #{auth_check}",
|
34
|
-
" @current_theme ||= default_theme",
|
35
|
-
" end",
|
36
|
-
" helper_method :current_theme",
|
37
|
-
""
|
46
|
+
" helper_method :default_theme"
|
38
47
|
]
|
39
|
-
|
48
|
+
if options.auth != "none"
|
49
|
+
lines += [
|
50
|
+
"",
|
51
|
+
" def current_theme",
|
52
|
+
" @current_theme = current_#{auth_resource}.theme if #{auth_check}",
|
53
|
+
" @current_theme ||= default_theme",
|
54
|
+
" end",
|
55
|
+
" helper_method :current_theme"
|
56
|
+
]
|
57
|
+
end
|
58
|
+
if options.auth == "sorcery"
|
59
|
+
lines += [
|
60
|
+
"",
|
61
|
+
" def not_authenticated",
|
62
|
+
" redirect_to login_path, alert: t('sorcery.required')",
|
63
|
+
" end"
|
64
|
+
]
|
65
|
+
elsif options.auth != "none"
|
66
|
+
lines += [
|
67
|
+
"",
|
68
|
+
" def after_sign_in_path_for(resource)",
|
69
|
+
" session['#{auth_resource}_return_to'] || root_path",
|
70
|
+
" end"
|
71
|
+
]
|
72
|
+
end
|
73
|
+
inject_into_file file, lines.join("\n"), after: /protect_from_forgery.*$/
|
40
74
|
end
|
41
75
|
|
42
76
|
def update_application_js
|
@@ -99,13 +133,19 @@ module BootswatchRails
|
|
99
133
|
file = "app/views/layouts/application.html.erb"
|
100
134
|
remove_file file
|
101
135
|
template "#{options.layout}.html.erb", file
|
102
|
-
|
136
|
+
if options.auth != "none"
|
137
|
+
template "theme.html.erb", "app/views/layouts/_theme.html.erb"
|
138
|
+
end
|
103
139
|
end
|
104
140
|
|
105
141
|
protected
|
106
142
|
|
143
|
+
def auth_resource
|
144
|
+
options.auth == "sorcery" ? "user" : options.auth
|
145
|
+
end
|
146
|
+
|
107
147
|
def auth_check
|
108
|
-
options.
|
148
|
+
options.auth == "sorcery" ? "logged_in?" : "#{options.auth}_signed_in?"
|
109
149
|
end
|
110
150
|
|
111
151
|
def turbolinks
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="de">
|
3
|
+
<%%= render 'layouts/head' %>
|
4
|
+
|
5
|
+
<body>
|
6
|
+
<%%= render 'layouts/topnav' %>
|
7
|
+
<%%= render 'layouts/theme' %>
|
8
|
+
|
9
|
+
<div class="container" id="main-content">
|
10
|
+
<div class="row">
|
11
|
+
<%%= render 'layouts/flash' %>
|
12
|
+
<%%= yield %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<%%= render 'layouts/footer' %>
|
17
|
+
</body>
|
18
|
+
</html>
|
19
|
+
|
20
|
+
<%%-# vim: set expandtab softtabstop=2 shiftwidth=2 autoindent : -%>
|
@@ -4,11 +4,11 @@
|
|
4
4
|
<div class='modal-content'>
|
5
5
|
<div class='modal-header'>
|
6
6
|
<button type='button' class='close' data-dismiss='modal'>×</button>
|
7
|
-
<h4 class='modal-title'><%%= t('activerecord.attributes
|
7
|
+
<h4 class='modal-title'><%%= t('activerecord.attributes.<%= auth_resource %>.theme') %></h4>
|
8
8
|
</div>
|
9
9
|
<div class='modal-body theme-list'>
|
10
10
|
<%%- BootswatchRails::THEMES.each do |theme| -%>
|
11
|
-
<%%= link_to theme.to_s,
|
11
|
+
<%%= link_to theme.to_s, <%= auth_resource %>_path(current_<%= auth_resource %>, theme: theme), class: 'theme-link' %>
|
12
12
|
<%%- end -%>
|
13
13
|
</div>
|
14
14
|
<div class='modal-footer'>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootswatch_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.7.
|
4
|
+
version: 3.3.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volker Wiegand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/generators/bootswatch_rails/install/templates/config/locales/scaffold.de.yml
|
131
131
|
- lib/generators/bootswatch_rails/install/templates/config/locales/scaffold.en.yml
|
132
132
|
- lib/generators/bootswatch_rails/install/templates/config/locales/simple_form.de.yml
|
133
|
+
- lib/generators/bootswatch_rails/install/templates/custom.html.erb
|
133
134
|
- lib/generators/bootswatch_rails/install/templates/even.html.erb
|
134
135
|
- lib/generators/bootswatch_rails/install/templates/head.html.erb
|
135
136
|
- lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/_form.html.erb
|