cells-haml 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/Gemfile +3 -7
- data/README.md +2 -15
- data/cells-haml.gemspec +1 -1
- data/gemfiles/rails_3.2-tilt-1.4.gemfile +2 -0
- data/gemfiles/rails_4.0-tilt-1.4.gemfile +2 -0
- data/gemfiles/rails_4.2-tilt-1.4.gemfile +2 -0
- data/gemfiles/rails_4.2-tilt-2.0.gemfile +2 -0
- data/gemfiles/rails_4.2-tilt-3.0.gemfile +2 -0
- data/lib/cell/haml.rb +24 -9
- data/lib/cell/haml/version.rb +1 -1
- data/test/dummy/app/cells/song/render_in_render.haml +1 -0
- data/test/dummy/app/cells/song/render_in_render_2.haml +1 -0
- data/test/dummy/app/cells/song_cell.rb +9 -1
- data/test/haml_test.rb +2 -3
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be9c331f0746213a42cbfbe16868e27142badf9
|
4
|
+
data.tar.gz: a11364d8b837ff886080aa92bc77a59d37cf58a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2226291a4b1f67efe15f6641f8cb13c53be1af636be6004c695666b600ec84ea74da126daa5c9995741db0853ec670ac7005a7a9b8914073f1f0abbee43172
|
7
|
+
data.tar.gz: 42dc9e4d36e24304c6915c4522c2208facfb409f1671536f0186915031b61b157bb8d4e1a0b0b7140e9d579078addf940e03820a49a2073afc51c6a9b1b2c0b1
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -2,13 +2,9 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in cells-haml.gemspec
|
4
4
|
gemspec
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
gem 'cells', github: 'apotonick/cells'
|
5
|
+
|
6
|
+
gem 'cells', path: "../cells"#github: 'apotonick/cells'
|
9
7
|
gem 'railties'
|
10
8
|
gem 'actionpack'
|
11
9
|
gem 'actionview'
|
12
|
-
gem
|
13
|
-
gem 'minitest-reporters'
|
14
|
-
# gem "haml", github: "haml/haml" # we need 4.1.
|
10
|
+
gem "haml", github:"haml/haml" #"4.1.0.beta1" #github: "haml/haml" # we need 4.1.
|
data/README.md
CHANGED
@@ -8,11 +8,11 @@ Add this line to your application's Gemfile:
|
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
gem 'cells-haml'
|
11
|
+
gem "haml", github: "haml/haml"
|
11
12
|
```
|
12
13
|
|
13
|
-
This
|
14
|
+
This gem currently only works properly with Haml 4.1, which is not yet released.
|
14
15
|
|
15
|
-
And that's all you need to do.
|
16
16
|
|
17
17
|
## HTML Escaping
|
18
18
|
|
@@ -31,19 +31,6 @@ end
|
|
31
31
|
|
32
32
|
If that doesn't work, [read the docs](http://trailblazerb.org/gems/cells/cells4.html#html-escaping).
|
33
33
|
|
34
|
-
## `form_for` Problems
|
35
|
-
|
36
|
-
Haml < 4.1.0 overrides many Rails helpers and introduces bugs. They are fixed in Haml 4.1 (by simply removing the code). In case you're on 4.0.6 and `form_for` doesn't render properly, include `Cell::Haml`.
|
37
|
-
|
38
|
-
```ruby
|
39
|
-
class SongCell < Cell::ViewModel
|
40
|
-
include ActionView::Helpers::FormHelper
|
41
|
-
include Cell::Haml # include Haml _after_ AV helpers.
|
42
|
-
|
43
|
-
# ..
|
44
|
-
end
|
45
|
-
```
|
46
|
-
|
47
34
|
## Dependencies
|
48
35
|
|
49
36
|
This gem works with Tilt 1.4 and 2.0, and hence allows you to use it from Rails 3.2 upwards.
|
data/cells-haml.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_dependency 'cells', '~> 4.0.0.
|
20
|
+
spec.add_dependency 'cells', '~> 4.0.0.beta6'
|
21
21
|
spec.add_dependency 'haml', '~> 4.0'
|
22
22
|
spec.add_development_dependency 'bundler'
|
23
23
|
spec.add_development_dependency 'rake'
|
data/lib/cell/haml.rb
CHANGED
@@ -2,6 +2,19 @@ require 'tilt/haml'
|
|
2
2
|
|
3
3
|
module Cell
|
4
4
|
module Haml
|
5
|
+
def template_options_for(options)
|
6
|
+
{
|
7
|
+
template_class: ::Tilt::HamlTemplate,
|
8
|
+
escape_html: false,
|
9
|
+
escape_attrs: false,
|
10
|
+
suffix: "haml"
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_writer :output_buffer
|
15
|
+
|
16
|
+
include ActionView::Helpers::FormHelper
|
17
|
+
|
5
18
|
# From FormTagHelper. why do they escape every possible string? why?
|
6
19
|
def form_tag_in_block(html_options, &block)
|
7
20
|
content = capture(&block)
|
@@ -12,15 +25,17 @@ module Cell
|
|
12
25
|
"#{form_tag_html(html_options)}" << content.to_s << "</form>"
|
13
26
|
end
|
14
27
|
|
15
|
-
def form_tag_html(html_options)
|
16
|
-
|
17
|
-
|
18
|
-
end
|
28
|
+
# def form_tag_html(html_options)
|
29
|
+
# extra_tags = extra_tags_for_form(html_options)
|
30
|
+
# "#{tag(:form, html_options, true) + extra_tags}"
|
31
|
+
# end
|
19
32
|
|
20
|
-
def form_for(*args, &block) # TODO: remove this once Haml 4.1 is out. the form_for_with_haml is buggy.
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
33
|
+
# def form_for(*args, &block) # TODO: remove this once Haml 4.1 is out. the form_for_with_haml is buggy.
|
34
|
+
# form_for_without_haml(*args, &block)
|
35
|
+
# end
|
24
36
|
|
25
|
-
|
37
|
+
# def content_tag(name, content_or_options_with_block=nil, options=nil, escape=false, &block)
|
38
|
+
# super
|
39
|
+
# end
|
40
|
+
end
|
26
41
|
end
|
data/lib/cell/haml/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
%b Questions: #{render :render_in_render_2}
|
@@ -0,0 +1 @@
|
|
1
|
+
Yes!
|
@@ -1,9 +1,13 @@
|
|
1
1
|
class SongCell < Cell::ViewModel
|
2
2
|
self.view_paths = ["test/dummy/app/cells"]
|
3
3
|
|
4
|
-
|
4
|
+
|
5
5
|
include Cell::Haml
|
6
6
|
|
7
|
+
def protect_against_forgery?
|
8
|
+
false
|
9
|
+
end
|
10
|
+
|
7
11
|
def with_form_tag_and_content_tag
|
8
12
|
render
|
9
13
|
end
|
@@ -36,6 +40,10 @@ class SongCell < Cell::ViewModel
|
|
36
40
|
render
|
37
41
|
end
|
38
42
|
|
43
|
+
def render_in_render
|
44
|
+
render
|
45
|
+
end
|
46
|
+
|
39
47
|
private
|
40
48
|
def cap
|
41
49
|
"yay, #{with_output_buffer { yield } }"
|
data/test/haml_test.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class HamlTest < MiniTest::Spec
|
4
|
-
it { Cell::ViewModel.template_engine.must_equal :haml }
|
5
|
-
|
6
|
-
|
7
4
|
let (:controller) { ApplicationController.new.tap { |ctl| ctl.send("request=", ActionDispatch::Request.new({})) } }
|
8
5
|
let (:song_cell) { SongCell.new(controller) }
|
9
6
|
|
7
|
+
# render in render
|
8
|
+
it { song_cell.(:render_in_render).must_equal "<b>Questions: Yes!</b>\n" }
|
10
9
|
|
11
10
|
# URL helpers work in cell instance.
|
12
11
|
it { song_cell.songs_path.must_equal "/songs" }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells-haml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cells
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 4.0.0.
|
20
|
+
version: 4.0.0.beta6
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 4.0.0.
|
27
|
+
version: 4.0.0.beta6
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: haml
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,8 @@ files:
|
|
94
94
|
- lib/cells-haml.rb
|
95
95
|
- test/cell_generator_test.rb
|
96
96
|
- test/dummy/Rakefile
|
97
|
+
- test/dummy/app/cells/song/render_in_render.haml
|
98
|
+
- test/dummy/app/cells/song/render_in_render_2.haml
|
97
99
|
- test/dummy/app/cells/song/with_content_tag.haml
|
98
100
|
- test/dummy/app/cells/song/with_content_tag_and_content_tag.haml
|
99
101
|
- test/dummy/app/cells/song/with_form_tag_and_content_tag.haml
|
@@ -136,6 +138,8 @@ summary: Haml integration for Cells
|
|
136
138
|
test_files:
|
137
139
|
- test/cell_generator_test.rb
|
138
140
|
- test/dummy/Rakefile
|
141
|
+
- test/dummy/app/cells/song/render_in_render.haml
|
142
|
+
- test/dummy/app/cells/song/render_in_render_2.haml
|
139
143
|
- test/dummy/app/cells/song/with_content_tag.haml
|
140
144
|
- test/dummy/app/cells/song/with_content_tag_and_content_tag.haml
|
141
145
|
- test/dummy/app/cells/song/with_form_tag_and_content_tag.haml
|