rails_layout 0.1.0 → 0.1.1

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: f74d50ef762f58b99f8f7fbc26444cff696743cc
4
- data.tar.gz: 4bc0b744a904ece0fcb7be49109f7ab67fc41046
3
+ metadata.gz: a7ea61a29cf64b276865b9a2867d425bd38f7206
4
+ data.tar.gz: 2963be0a47813f1dad61a70bd6440c3ab5ef71bc
5
5
  SHA512:
6
- metadata.gz: 9b89e7b685ba558b47a553f7e1863c2d6c4234fb1acb6af6dac4c6321dda272b5e2581cfb436ce87414be553604609f3b4062d4546f7d33dd1f2e9ef08fe61de
7
- data.tar.gz: 6f533442ff9c11a59117ced1f1fa4029a2716ef6913c31cab63c7440d42d0fb2377ecbf62b6f67e3aa41487bce75da8d17540d3682bd6dfa3d77bd3ab26f6f41
6
+ metadata.gz: 88b7d85ed383111ed4cf63d7094033acb80d61d4e70d1da4ada892aca496ac3c9c2493b46d142484c8d1e0659487b8412d9652ffc378243636cbc985053b9d71
7
+ data.tar.gz: bb1518cc9f275f996afce3f07f372fa97757c64fed7357886b3b4ac0800874f7a5d7776b9fdb117f88ae81eeb70a5067831ada5f726393dc9a626c3141fd7d3a
data/CHANGELOG.textile CHANGED
@@ -1,5 +1,9 @@
1
1
  h1. CHANGELOG
2
2
 
3
+ h2. 0.1.1 September 19, 2013
4
+
5
+ * add navigation links for 'About' or 'Contact' if view files exist in expected locations
6
+
3
7
  h2. 0.1.0 September 19, 2013
4
8
 
5
9
  * support for Twitter Bootstrap 2.3
@@ -8,14 +8,28 @@ module Layout
8
8
 
9
9
  attr_reader :app_name
10
10
 
11
+ # Create an application layout file with partials for messages and navigation
11
12
  def generate_layout
12
13
  app = ::Rails.application
13
14
  @app_name = app.class.to_s.split("::").first
14
15
  ext = app.config.generators.options[:rails][:template_engine] || :erb
16
+ # so far, I've only got templates for ERB, but Haml and Slim could be added
15
17
  template "#{framework_name}-application.html.#{ext}", "app/views/layouts/application.html.#{ext}"
16
- copy_file "#{framework_name}-navigation.html.#{ext}", "app/views/layouts/_navigation.html.#{ext}"
17
18
  copy_file "#{framework_name}-messages.html.#{ext}", "app/views/layouts/_messages.html.#{ext}"
19
+ copy_file "#{framework_name}-navigation.html.#{ext}", "app/views/layouts/_navigation.html.#{ext}"
18
20
  end
21
+
22
+ # If 'About' or 'Contact' views exist in known locations, add navigation links
23
+ def add_navigation_links
24
+ # not yet accommodating Haml and Slim (we'll need different substitutions)
25
+ if File.exists?('app/views/pages/about.html.erb')
26
+ insert_into_file 'app/views/layouts/_navigation.html.erb', "\n <li><%= link_to 'About', page_path('about') %></li>", :before => "\n</ul>"
27
+ end
28
+ if File.exists?('app/views/contacts/new.html.erb')
29
+ insert_into_file 'app/views/layouts/_navigation.html.erb', "\n <li><%= link_to 'Contact', new_contact_path %></li>", :before => "\n</ul>"
30
+ end
31
+ end
32
+
19
33
  end
20
34
  end
21
35
  end
@@ -1,5 +1,3 @@
1
1
  <ul class="nav">
2
2
  <li><%= link_to 'Home', root_path %></li>
3
- <li><%= link_to 'About', page_path('about') %></li>
4
- <li><%= link_to 'Contact', new_contact_path %></li>
5
3
  </ul>
@@ -1,3 +1,3 @@
1
1
  module RailsLayout
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
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: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kehoe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-19 00:00:00.000000000 Z
11
+ date: 2013-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler