lalala 4.0.0.dev.191 → 4.0.0.dev.192
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lalala/engine.rb +3 -0
- data/lib/lalala/pages/helpers.rb +18 -0
- data/lib/lalala/pages/page_type_constraint.rb +1 -9
- data/lib/lalala/pages/route_mapper.rb +13 -2
- data/lib/lalala/pages.rb +1 -0
- data/lib/lalala/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abdac7f80c3c05f6d398582d7057e27456aeb13e
|
4
|
+
data.tar.gz: f3628af5e5b2601b4521e218fd062876260efdcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2eaaf24303dafe8cc5704f7a4e0cddb0a974270de9d9fb5691617bbf0b5ba7d47370b68dd282859e35d2b8730163bfdab229f6307998ea5ddf1cd40ce86b2f6
|
7
|
+
data.tar.gz: 778acd41e4e0395cffc9001305e202d7254df49913bc68ed807fc3ffb25b96461b15b9d21631fc6b3738f696034a1462b9ca4410d6fd59cc25d797c26dd84f3e
|
data/lib/lalala/engine.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Lalala::Pages::Helpers
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
helper_method :current_page_chain, :current_page
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def current_page_chain
|
11
|
+
request.env["lalala.page_chain"] or []
|
12
|
+
end
|
13
|
+
|
14
|
+
def current_page
|
15
|
+
request.env["lalala.page"]
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -1,15 +1,7 @@
|
|
1
1
|
class Lalala::Pages::PageTypeConstraint
|
2
2
|
|
3
3
|
def initialize(type)
|
4
|
-
type =
|
5
|
-
type = type.classify
|
6
|
-
|
7
|
-
while type.ends_with?("PagePage")
|
8
|
-
type = type[0..-5]
|
9
|
-
end
|
10
|
-
|
11
|
-
type = type.constantize
|
12
|
-
@type = type
|
4
|
+
@type = type.constantize
|
13
5
|
end
|
14
6
|
|
15
7
|
def matches?(request)
|
@@ -15,8 +15,8 @@ module Lalala::Pages::RouteMapper
|
|
15
15
|
raise ArgumentError, "expected a page type"
|
16
16
|
end
|
17
17
|
|
18
|
-
type = args[0]
|
19
|
-
options = { as: type }.merge(options)
|
18
|
+
type = Lalala::Pages::RouteMapper.page_class_name(args[0])
|
19
|
+
options = { as: type.underscore }.merge(options)
|
20
20
|
options[:constraints] = Lalala::Pages::PageTypeConstraint.new(type)
|
21
21
|
|
22
22
|
match '/', options
|
@@ -28,4 +28,15 @@ module Lalala::Pages::RouteMapper
|
|
28
28
|
self
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.page_class_name(type)
|
32
|
+
type = "#{type}_page"
|
33
|
+
type = type.classify
|
34
|
+
|
35
|
+
while type.ends_with?("PagePage")
|
36
|
+
type = type[0..-5]
|
37
|
+
end
|
38
|
+
|
39
|
+
type
|
40
|
+
end
|
41
|
+
|
31
42
|
end
|
data/lib/lalala/pages.rb
CHANGED
data/lib/lalala/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lalala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.dev.
|
4
|
+
version: 4.0.0.dev.192
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Menke
|
@@ -1422,6 +1422,7 @@ files:
|
|
1422
1422
|
- lib/lalala/pages.rb
|
1423
1423
|
- lib/lalala/pages/child_type_validator.rb
|
1424
1424
|
- lib/lalala/pages/children_length_validator.rb
|
1425
|
+
- lib/lalala/pages/helpers.rb
|
1425
1426
|
- lib/lalala/pages/page_type_constraint.rb
|
1426
1427
|
- lib/lalala/pages/path_handler.rb
|
1427
1428
|
- lib/lalala/pages/route_mapper.rb
|