smt_rails 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -20,21 +20,21 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ rails g smt_rails:install
|
22
22
|
|
23
|
-
Generator add into "application.js" requirements for mustache and "templates" folder in "app
|
23
|
+
Generator add into "application.js" requirements for mustache and "templates" folder in "app". Next you can create mustache templates in this folder or subfolders.
|
24
24
|
|
25
25
|
For example:
|
26
26
|
|
27
|
-
File: "app/
|
27
|
+
File: "app/templates/tests/_test.mustache"
|
28
28
|
|
29
29
|
Hello {{msg}}!!!
|
30
30
|
|
31
31
|
In view you can render this template by this way:
|
32
32
|
|
33
|
-
<%= render "
|
33
|
+
<%= render "tests/test", :mustache => {msg: "Test"} %>
|
34
34
|
|
35
35
|
The same template you can render in JavaScript:
|
36
36
|
|
37
|
-
var content = SMT['
|
37
|
+
var content = SMT['tests/test']({msg: "Test"});
|
38
38
|
|
39
39
|
## Configuration
|
40
40
|
|
@@ -24,7 +24,7 @@ module SmtRails
|
|
24
24
|
out = ""
|
25
25
|
out << "//= require mustache"
|
26
26
|
out << "\n"
|
27
|
-
out << "//= require_tree
|
27
|
+
out << "//= require_tree ../../#{template_dir}"
|
28
28
|
out << "\n"
|
29
29
|
out << "\n"
|
30
30
|
end
|
@@ -32,7 +32,7 @@ module SmtRails
|
|
32
32
|
|
33
33
|
def create_dir
|
34
34
|
template_dir = options[:template_dir]
|
35
|
-
empty_directory "#{
|
35
|
+
empty_directory "#{app_path}/#{template_dir}"
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
data/lib/smt_rails/engine.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module SmtRails
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
config.before_configuration do |app|
|
4
|
+
app.paths['app/views'] << Rails.root.join("app", "templates")
|
5
|
+
end
|
6
|
+
|
3
7
|
initializer "sprockets.smt_rails", :after => "sprockets.environment", :group => :all do |app|
|
4
8
|
next unless app.assets
|
5
9
|
app.assets.register_engine(".#{SmtRails.template_extension}", Tilt)
|
6
|
-
app.config.assets.paths << Rails.root.join("app", "
|
10
|
+
app.config.assets.paths << Rails.root.join("app", "templates")
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/smt_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smt_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70341313942080 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.1.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70341313942080
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: tilt
|
28
|
-
requirement: &
|
28
|
+
requirement: &70341313941340 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.3.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70341313941340
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sprockets
|
39
|
-
requirement: &
|
39
|
+
requirement: &70341313940220 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 2.0.3
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70341313940220
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: mustache
|
50
|
-
requirement: &
|
50
|
+
requirement: &70341313939240 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: 0.99.4
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70341313939240
|
59
59
|
description: Shared mustache templates for rails 3
|
60
60
|
email:
|
61
61
|
- contacts@railsware.com
|