bridgetown-routes 2.0.0.beta3 → 2.0.0.beta4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead7362de53f74f9fc0d9cb78a809f52e88472d06255ad1aae6c199dd706f180
|
4
|
+
data.tar.gz: f0bd1482dc914fb895d46feab6c62181ff5e7cd7cb48b67510538a2a7fcf7d05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abac48a5f49b5d0ffd6ab6a9bdedd5ca5030f0bcb389d22a759db7f001ed6086d760660c3aecb663577bae87186816c90b49d6bca769dd8de426056a4e638820
|
7
|
+
data.tar.gz: 52fac80a368798162d5c3c189cf8c3932a73bca858e44ad5d04e1c8ba52c740b87875ffc19e0d970c400ce471e767d5bfb95f035abfd2b5d609ccd548818a7b7
|
@@ -1,14 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "flash_additions"
|
4
|
-
|
5
3
|
module Bridgetown
|
6
4
|
module Routes
|
7
5
|
module ViewHelpers
|
8
6
|
# This flash is only used as a stub for views in case there's no Roda flash
|
9
7
|
# available in the rendering context
|
10
8
|
class Flash < Hash
|
11
|
-
|
9
|
+
def info
|
10
|
+
self["info"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def info=(val)
|
14
|
+
self["info"] = val
|
15
|
+
end
|
16
|
+
|
17
|
+
def alert
|
18
|
+
self["alert"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def alert=(val)
|
22
|
+
self["alert"] = val
|
23
|
+
end
|
12
24
|
|
13
25
|
def now
|
14
26
|
self
|
@@ -1,27 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "roda/plugins/flash"
|
4
|
-
require_relative "../../bridgetown-routes/flash_additions"
|
5
|
-
|
6
|
-
Roda::RodaPlugins::Flash::FlashHash.include Bridgetown::Routes::FlashHashAdditions,
|
7
|
-
Bridgetown::Routes::FlashHashIndifferent
|
8
|
-
Roda::RodaPlugins::Flash::FlashHash.class_eval do
|
9
|
-
def initialize(hash = {})
|
10
|
-
super(hash || {})
|
11
|
-
now.singleton_class.include Bridgetown::Routes::FlashHashAdditions,
|
12
|
-
Bridgetown::Routes::FlashNowHashIndifferent
|
13
|
-
@next = {}
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
3
|
class Roda
|
18
4
|
module RodaPlugins
|
19
5
|
module BridgetownRoutes
|
20
6
|
def self.load_dependencies(app)
|
21
7
|
app.plugin :slash_path_empty # now /hello and /hello/ are both matched
|
22
8
|
app.plugin :placeholder_string_matchers
|
23
|
-
app.plugin :flash
|
24
|
-
app.plugin :route_csrf
|
25
9
|
end
|
26
10
|
|
27
11
|
def self.configure(app, _opts = {})
|
@@ -130,10 +114,14 @@ class Roda
|
|
130
114
|
module RequestMethods
|
131
115
|
# This runs through all of the routes in the manifest, setting up Roda blocks for execution
|
132
116
|
def file_routes
|
117
|
+
base_path = Bridgetown::Current.preloaded_configuration.base_path.delete_prefix("/")
|
118
|
+
|
133
119
|
scope.routes_manifest.routes.each do |route|
|
134
120
|
file, localized_file_slugs, segment_keys = route
|
135
121
|
|
136
122
|
localized_file_slugs.each do |slug|
|
123
|
+
on("") { scope.run_file_route(file, slug:) } if slug == "index" && !base_path.empty?
|
124
|
+
|
137
125
|
# This sets up an initial Roda route block at the slug, and handles segments as params
|
138
126
|
#
|
139
127
|
# _routes/nested/[slug].erb -> "nested/:slug"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.0.
|
19
|
+
version: 2.0.0.beta4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.0.
|
26
|
+
version: 2.0.0.beta4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: roda-route_list
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- bridgetown-routes.gemspec
|
50
50
|
- lib/bridgetown-routes.rb
|
51
51
|
- lib/bridgetown-routes/code_blocks.rb
|
52
|
-
- lib/bridgetown-routes/flash_additions.rb
|
53
52
|
- lib/bridgetown-routes/manifest.rb
|
54
53
|
- lib/bridgetown-routes/manifest_router.rb
|
55
54
|
- lib/bridgetown-routes/view_helpers.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bridgetown
|
4
|
-
module Routes
|
5
|
-
module FlashHashAdditions
|
6
|
-
def info
|
7
|
-
self["info"]
|
8
|
-
end
|
9
|
-
|
10
|
-
def info=(val)
|
11
|
-
self["info"] = val
|
12
|
-
end
|
13
|
-
|
14
|
-
def alert
|
15
|
-
self["alert"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def alert=(val)
|
19
|
-
self["alert"] = val
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
module FlashHashIndifferent
|
24
|
-
def []=(key, val)
|
25
|
-
@next[key.to_s] = val
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
module FlashNowHashIndifferent
|
30
|
-
def []=(key, val)
|
31
|
-
super(key.to_s, val)
|
32
|
-
end
|
33
|
-
|
34
|
-
def [](key)
|
35
|
-
super(key.to_s)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|