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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95ece303d7645e28620e1d23962f25cc83b8bbd6
4
- data.tar.gz: 027e3a27b77c858645ca73cddf819358bd625fb2
3
+ metadata.gz: 80d31599aa89eaff14f2cdd3d038af6ce98a8d0e
4
+ data.tar.gz: c6dbc186816c5cf864ab9d49434d21a684e88963
5
5
  SHA512:
6
- metadata.gz: 70acb2c79fa6ff46f32ddab5262c2213fd5890015405b983b63627c3dfb2f6c86984c15d85fb8e1f6da62b3d0434752395ddc8e919f0f4519bb455ce63f92163
7
- data.tar.gz: bf103ce7edd782659b62ae11d4c4cc09ae550140d4b5d51d2e47355c9ad22cecc5de074ada646e2c3f791cda875d9dc015ba8e8ff02a242475fbdc7cb7bc88f9
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, redcrpet, bluecloth, kramdown, maruku |
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
- ``` javascript
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
- if configuration.htmlcompressor
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
- AngularJsTemplateWrapper.render(scope, locals)
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
@@ -1,3 +1,3 @@
1
1
  module AngularRailsTemplates
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
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.3
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: 2014-07-02 00:00:00.000000000 Z
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.0
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