angular-rails-templates 0.1.2 → 0.1.3
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 +3 -3
- data/lib/angular-rails-templates/engine.rb +22 -12
- data/lib/angular-rails-templates/template.rb +1 -1
- data/lib/angular-rails-templates/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95ece303d7645e28620e1d23962f25cc83b8bbd6
|
4
|
+
data.tar.gz: 027e3a27b77c858645ca73cddf819358bd625fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70acb2c79fa6ff46f32ddab5262c2213fd5890015405b983b63627c3dfb2f6c86984c15d85fb8e1f6da62b3d0434752395ddc8e919f0f4519bb455ce63f92163
|
7
|
+
data.tar.gz: bf103ce7edd782659b62ae11d4c4cc09ae550140d4b5d51d2e47355c9ad22cecc5de074ada646e2c3f791cda875d9dc015ba8e8ff02a242475fbdc7cb7bc88f9
|
data/README.md
CHANGED
@@ -92,7 +92,7 @@ Here are their default values:
|
|
92
92
|
```ruby
|
93
93
|
# config/application.rb
|
94
94
|
config.angular_templates.module_name = 'templates'
|
95
|
-
config.angular_templates.ignore_prefix =
|
95
|
+
config.angular_templates.ignore_prefix = %w(templates/)
|
96
96
|
config.angular_templates.markups = %w(erb str haml slim md)
|
97
97
|
config.angular_templates.htmlcompressor = false
|
98
98
|
```
|
@@ -114,9 +114,9 @@ Although it is not recommended, you can set `module_name` to the name of your ma
|
|
114
114
|
|
115
115
|
`ignore_prefix` will be stripped from the beginning of the `templateUrl` it reports to angularjs.
|
116
116
|
|
117
|
-
Since the default ignore_prefix is `templates
|
117
|
+
Since the default ignore_prefix is [`templates/`], any templates placed under `app/assets/javascripts/templates` will automatically have short names. If your templates are not in this location, you will need to use the full path to the template.
|
118
118
|
|
119
|
-
You can set `config.angular_templates.ignore_prefix` to change the default ignore prefix. Default is `templates
|
119
|
+
You can set `config.angular_templates.ignore_prefix` to change the default ignore prefix. Default is [`templates/`].
|
120
120
|
|
121
121
|
|
122
122
|
``` javascript
|
@@ -4,24 +4,26 @@ module AngularRailsTemplates
|
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
config.angular_templates = ActiveSupport::OrderedOptions.new
|
6
6
|
config.angular_templates.module_name = 'templates'
|
7
|
-
config.angular_templates.ignore_prefix = 'templates/'
|
7
|
+
config.angular_templates.ignore_prefix = ['templates/']
|
8
8
|
config.angular_templates.markups = []
|
9
9
|
config.angular_templates.htmlcompressor = false
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
config.before_configuration do |app|
|
12
|
+
# try loading common markups
|
13
|
+
%w(erb haml liquid md radius slim str textile wiki).
|
14
|
+
each do |ext|
|
15
|
+
begin
|
16
|
+
silence_warnings do
|
17
|
+
config.angular_templates.markups << ext if Tilt[ext]
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
# They don't have the required library required. Oh well.
|
17
21
|
end
|
18
|
-
rescue LoadError
|
19
|
-
# They don't have the required library required. Oh well.
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
25
|
|
24
|
-
|
26
|
+
initializer 'angular-rails-templates' do |app|
|
25
27
|
if app.config.assets
|
26
28
|
require 'sprockets'
|
27
29
|
require 'sprockets/engines' # load sprockets for Rails 3
|
@@ -44,11 +46,11 @@ module AngularRailsTemplates
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
|
49
|
+
app.assets.register_engine ".#{ext}", mimeless_engine
|
48
50
|
end
|
49
51
|
|
50
52
|
# This engine wraps the HTML into JS
|
51
|
-
|
53
|
+
app.assets.register_engine '.html', AngularRailsTemplates::Template
|
52
54
|
end
|
53
55
|
|
54
56
|
# Sprockets Cache Busting
|
@@ -59,5 +61,13 @@ module AngularRailsTemplates
|
|
59
61
|
Digest::MD5.hexdigest("#{VERSION}-#{app.config.angular_templates}")
|
60
62
|
].join '-'
|
61
63
|
end
|
64
|
+
|
65
|
+
|
66
|
+
config.after_initialize do |app|
|
67
|
+
# Ensure ignore_prefix can be passed as a String or Array
|
68
|
+
if app.config.angular_templates.ignore_prefix.is_a? String
|
69
|
+
app.config.angular_templates.ignore_prefix = Array(app.config.angular_templates.ignore_prefix)
|
70
|
+
end
|
71
|
+
end
|
62
72
|
end
|
63
73
|
end
|
@@ -29,7 +29,7 @@ module AngularRailsTemplates
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def logical_template_path(scope)
|
32
|
-
path = scope.logical_path.sub
|
32
|
+
path = scope.logical_path.sub /^(#{configuration.ignore_prefix.join('|')})/, ''
|
33
33
|
"#{path}.html"
|
34
34
|
end
|
35
35
|
|
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.3
|
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-
|
13
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|