coffee-views 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +23 -11
- data/coffee-views.gemspec +1 -1
- data/lib/coffee_views/slim.rb +8 -2
- data/lib/coffee_views/version.rb +1 -1
- metadata +19 -19
data/README.md
CHANGED
@@ -7,17 +7,23 @@ Inspired by [coffeebeans](https://github.com/markbates/coffeebeans) but with fix
|
|
7
7
|
|
8
8
|
Use #to_json in safe mode
|
9
9
|
|
10
|
-
|
10
|
+
``` erb
|
11
|
+
<%= x %> # replaced with `<%== (x).to_json %>`
|
12
|
+
```
|
11
13
|
|
12
14
|
Use raw mode in raw mode
|
13
|
-
|
14
|
-
|
15
|
+
|
16
|
+
``` erb
|
17
|
+
<%== x %> # replaced with `<%== x %>`
|
18
|
+
```
|
15
19
|
|
16
20
|
Installation
|
17
21
|
------------
|
18
22
|
In your Gemfile:
|
19
23
|
|
20
|
-
|
24
|
+
``` ruby
|
25
|
+
gem "coffee-views"
|
26
|
+
```
|
21
27
|
|
22
28
|
Dependencies
|
23
29
|
------------
|
@@ -27,18 +33,24 @@ This library depends on the `coffee-script` gem
|
|
27
33
|
Usage
|
28
34
|
-----
|
29
35
|
|
30
|
-
|
31
|
-
|
36
|
+
``` coffee
|
37
|
+
# in create.js.coffee
|
38
|
+
$("#item").html <%= render "user/card" %>
|
39
|
+
```
|
32
40
|
|
33
41
|
Note: There is no need to call `j` or `escape_javascipt` helpers.
|
34
42
|
|
35
43
|
Coffee Script string interpolation like syntax (`#{=}` for safe and `#{==}` for raw):
|
36
44
|
|
37
|
-
|
38
|
-
|
45
|
+
``` coffee
|
46
|
+
# in update.js.coffee
|
47
|
+
alert "hello #{= @user.name}"
|
48
|
+
```
|
39
49
|
|
40
50
|
You can use `coffeeview:` embedded engine in [slim](http://slim-lang.com/)
|
41
51
|
|
42
|
-
|
43
|
-
|
44
|
-
|
52
|
+
``` slim
|
53
|
+
h1 Say Hi
|
54
|
+
coffeeview:
|
55
|
+
alert <%= @some_view_string %>
|
56
|
+
```
|
data/coffee-views.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.require_path = 'lib'
|
18
18
|
|
19
|
-
s.add_dependency "rails", "
|
19
|
+
s.add_dependency "rails", ">= 3.1.0"
|
20
20
|
s.add_dependency "coffee-rails"
|
21
21
|
s.add_development_dependency "sqlite3"
|
22
22
|
s.add_development_dependency "rspec-rails", "~> 2.6"
|
data/lib/coffee_views/slim.rb
CHANGED
@@ -5,8 +5,14 @@ ActiveSupport.on_load(:action_view) do
|
|
5
5
|
module CoffeeViews
|
6
6
|
class CoffeeViewEngine < Slim::EmbeddedEngine::ERBEngine
|
7
7
|
def on_slim_embedded(engine, body)
|
8
|
-
source = CoffeeViews::Rails::TemplateHandler.compile_coffee(
|
9
|
-
|
8
|
+
source = CoffeeViews::Rails::TemplateHandler.compile_coffee(collect_text(body))
|
9
|
+
[:multi, [:newline], Temple::ERB::Parser.new.call(source)]
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def collect_text(body)
|
15
|
+
::Slim::CollectText.new.call(body)
|
10
16
|
end
|
11
17
|
end
|
12
18
|
|
data/lib/coffee_views/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee-views
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70113806209320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70113806209320
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: coffee-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70113806222720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70113806222720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sqlite3
|
38
|
-
requirement: &
|
38
|
+
requirement: &70113806220560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70113806220560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec-rails
|
49
|
-
requirement: &
|
49
|
+
requirement: &70113806217600 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2.6'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70113806217600
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sass-rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &70113806215340 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70113806215340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: coffee-rails
|
71
|
-
requirement: &
|
71
|
+
requirement: &70113806228380 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70113806228380
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: uglifier
|
82
|
-
requirement: &
|
82
|
+
requirement: &70113806227060 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70113806227060
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: slim
|
93
|
-
requirement: &
|
93
|
+
requirement: &70113806225100 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70113806225100
|
102
102
|
description: Allows you to create .js.coffee views
|
103
103
|
email: yury.korolev@gmail.com
|
104
104
|
executables: []
|