thymeleaf-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +43 -0
- data/Rakefile +18 -0
- data/lib/thymeleaf-rails.rb +2 -0
- data/lib/thymeleaf/rails.rb +7 -0
- data/lib/thymeleaf/rails/engine.rb +16 -0
- data/lib/thymeleaf/rails/handler.rb +18 -0
- data/lib/thymeleaf/rails/version.rb +5 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2493aeb605f12be587386a5fb8417ea8086d45f1
|
4
|
+
data.tar.gz: be2d2b1cfc7bbbf5b4d34e8da675c16b462740db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 00be481597b01f12f8744b980afe2fa3437134854ae95dffd7640938937b172199eb93c6f3bbb40e8146efa682dfac057359f097c02245b997eda6dbac2af38d
|
7
|
+
data.tar.gz: 199a358949e8931217f97066a86bbcd866b9a4ca2442012d1e098069ae1df909e0f4f06283a2d0ad701595bda4b6f2d9a81dbece84dc23e45947aba2237658c0
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 danibranas
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# thymeleaf-rails: Thymeleaf.rb for Rails
|
2
|
+
|
3
|
+
Simple Rails support for [Thymeleaf.rb](https://github.com/trabe/thymeleaf-rb)
|
4
|
+
(a ruby port of [Thymeleaf](http://www.thymeleaf.org, a natural templating engine)).
|
5
|
+
|
6
|
+
**This is a Work In Progress Project. It is not ready for production use**
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
Add the gem to the `Gemfile` and get ready to rock.
|
11
|
+
|
12
|
+
```
|
13
|
+
gem 'thymeleaf-rails'
|
14
|
+
```
|
15
|
+
|
16
|
+
Use the `.th` extension in your templates. Yay!
|
17
|
+
|
18
|
+
```
|
19
|
+
<table>
|
20
|
+
<thead>
|
21
|
+
<tr>
|
22
|
+
<th data-th-text="${headers.name}">Name</th>
|
23
|
+
<th data-th-text="${headers.price}">Price</th>
|
24
|
+
</tr>
|
25
|
+
</thead>
|
26
|
+
<tbody>
|
27
|
+
<tr data-th-each="prod : ${all_products}">
|
28
|
+
<td data-th-text="${prod.name}">Oranges</td>
|
29
|
+
<td data-th-text="${number_to_currency(prod.price, precision: 2)}">0.99</td>
|
30
|
+
</tr>
|
31
|
+
</tbody>
|
32
|
+
</table>
|
33
|
+
```
|
34
|
+
|
35
|
+
## TODO List
|
36
|
+
|
37
|
+
* Use Rails I18n backend
|
38
|
+
* Create an example app
|
39
|
+
|
40
|
+
|
41
|
+
## Contributing and help
|
42
|
+
|
43
|
+
Refer to the Thymeleaf.rb repo: [trabe/thymeleaf-rb](https://github.com/trabe/thymeleaf-rb)
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
require "rake/testtask"
|
9
|
+
|
10
|
+
Rake::TestTask.new(:test) do |t|
|
11
|
+
t.libs << 'lib'
|
12
|
+
t.libs << 'test'
|
13
|
+
t.pattern = 'test/**/*_test.rb'
|
14
|
+
t.verbose = false
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
task default: :test
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'handler'
|
2
|
+
|
3
|
+
module Thymeleaf
|
4
|
+
module Rails
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
|
7
|
+
initializer "thymeleaf.register_template_handler" do
|
8
|
+
|
9
|
+
ActionView::Template.register_template_handler :th, ThymeleafHandler.new
|
10
|
+
ActionView::Template.register_template_handler :thymeleaf, ThymeleafHandler.new
|
11
|
+
Mime::Type.register "text/html", :th
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Thymeleaf
|
2
|
+
module Rails
|
3
|
+
class ThymeleafHandler
|
4
|
+
|
5
|
+
def do_render(template_content, locals)
|
6
|
+
str = 'th_context = {};'
|
7
|
+
str << 'instance_variables.map { |name| th_context[name[1..-1]] = instance_variable_get(name) if name[0].eql?"@" };'
|
8
|
+
#str << "instance_variables.merge(#{locals});"
|
9
|
+
str << "Thymeleaf::Template.new('#{template_content}', th_context).render.to_s"
|
10
|
+
str
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(template)
|
14
|
+
do_render(template.source, template.locals)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thymeleaf-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Barral
|
8
|
+
- Daniel Vázquez Brañas
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 5.0.0
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 5.0.0.1
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 5.0.0
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.0.0.1
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: tilt
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: thymeleaf
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: activesupport
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.0.1
|
69
|
+
type: :runtime
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 4.0.1
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: actionpack
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.0.1
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.0.1
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: railties
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.0.1
|
97
|
+
type: :runtime
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 4.0.1
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: bundler
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rake
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
description: Thymeleaf.rb adaptor for Ruby on Rails
|
133
|
+
email:
|
134
|
+
- david@trabesoluciones.es
|
135
|
+
- daniel.vbranas@udc.es
|
136
|
+
executables: []
|
137
|
+
extensions: []
|
138
|
+
extra_rdoc_files: []
|
139
|
+
files:
|
140
|
+
- MIT-LICENSE
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- lib/thymeleaf-rails.rb
|
144
|
+
- lib/thymeleaf/rails.rb
|
145
|
+
- lib/thymeleaf/rails/engine.rb
|
146
|
+
- lib/thymeleaf/rails/handler.rb
|
147
|
+
- lib/thymeleaf/rails/version.rb
|
148
|
+
homepage: https://github.com/trabe/thymeleaf-rails
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.5.1
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: Thymeleaf.rb adaptor for Ruby on Rails
|
172
|
+
test_files: []
|