codelation_pages 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +4 -0
- data/lib/codelation_pages/version.rb +1 -1
- data/lib/extensions/action_dispatch/routing/mapper.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e332d98b13a451bd9b25927ba637431a7842f9e
|
4
|
+
data.tar.gz: beab49bea9de66f93582e643fa7b6ed7787851ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4846af69fbdcd812fc491ae226ff0adc8f1603fe42d889936fed6dca86181f2b4fa19039b431172af6eaec7a5780a7d1f36e90cdb3f3a6e5872f15e0601350
|
7
|
+
data.tar.gz: 3ff9bda4b5bd0964e945fabcee96179d21389bc3314d3f42bf3714a70d95f80a034685d86e6596378ac6f13391404bdf73800c175381f5802fc219d5acb9692b
|
data/README.md
CHANGED
@@ -38,6 +38,10 @@ You can also create pages within subfolders, so if wanted to create a
|
|
38
38
|
I would create the view file: `app/views/pages/features/overview.html.erb`.
|
39
39
|
The link helper will be available as `features_overview_path`.
|
40
40
|
|
41
|
+
Files with the name `index.html.erb` will be served at the root path for that directory.
|
42
|
+
Example: `app/views/features/index.html.erb` will live at `http://example.com/features`.
|
43
|
+
The link helper will be available as `features_path`.
|
44
|
+
|
41
45
|
Files within subfolders will not be served by the `PagesController`. They will
|
42
46
|
be served by a generated controller matching the name of the folder. In the case of our
|
43
47
|
"Features > Overview" page, the controller would be the `Pages::FeaturesController`.
|
@@ -58,9 +58,16 @@ module ActionDispatch
|
|
58
58
|
page_files.each do |file_name|
|
59
59
|
page = File.basename(file_name, ".html.erb")
|
60
60
|
controller_name = directory_name.blank? ? "pages" : "pages/#{directory_name}"
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
|
62
|
+
if page == "index"
|
63
|
+
path = directory_name.dasherize
|
64
|
+
path_name = directory_name
|
65
|
+
else
|
66
|
+
path_name = directory_name.blank? ? page : "#{directory_name}_#{page}"
|
67
|
+
path = "#{directory_name}/#{page}".dasherize
|
68
|
+
end
|
69
|
+
|
70
|
+
get path, to: "#{controller_name}##{page}", as: path_name.blank? ? "root" : path_name
|
64
71
|
end
|
65
72
|
end
|
66
73
|
|