angular-rails-templates 0.1.3 → 0.1.4
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/README.md +13 -3
- data/lib/angular-rails-templates/engine.rb +1 -1
- data/lib/angular-rails-templates/template.rb +9 -3
- data/lib/angular-rails-templates/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80d31599aa89eaff14f2cdd3d038af6ce98a8d0e
|
4
|
+
data.tar.gz: c6dbc186816c5cf864ab9d49434d21a684e88963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bc1093fa5a7b526d1fbbbadad85e21f593070ce30cca92ce25d41e157513218105b5b922ea955b142c572b06c0824080b24b46b0e210d2e821c5d1a33bea60b
|
7
|
+
data.tar.gz: 804162cf26a4d48e3044c8a1418a627d485b9fad6b54a6f229e208d8bc1314ee2bfc41f7efff0fd40d69ecc2eb8e54dfcfb591e0c2e08399f98cb619f3353e27
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Then, in your `application.js` file, require `angular-rails-templates` and your
|
|
26
26
|
// Templates in app/assets/javascript/templates
|
27
27
|
//= require_tree ./templates
|
28
28
|
// OR
|
29
|
-
// Templates in app/assets/templates
|
29
|
+
// Templates in app/assets/templates (but see step 5)
|
30
30
|
//= require_tree ../templates
|
31
31
|
```
|
32
32
|
|
@@ -51,7 +51,7 @@ Angular Rails Templates will try to load support for the following markups if th
|
|
51
51
|
| .str | - |
|
52
52
|
| .haml | haml |
|
53
53
|
| .slim | slim |
|
54
|
-
| .md | liquid, rdiscount,
|
54
|
+
| .md | liquid, rdiscount, redcarpet, bluecloth, kramdown, maruku |
|
55
55
|
|
56
56
|
See [Advanced](#advanced-configuration) if you would like to use other markup languages.
|
57
57
|
|
@@ -77,13 +77,23 @@ modals/dialog.html.slim.erb.str => modals/dialog.html # don't do this
|
|
77
77
|
|
78
78
|
The templates can then be accessed via `templateUrl` as expected:
|
79
79
|
|
80
|
-
```
|
80
|
+
```javascript
|
81
81
|
// Template: app/assets/templates/yourTemplate.html.haml
|
82
82
|
{
|
83
83
|
templateUrl: 'yourTemplate.html'
|
84
84
|
}
|
85
85
|
```
|
86
86
|
|
87
|
+
Or anything else that uses `$templateCache` or `$templateRequest`
|
88
|
+
|
89
|
+
```html
|
90
|
+
<div ng-include='"yourTemplate.html"'></div>
|
91
|
+
```
|
92
|
+
|
93
|
+
### 5. Avoid name collisions
|
94
|
+
|
95
|
+
If you have `app/assets/javascript/user.js` and `app/assets/templates/user.html`, the former one will actually hide the latter. This is due to how Rails asset pipeline sees asset files, both are served under `/assets/user.js`. Please use namespacing to combat this issue.
|
96
|
+
|
87
97
|
## Advanced Configuration
|
88
98
|
|
89
99
|
Angular Rails Templates has some configuration options that can be set inside `config/application.rb`
|
@@ -23,7 +23,7 @@ module AngularRailsTemplates
|
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
|
-
initializer 'angular-rails-templates' do |app|
|
26
|
+
initializer 'angular-rails-templates', group: :all do |app|
|
27
27
|
if app.config.assets
|
28
28
|
require 'sprockets'
|
29
29
|
require 'sprockets/engines' # load sprockets for Rails 3
|
@@ -10,9 +10,11 @@ module AngularRailsTemplates
|
|
10
10
|
'application/javascript'
|
11
11
|
end
|
12
12
|
|
13
|
-
# this method is mandatory on Tilt::Template subclasses
|
14
13
|
def prepare
|
15
|
-
|
14
|
+
# we only want to process html assets inside Rails.root/app/assets
|
15
|
+
@asset_inside_rails_root = file.match "#{Rails.root.join 'app', 'assets'}"
|
16
|
+
|
17
|
+
if configuration.htmlcompressor and @asset_inside_rails_root
|
16
18
|
@data = compress data
|
17
19
|
end
|
18
20
|
end
|
@@ -23,7 +25,11 @@ module AngularRailsTemplates
|
|
23
25
|
locals[:source_file] = "#{scope.pathname}".sub(/^#{Rails.root}\//,'')
|
24
26
|
locals[:angular_module] = configuration.module_name
|
25
27
|
|
26
|
-
|
28
|
+
if @asset_inside_rails_root
|
29
|
+
AngularJsTemplateWrapper.render(scope, locals)
|
30
|
+
else
|
31
|
+
data
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
35
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angular-rails-templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damien Mathieu
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.2.
|
135
|
+
rubygems_version: 2.2.2
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Use your angular templates with rails' asset pipeline
|