angular-rails-templates 0.0.3 → 0.0.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.
@@ -1 +0,0 @@
1
- angular.module(<%= Rails.configuration.angular_templates.module_name.inspect %> , window.AngularRailsTemplates);
@@ -2,6 +2,7 @@ module AngularRailsTemplates
2
2
  class Engine < ::Rails::Engine
3
3
  config.angular_templates = ActiveSupport::OrderedOptions.new
4
4
  config.angular_templates.module_name = 'templates'
5
+ config.angular_templates.ignore_prefix = 'templates/'
5
6
 
6
7
  config.before_initialize do |app|
7
8
  Sprockets::Engines #force autoloading
@@ -14,20 +14,21 @@ module AngularRailsTemplates
14
14
  logical_template_path = logical_template_path(scope)
15
15
 
16
16
  <<-EOS
17
- angular.module(#{module_name.inspect}, []).run(["$templateCache",function($templateCache) {
17
+
18
+ window.AngularRailsTemplates || (window.AngularRailsTemplates = angular.module(#{module_name.inspect}, []));
19
+
20
+ window.AngularRailsTemplates.run(["$templateCache",function($templateCache) {
18
21
  $templateCache.put(#{logical_template_path.inspect}, #{data.to_json});
19
22
  }]);
20
-
21
- if (typeof window.AngularRailsTemplates === 'undefined') {
22
- window.AngularRailsTemplates = [];
23
- }
24
- window.AngularRailsTemplates.push(#{module_name.inspect});
25
23
  EOS
26
24
  end
27
25
 
28
26
  private
29
27
  def logical_template_path(scope)
30
- "#{scope.logical_path}.#{basename.split(".")[1]}"
28
+ path = scope.logical_path
29
+ path.gsub!(Regexp.new("^#{configuration.ignore_prefix}"), "")
30
+ ext = basename.split(".")[1]
31
+ "#{path}.#{ext}"
31
32
  end
32
33
 
33
34
  def configuration
@@ -1,3 +1,3 @@
1
1
  module AngularRailsTemplates
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.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.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-29 00:00:00.000000000 Z
12
+ date: 2013-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties