rails_layout 1.0.27 → 1.0.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16e1150262e76212d02157ab6fa9a958785356fc
4
- data.tar.gz: 81b23773d71f52459fb7a25446787115a2a33faa
3
+ metadata.gz: 3e34a5527bcaa16a6da0667377342295fa77fec8
4
+ data.tar.gz: 1a989c4335301f2c027268b18d0265894b76bca1
5
5
  SHA512:
6
- metadata.gz: 14bfb434e57d09d4205c368dc47f11878586c0371e0c9f2844829babf6de557c0f0291cb64baf84dc2f4b4f943db09d5f8ca3155c8a6fae70637135acbdbdff0
7
- data.tar.gz: 7629023203c22dafbcc30d8e3c4880c8ea55d3b3bcf6acdc79f1e44bcb1201941df5ebf86029811ecc23425ffa50ec8e0faec8b3299c83e3a8af6c5457bda848
6
+ metadata.gz: b5d2bb04acea7cae6d71d9745a0a15ba41401cebaa8aa034c8fb95b112c3e00790a9f153d5bde7c03f68626789677a745b20fb66fe8e9b1cde568ba2c0b9925f
7
+ data.tar.gz: cab3b7902c13feaee4d87ed4b1259c54b0c6e6e1f249c83159b9a8b3ebc23e8081fecaf72aa82b9c4031b0daab4920604a209bfe3ab9acc524aa5f0855c14193
data/CHANGELOG.textile CHANGED
@@ -1,5 +1,9 @@
1
1
  h1. CHANGELOG
2
2
 
3
+ h3. 1.0.28 November 4, 2015
4
+
5
+ * move navigation auth links to a new partial 'app/views/layouts/_nav_links_for_auth.html.erb'
6
+
3
7
  h3. 1.0.27 October 18, 2015
4
8
 
5
9
  * create a file '1st_load_framework' instead of 'framework_and_overrides' to force loading a framework first (the asset pipeline loads files in a tree in alpha order)
@@ -18,7 +18,7 @@ module Layout
18
18
  append_file 'app/views/layouts/_navigation_links.html.erb', "<li><%= link_to 'Contact', new_contact_path %></li>\n" if File.exists?("app/views/contacts/new.html.#{ext}")
19
19
  # DEVISE
20
20
  if File.exists?('config/initializers/devise.rb')
21
- append_file 'app/views/layouts/_navigation_links.html.erb' do <<-LINKS
21
+ create_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
22
22
  <% if user_signed_in? %>
23
23
  <li><%= link_to 'Edit account', edit_user_registration_path %></li>
24
24
  <li><%= link_to 'Sign out', destroy_user_session_path, :method=>'delete' %></li>
@@ -31,7 +31,7 @@ LINKS
31
31
  end
32
32
  # OMNIAUTH
33
33
  if File.exists?('config/initializers/omniauth.rb')
34
- append_file 'app/views/layouts/_navigation_links.html.erb' do <<-LINKS
34
+ create_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
35
35
  <% if user_signed_in? %>
36
36
  <li><%= link_to 'Sign out', signout_path %></li>
37
37
  <% else %>
@@ -44,7 +44,7 @@ LINKS
44
44
  if Dir.glob("app/views/users/index.html.{#{ext},erb}").any?
45
45
  if User.column_names.include? 'role'
46
46
  # suitable for role-based authorization
47
- append_file 'app/views/layouts/_navigation_links.html.erb' do <<-LINKS
47
+ append_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
48
48
  <% if user_signed_in? %>
49
49
  <% if current_user.try(:admin?) %>
50
50
  <li><%= link_to 'Users', users_path %></li>
@@ -54,7 +54,7 @@ LINKS
54
54
  end
55
55
  else
56
56
  # suitable for simple authentication
57
- append_file 'app/views/layouts/_navigation_links.html.erb' do <<-LINKS
57
+ append_file 'app/views/layouts/_nav_links_for_auth.html.erb' do <<-LINKS
58
58
  <% if user_signed_in? %>
59
59
  <li><%= link_to 'Users', users_path %></li>
60
60
  <% end %>
@@ -65,10 +65,18 @@ LINKS
65
65
  # UPMIN (administrative dashboard)
66
66
  if File.exists?('config/initializers/upmin.rb')
67
67
  navlink = " <li><%= link_to 'Admin', '/admin' %></li>"
68
- inject_into_file 'app/views/layouts/_navigation_links.html.erb', navlink + "\n", :after => "<% if current_user.try(:admin?) %>\n"
68
+ inject_into_file 'app/views/layouts/_nav_links_for_auth.html.erb', navlink + "\n", :after => "<% if current_user.try(:admin?) %>\n"
69
69
  end
70
70
  end
71
71
 
72
+ def modify_layout_for_auth_links
73
+ return unless File.exists?('app/views/layouts/_nav_links_for_auth.html.erb')
74
+ app = ::Rails.application
75
+ ext = app.config.generators.options[:rails][:template_engine] || :erb
76
+ partial = "<%= render 'layouts/navigation_links' %>\n <%= render 'layouts/nav_links_for_auth' %>"
77
+ gsub_file "app/views/layouts/_navigation.html.#{ext}", /<%= render 'layouts\/navigation_links' %>/, partial
78
+ end
79
+
72
80
  def add_tests
73
81
  return unless File.exists?('config/initializers/devise.rb')
74
82
  return unless File.exists?('spec/spec_helper.rb')
@@ -1,3 +1,3 @@
1
1
  module RailsLayout
2
- VERSION = "1.0.27"
2
+ VERSION = "1.0.28"
3
3
  end
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.27
4
+ version: 1.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kehoe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler