sinatra-thymeleaf 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/thymeleaf.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab83e5b776dfac0d7b3e188bada03b6a64b46a0c
|
4
|
+
data.tar.gz: 1c14dc2a11665bc67f781d9dc2c1ee7f5b49abeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34e953377b9b11757e5b81dafe57a457dfdf9db7c16bcba286125881fb655339c9b8455ef4c6c2da682a1f54be0abefc9188dd469a6bedb3e9f7c54b7752843e
|
7
|
+
data.tar.gz: 19019278cfae952450b32be9784635bee1b8ce42f928e679398c734bf4bdb871ebec7b49020abe6abd9415b53282dfce66d66abed028c4b790204d756c2151d7
|
data/lib/sinatra/thymeleaf.rb
CHANGED
@@ -3,18 +3,28 @@ require_relative 'tilt/thymeleaf'
|
|
3
3
|
require 'i18n'
|
4
4
|
|
5
5
|
module Sinatra
|
6
|
+
# we need to configure the Thymeleaf prefix and suffix for insert and replace
|
7
|
+
Thymeleaf.configuration.template.prefix = "./views/"
|
8
|
+
Thymeleaf.configuration.template.suffix = ".html"
|
6
9
|
|
7
10
|
module Thymeleaf
|
8
11
|
def thyme(template=nil, locals={}, options = {}, &block)
|
12
|
+
|
9
13
|
options, template = template, nil if template.is_a?(Hash)
|
10
14
|
template = lambda { block } if template.nil?
|
11
15
|
locals[:t] = lambda { |m| I18n.t(m) }
|
12
16
|
|
17
|
+
# setup Sinatra flash
|
13
18
|
locals[:flash] = {}
|
14
19
|
unless flash.nil?
|
15
20
|
locals[:flash] = flash
|
16
21
|
end
|
17
22
|
|
23
|
+
# add warden current_user if available
|
24
|
+
unless current_user.nil?
|
25
|
+
locals[:current_user] = current_user
|
26
|
+
end
|
27
|
+
|
18
28
|
render :html, template, options, locals
|
19
29
|
end
|
20
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-thymeleaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Costea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thymeleaf
|