rails_layout 0.1.0 → 0.1.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7ea61a29cf64b276865b9a2867d425bd38f7206
|
4
|
+
data.tar.gz: 2963be0a47813f1dad61a70bd6440c3ab5ef71bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b7d85ed383111ed4cf63d7094033acb80d61d4e70d1da4ada892aca496ac3c9c2493b46d142484c8d1e0659487b8412d9652ffc378243636cbc985053b9d71
|
7
|
+
data.tar.gz: bb1518cc9f275f996afce3f07f372fa97757c64fed7357886b3b4ac0800874f7a5d7776b9fdb117f88ae81eeb70a5067831ada5f726393dc9a626c3141fd7d3a
|
data/CHANGELOG.textile
CHANGED
@@ -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
|
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: 0.1.
|
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-
|
11
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|