cells-slim 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +3 -0
- data/Gemfile +6 -4
- data/README.md +9 -16
- data/cells-slim.gemspec +8 -7
- data/gemfiles/rails4.1.gemfile +3 -3
- data/gemfiles/rails4.2.gemfile +3 -3
- data/lib/cell/slim.rb +66 -0
- data/lib/cell/slim/version.rb +5 -0
- data/lib/cells-slim.rb +1 -0
- data/test/dummy/app/cells/song/render_in_render.slim +1 -0
- data/test/dummy/app/cells/song/render_in_render_2.slim +1 -0
- data/test/dummy/app/cells/song/with_content_tag.slim +1 -0
- data/test/dummy/app/cells/song/with_content_tag_and_content_tag.slim +4 -0
- data/test/dummy/app/cells/song/with_form_tag_and_content_tag.slim +34 -0
- data/test/dummy/app/cells/song_cell.rb +58 -0
- data/test/dummy/config/boot.rb +2 -7
- data/test/dummy/config/routes.rb +1 -1
- data/test/slim_test.rb +46 -3
- data/test/test_helper.rb +4 -8
- metadata +29 -30
- data/Appraisals +0 -9
- data/lib/cells/slim.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f150ba4af0b1d9be44e276ef2082d325632a0e78
|
4
|
+
data.tar.gz: 4a856b33b8fa00d1e9407b77bbf0154121a269a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32f23e27d4f67d50314d41656a4f189304445d14223753ec64de2e2e1245e273dc4143a7cfa7ae984a09aa04e03c81b75bd4ba037bef8cce2139a26a7f6c96a8
|
7
|
+
data.tar.gz: 85b7e71eedc1b18c8164cbaeaadf2a81da8d44a5852b9146154d56aa09fd58d92fb2a6d2e14c2d31410251e4de6f102b19b68a2851268cac343582ad2efeac51
|
data/CHANGES.md
ADDED
data/Gemfile
CHANGED
@@ -3,7 +3,9 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in cells-slim.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
6
|
+
|
7
|
+
gem "railties", "~> 4.2.0"
|
8
|
+
gem "activemodel"
|
9
|
+
gem "minitest", "~> 5.2"
|
10
|
+
|
11
|
+
gem 'cells', path: "../cells"
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Cells::Slim
|
2
2
|
|
3
|
-
|
3
|
+
Support for Slim templates with Cells.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,22 +10,15 @@ Add this line to your application's Gemfile:
|
|
10
10
|
gem 'cells-slim'
|
11
11
|
```
|
12
12
|
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install cells-slim
|
20
|
-
|
21
13
|
## Usage
|
22
14
|
|
23
|
-
|
15
|
+
Outside of Rails, you need to include `Cell::Erb` in your cell.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
class CommentCell < Cell::ViewModel
|
19
|
+
include Cell::Slim
|
20
|
+
```
|
24
21
|
|
25
|
-
##
|
22
|
+
## Documentation
|
26
23
|
|
27
|
-
|
28
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
-
5. Create a new Pull Request
|
24
|
+
[More documentation](http://trailblazerb.org/gems/cells/templates.html) can be found on the Trailblazer page.
|
data/cells-slim.gemspec
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
|
4
|
+
require 'cell/slim/version'
|
5
|
+
|
6
|
+
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = 'cells-slim'
|
7
|
-
spec.version =
|
9
|
+
spec.version = Cell::Slim::VERSION
|
8
10
|
spec.authors = ['Abdelkader Boudih', 'Nick Sutterer']
|
9
11
|
spec.email = %w(terminale@gmail.com apotonick@gmail.com)
|
10
|
-
spec.summary = 'Slim integration for
|
12
|
+
spec.summary = 'Slim integration for Cells.'
|
11
13
|
spec.description = spec.summary
|
12
14
|
spec.homepage = 'https://github.com/trailblazer/cells-slim'
|
13
15
|
spec.license = 'MIT'
|
@@ -16,9 +18,8 @@ Gem::Specification.new do |spec|
|
|
16
18
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
17
19
|
spec.require_paths = ['lib']
|
18
20
|
|
19
|
-
spec.add_runtime_dependency 'cells', '~> 4.0.0.
|
21
|
+
spec.add_runtime_dependency 'cells', '~> 4.0.0.beta6'
|
20
22
|
spec.add_runtime_dependency 'slim', '~> 3.0'
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency '
|
23
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
|
+
spec.add_development_dependency 'rake'
|
24
25
|
end
|
data/gemfiles/rails4.1.gemfile
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
+
gem "pry-byebug", :platforms => [:mri_20, :mri_21]
|
5
6
|
gem "appraisal"
|
6
7
|
gem "minitest-reporters"
|
7
|
-
gem
|
8
|
-
gem "railties",
|
9
|
-
gem "activemodel", :github => "rails/rails", :branch => "4-1-stable"
|
8
|
+
gem "cells", :github => "apotonick/cells", :branch => "cells-4"
|
9
|
+
gem "railties", "~> 4.1.0"
|
10
10
|
gem "minitest", "~> 5.2"
|
11
11
|
|
12
12
|
gemspec :path => "../"
|
data/gemfiles/rails4.2.gemfile
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
+
gem "pry-byebug", :platforms => [:mri_20, :mri_21]
|
5
6
|
gem "appraisal"
|
6
7
|
gem "minitest-reporters"
|
7
|
-
gem
|
8
|
-
gem "railties",
|
9
|
-
gem "activemodel", :github => "rails/rails", :branch => "4-2-stable"
|
8
|
+
gem "cells", :github => "apotonick/cells", :branch => "cells-4"
|
9
|
+
gem "railties", "~> 4.2.0"
|
10
10
|
gem "minitest", "~> 5.2"
|
11
11
|
|
12
12
|
gemspec :path => "../"
|
data/lib/cell/slim.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require "slim"
|
2
|
+
require "cells"
|
3
|
+
|
4
|
+
module Cell
|
5
|
+
module Slim
|
6
|
+
def render_template(*)
|
7
|
+
old_output_buffer = @output_buffer
|
8
|
+
super
|
9
|
+
ensure
|
10
|
+
@output_buffer = old_output_buffer
|
11
|
+
end
|
12
|
+
|
13
|
+
def template_options_for(options)
|
14
|
+
{
|
15
|
+
template_class: ::Slim::Template,
|
16
|
+
suffix: "slim",
|
17
|
+
disable_escape: true,
|
18
|
+
escape_code: false,
|
19
|
+
use_html_safe: false,
|
20
|
+
buffer: "@output_buffer"
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
include ActionView::Helpers::FormHelper
|
25
|
+
|
26
|
+
def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new)
|
27
|
+
@output_buffer, old_buffer = block_buffer, @output_buffer
|
28
|
+
yield
|
29
|
+
@output_buffer = old_buffer
|
30
|
+
|
31
|
+
block_buffer
|
32
|
+
end
|
33
|
+
|
34
|
+
def capture(*args)
|
35
|
+
value = nil
|
36
|
+
buffer = with_output_buffer { value = yield(*args) }
|
37
|
+
|
38
|
+
return buffer.to_s if buffer.size > 0
|
39
|
+
value # this applies for "Beachparty" string-only statements.
|
40
|
+
end
|
41
|
+
|
42
|
+
# From FormTagHelper. why do they escape every possible string? why?
|
43
|
+
def form_tag_in_block(html_options, &block)
|
44
|
+
content = capture(&block)
|
45
|
+
form_tag_with_body(html_options, content)
|
46
|
+
end
|
47
|
+
|
48
|
+
def form_tag_with_body(html_options, content)
|
49
|
+
"#{form_tag_html(html_options)}" << content.to_s << "</form>"
|
50
|
+
end
|
51
|
+
|
52
|
+
def form_tag_html(html_options)
|
53
|
+
extra_tags = extra_tags_for_form(html_options)
|
54
|
+
"#{tag(:form, html_options, true) + extra_tags}"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Rails 4.0, TagHelper.
|
58
|
+
def tag_option(key, value, escape)
|
59
|
+
super(key, value, false)
|
60
|
+
end
|
61
|
+
|
62
|
+
def content_tag_string(name, content, options, escape=true)
|
63
|
+
super(name, content, options, false)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/cells-slim.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "cell/slim"
|
@@ -0,0 +1 @@
|
|
1
|
+
b Questions: #{render :render_in_render_2}
|
@@ -0,0 +1 @@
|
|
1
|
+
| Yes!
|
@@ -0,0 +1 @@
|
|
1
|
+
= content_tag(:div) { "Beachparty" }
|
@@ -0,0 +1,34 @@
|
|
1
|
+
| Word.
|
2
|
+
|
3
|
+
= form_tag "/erubis/is/horribly/outdated"
|
4
|
+
= text_field_tag :id
|
5
|
+
= link_to "/rails/sucks"
|
6
|
+
| hallo
|
7
|
+
|
8
|
+
= content_tag(:ul)
|
9
|
+
| Hallo
|
10
|
+
|
11
|
+
- answer = "<script>oui!</script>"
|
12
|
+
|
13
|
+
/ test content rendering in capture.
|
14
|
+
- content = capture do
|
15
|
+
| Bonjour!
|
16
|
+
= link_to "Coffee?", "/coffee"
|
17
|
+
b Yes please!
|
18
|
+
== answer
|
19
|
+
|
20
|
+
| Weiter!
|
21
|
+
|
22
|
+
== content
|
23
|
+
|
24
|
+
- breadcrumbs = capture do
|
25
|
+
- [link_to("1", "/1"), link_to("2", "/2")].join("+")
|
26
|
+
|
27
|
+
= breadcrumbs
|
28
|
+
|
29
|
+
= current_page
|
30
|
+
= form_tag_with_body( {url: "/rails/escapes/too/much"}, %{<input type="button"/>})
|
31
|
+
|
32
|
+
|
33
|
+
= form_for OpenStruct.new, url: "/", as: "open" do |f|
|
34
|
+
= f.text_field :id
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class SongCell < Cell::ViewModel
|
2
|
+
self.view_paths = ["test/dummy/app/cells"]
|
3
|
+
|
4
|
+
|
5
|
+
include Cell::Slim
|
6
|
+
|
7
|
+
def protect_against_forgery?
|
8
|
+
false
|
9
|
+
end
|
10
|
+
|
11
|
+
def with_form_tag_and_content_tag
|
12
|
+
render
|
13
|
+
end
|
14
|
+
|
15
|
+
def with_content_tag_and_content_tag
|
16
|
+
render
|
17
|
+
end
|
18
|
+
|
19
|
+
def with_content_tag
|
20
|
+
render
|
21
|
+
end
|
22
|
+
|
23
|
+
def with_block
|
24
|
+
render
|
25
|
+
end
|
26
|
+
|
27
|
+
def with_capture
|
28
|
+
render
|
29
|
+
end
|
30
|
+
|
31
|
+
def with_form_tag
|
32
|
+
form_tag("/songs") + content_tag(:span) + "</form>"
|
33
|
+
end
|
34
|
+
|
35
|
+
def with_link_to
|
36
|
+
render
|
37
|
+
end
|
38
|
+
|
39
|
+
def with_form_for_block
|
40
|
+
render
|
41
|
+
end
|
42
|
+
|
43
|
+
def render_in_render
|
44
|
+
render
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def cap
|
49
|
+
"yay, #{with_output_buffer { yield } }"
|
50
|
+
end
|
51
|
+
|
52
|
+
def current_page
|
53
|
+
capture do # FIXME: this escapes!
|
54
|
+
#[link_to("1", "/1"), link_to("2", "/2")].join("+") # this breaks, too!
|
55
|
+
"<b>No current page!<b>".html_safe
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
|
-
|
4
|
-
if File.exist?(gemfile)
|
5
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
6
|
-
require 'bundler'
|
7
|
-
Bundler.setup
|
8
|
-
end
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.setup
|
9
4
|
|
10
5
|
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
data/test/dummy/config/routes.rb
CHANGED
data/test/slim_test.rb
CHANGED
@@ -1,9 +1,52 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class SlimTest < MiniTest::
|
3
|
+
class SlimTest < MiniTest::Spec
|
4
|
+
let (:controller) { ApplicationController.new.tap { |ctl| ctl.send("request=", ActionDispatch::Request.new({})) } }
|
5
|
+
let (:song_cell) { SongCell.new(controller) }
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
# render in render
|
8
|
+
it("bla") { song_cell.(:render_in_render).must_equal "<b>Questions: Yes!</b>" }
|
9
|
+
|
10
|
+
# content_tag { }
|
11
|
+
it { song_cell.(:with_content_tag).must_equal "<div>Beachparty</div>" }
|
12
|
+
|
13
|
+
# content_tag { content_tag { } }
|
14
|
+
it do song_cell.(:with_content_tag_and_content_tag).must_equal %{<span>Title:<div>Still Knee Deep</div></span>}
|
15
|
+
end
|
16
|
+
|
17
|
+
# form_tag { content_tag { } }
|
18
|
+
it( "xxx") do
|
19
|
+
form_tag = "<form action=\"/erubis/is/horribly/outdated\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" />"
|
20
|
+
form_tag = "<form accept-charset=\"UTF-8\" action=\"/erubis/is/horribly/outdated\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /></div>" if ActionPack::VERSION::MAJOR == 3
|
21
|
+
|
22
|
+
input_tag = %{<input type="text" name="id" id="id" />}
|
23
|
+
input_tag = "<input id=\"id\" name=\"id\" type=\"text\" />" if ActionPack::VERSION::MAJOR == 3
|
24
|
+
|
25
|
+
form_with_body_tag = "<form url=\"/rails/escapes/too/much\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input type=\"button\"/></form>"
|
26
|
+
form_with_body_tag = "<form method=\"post\" url=\"/rails/escapes/too/much\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /></div><input type=\"button\"/></form>" if ActionPack::VERSION::MAJOR == 3
|
27
|
+
|
28
|
+
form_for_tag = "<form class=\"new_open\" id=\"new_open\" action=\"/\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input type=\"text\" name=\"open[id]\" id=\"open_id\" />"
|
29
|
+
form_for_tag = "<form accept-charset=\"UTF-8\" action=\"/\" class=\"new_open\" id=\"new_open\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /></div><input id=\"open_id\" name=\"open[id]\" size=\"30\" type=\"text\" />" if ActionPack::VERSION::MAJOR == 3
|
30
|
+
|
31
|
+
song_cell.(:with_form_tag_and_content_tag).must_equal %{Word.
|
32
|
+
#{form_tag}
|
33
|
+
#{input_tag}
|
34
|
+
<a href=\"/rails/sucks\">hallo
|
35
|
+
</a>
|
36
|
+
<ul>Hallo
|
37
|
+
</ul>
|
38
|
+
</form>
|
39
|
+
Weiter!
|
40
|
+
Bonjour!
|
41
|
+
<a href=\"/coffee\">Coffee?</a>
|
42
|
+
<b>Yes please!</b>
|
43
|
+
<script>oui!</script>
|
44
|
+
<a href=\"/1\">1</a>+<a href=\"/2\">2</a>
|
45
|
+
<b>No current page!<b>
|
46
|
+
#{form_with_body_tag}
|
47
|
+
#{form_for_tag}
|
48
|
+
</form>
|
49
|
+
}.gsub("\n", "").gsub(" ", "")
|
7
50
|
end
|
8
51
|
|
9
52
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
|
-
begin
|
2
|
-
require 'byebug'
|
3
|
-
rescue LoadError
|
4
|
-
end
|
5
1
|
require 'minitest/autorun'
|
6
2
|
|
7
|
-
require 'minitest/reporters'
|
8
|
-
Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new]
|
9
|
-
|
10
3
|
ENV['RAILS_ENV'] = 'test'
|
11
4
|
|
12
|
-
require 'cells/slim'
|
13
5
|
require_relative 'dummy/config/environment'
|
14
6
|
require "rails/test_help" # adds stuff like @routes, etc.
|
15
7
|
|
8
|
+
require "cell/railtie"
|
9
|
+
require 'cell/slim'
|
10
|
+
|
11
|
+
# Cell::ViewModel.send :include, Cell::Slim
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells-slim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-05 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: slim
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,49 +39,35 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '3.0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: tilt
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 1.4.1
|
49
|
-
type: :runtime
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 1.4.1
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: bundler
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
59
45
|
requirements:
|
60
46
|
- - ">="
|
61
47
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
48
|
+
version: '0'
|
63
49
|
type: :development
|
64
50
|
prerelease: false
|
65
51
|
version_requirements: !ruby/object:Gem::Requirement
|
66
52
|
requirements:
|
67
53
|
- - ">="
|
68
54
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
55
|
+
version: '0'
|
70
56
|
- !ruby/object:Gem::Dependency
|
71
57
|
name: rake
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
73
59
|
requirements:
|
74
|
-
- - "
|
60
|
+
- - ">="
|
75
61
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
62
|
+
version: '0'
|
77
63
|
type: :development
|
78
64
|
prerelease: false
|
79
65
|
version_requirements: !ruby/object:Gem::Requirement
|
80
66
|
requirements:
|
81
|
-
- - "
|
67
|
+
- - ">="
|
82
68
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
84
|
-
description: Slim integration for
|
69
|
+
version: '0'
|
70
|
+
description: Slim integration for Cells.
|
85
71
|
email:
|
86
72
|
- terminale@gmail.com
|
87
73
|
- apotonick@gmail.com
|
@@ -91,7 +77,7 @@ extra_rdoc_files: []
|
|
91
77
|
files:
|
92
78
|
- ".gitignore"
|
93
79
|
- ".travis.yml"
|
94
|
-
-
|
80
|
+
- CHANGES.md
|
95
81
|
- Gemfile
|
96
82
|
- LICENSE.txt
|
97
83
|
- README.md
|
@@ -99,8 +85,16 @@ files:
|
|
99
85
|
- cells-slim.gemspec
|
100
86
|
- gemfiles/rails4.1.gemfile
|
101
87
|
- gemfiles/rails4.2.gemfile
|
102
|
-
- lib/
|
88
|
+
- lib/cell/slim.rb
|
89
|
+
- lib/cell/slim/version.rb
|
90
|
+
- lib/cells-slim.rb
|
103
91
|
- test/dummy/Rakefile
|
92
|
+
- test/dummy/app/cells/song/render_in_render.slim
|
93
|
+
- test/dummy/app/cells/song/render_in_render_2.slim
|
94
|
+
- test/dummy/app/cells/song/with_content_tag.slim
|
95
|
+
- test/dummy/app/cells/song/with_content_tag_and_content_tag.slim
|
96
|
+
- test/dummy/app/cells/song/with_form_tag_and_content_tag.slim
|
97
|
+
- test/dummy/app/cells/song_cell.rb
|
104
98
|
- test/dummy/app/controllers/application_controller.rb
|
105
99
|
- test/dummy/config.ru
|
106
100
|
- test/dummy/config/application.rb
|
@@ -130,12 +124,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
124
|
version: '0'
|
131
125
|
requirements: []
|
132
126
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.2.2
|
134
128
|
signing_key:
|
135
129
|
specification_version: 4
|
136
|
-
summary: Slim integration for
|
130
|
+
summary: Slim integration for Cells.
|
137
131
|
test_files:
|
138
132
|
- test/dummy/Rakefile
|
133
|
+
- test/dummy/app/cells/song/render_in_render.slim
|
134
|
+
- test/dummy/app/cells/song/render_in_render_2.slim
|
135
|
+
- test/dummy/app/cells/song/with_content_tag.slim
|
136
|
+
- test/dummy/app/cells/song/with_content_tag_and_content_tag.slim
|
137
|
+
- test/dummy/app/cells/song/with_form_tag_and_content_tag.slim
|
138
|
+
- test/dummy/app/cells/song_cell.rb
|
139
139
|
- test/dummy/app/controllers/application_controller.rb
|
140
140
|
- test/dummy/config.ru
|
141
141
|
- test/dummy/config/application.rb
|
@@ -145,4 +145,3 @@ test_files:
|
|
145
145
|
- test/dummy/script/rails
|
146
146
|
- test/slim_test.rb
|
147
147
|
- test/test_helper.rb
|
148
|
-
has_rdoc:
|
data/Appraisals
DELETED
data/lib/cells/slim.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'slim'
|
2
|
-
require 'cells'
|
3
|
-
|
4
|
-
Tilt.register 'Slim::Template', 'slim', 'slim'
|
5
|
-
|
6
|
-
module Cell
|
7
|
-
module Slim
|
8
|
-
class OutputBuffer < String
|
9
|
-
end
|
10
|
-
|
11
|
-
def with_output_buffer(buf = nil)
|
12
|
-
unless buf
|
13
|
-
buf = OutputBuffer.new
|
14
|
-
end
|
15
|
-
self.output_buffer, old_buffer = buf, output_buffer
|
16
|
-
yield
|
17
|
-
output_buffer
|
18
|
-
ensure
|
19
|
-
self.output_buffer = old_buffer
|
20
|
-
end
|
21
|
-
|
22
|
-
def capture(*args,&block)
|
23
|
-
value = nil
|
24
|
-
buffer = with_output_buffer() { value = yield(*args) }
|
25
|
-
if string = buffer.presence || value and string.is_a?(String)
|
26
|
-
return string
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# From FormTagHelper. why do they escape every possible string? why?
|
31
|
-
def form_tag_in_block(html_options, &block)
|
32
|
-
content = capture(&block)
|
33
|
-
"#{form_tag_html(html_options)}" << content << "</form>"
|
34
|
-
end
|
35
|
-
|
36
|
-
def form_tag_html(html_options)
|
37
|
-
extra_tags = extra_tags_for_form(html_options)
|
38
|
-
"#{tag(:form, html_options, true) + extra_tags}"
|
39
|
-
end
|
40
|
-
|
41
|
-
def tag_option(key, value, escape)
|
42
|
-
super(key, value, false)
|
43
|
-
end
|
44
|
-
|
45
|
-
def content_tag_string(name, content, options, escape=true)
|
46
|
-
super(name, content, options, false)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
ViewModel.class_eval do
|
51
|
-
include Slim
|
52
|
-
end
|
53
|
-
|
54
|
-
ViewModel.template_engine = :slim
|
55
|
-
end
|