codelation_pages 0.0.2 → 0.0.3

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: dadaf83a31dbb1dd37151f3772267d31dabc3e3d
4
- data.tar.gz: 8c79d9b25c9c668dbcaeea7acd614cfcefd2e330
3
+ metadata.gz: 2e332d98b13a451bd9b25927ba637431a7842f9e
4
+ data.tar.gz: beab49bea9de66f93582e643fa7b6ed7787851ef
5
5
  SHA512:
6
- metadata.gz: 53449bac2a18119f1073aef8ecf2a9660d0e6b2245911341e566df2c3cca6afa9044d6b97ecd5f414c5169149272729d87c78d43c8c6cd26e57285254f10690b
7
- data.tar.gz: 0c879d254920a6facd6e97ad1770f8869406cf8f648d4f4093499070ea7eb4383978b94c6eed533a4c02dc9f2eb8406535d8daa0d0872c606f719cfdd98d8dc4
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`.
@@ -1,3 +1,3 @@
1
1
  module CodelationPages
2
- VERSION = "0.0.2".freeze
2
+ VERSION = "0.0.3".freeze
3
3
  end
@@ -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
- path_name = directory_name.blank? ? page : "#{directory_name}_#{page}"
62
- path = page == "index" ? directory_name.dasherize : "#{directory_name}/#{page}".dasherize
63
- get path, to: "#{controller_name}##{page}", as: path_name
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codelation_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison