angular-rails-templates 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3b300ab4b89e1f7085e04b70e962a8d1ff154985
4
+ data.tar.gz: 0a6817faccca877d296635a144a5ecc7444fa3e7
5
+ SHA512:
6
+ metadata.gz: a8ae17bf1b09addd325d7d2b3da68cca40210546b3e89240375d873c3dc76fd407d34b79cc7f2e1c59587062ccc621c239a3b0ab100e25eaa0c99fdd9259b171
7
+ data.tar.gz: 0dec8b993230196cf3abac1667d3a03c1baded18abd3e43aaeed84ab524e28c5007fa8008752d39d99f0101e7aeb5fb843ed10f0c77f40b4137855dc69886ba0
data/README.md CHANGED
@@ -2,47 +2,52 @@
2
2
 
3
3
  Behind the hideous Angular Rails Templates name is hiding a template management system for rails' asset pipeline and AngularJS' template views.
4
4
 
5
- Basically: this will precompile your templates into the template cache, to be used by your application.
5
+ Basically: this will precompile your templates into the template cache, to be used by your application.
6
6
  It removes the need for ajax calls to get the templates (or for you to manually set them into the dom).
7
7
 
8
8
  ## Usage
9
9
 
10
10
  Add the gem into your Gemfile
11
11
 
12
- gem 'angular-rails-templates'
12
+ ```ruby
13
+ gem 'angular-rails-templates'
14
+ ```
13
15
 
14
16
  Then, in your `application.js` file, require your templates and the internal javascript file:
15
17
 
16
- //= require angularjs
17
- //= require_tree ./path_to_your_templates
18
- //= require angular-rails-templates
18
+ ```javascript
19
+ //= require angularjs
20
+ //= require_tree ./path_to_your_templates
21
+ ```
19
22
 
20
- The `require angular-rails-templates` **needs** to happen after requiring all your templates. Otherwise, they won't be loaded.
21
23
  Your template files can have the extensions **.html** or **.ajs**
22
24
 
23
25
  In your application, add a dependency to the `templates` module.
24
26
 
25
- var application = angular.module('myApplication', ['templates']);
27
+ ```javascript
28
+ var application = angular.module('myApplication', ['templates']);
29
+ ```
26
30
 
27
- Loading this module will automatically load all your templates into angular's `$templateCache`.
31
+ Loading this module will automatically load all your templates into angular's `$templateCache`.
28
32
  Angular uses this parameter when checking for the presence of templates before making an HTTP call.
29
33
 
30
- ## How it works
34
+ The templates can then be accessed via `templateUrl` as expected:
31
35
 
32
- Because of the way angular's modules work, we cannot create one templates module which would load all the templates.
33
- Therefore, we create one module per template. It's callsed `templates-<template-name>`.
36
+ ``` javascript
37
+ {
38
+ templateUrl: 'path_to_your_templates/yourTemplate.html'
39
+ }
40
+ ```
34
41
 
35
- Also, because we cannot dynamically retrieve a list of all angular modules to find the ones matching our templates and include them, we add a root variable which contains the list of all our templates modules.
36
- It is `window.AngularRailsTemplates`.
42
+ ## How it works
37
43
 
38
- When you `require angular-rails-templates`, we create the `templates` module, which has dependencies to all the templates previously defined. Therefore including all our templates.
39
- You can check the content of this `templates` module in [angular-rails-templates.js.erb](https://github.com/dmathieu/angular-rails-templates/blob/master/app/assets/javascripts/angular-rails-templates.js.erb).
44
+ We create the `templates` module (configurable through `config.angular_templates.module_name` in your application.rb), which populates Angular's `$templateCache` with all your templates when the module is included in your app.
40
45
 
41
46
  ## License
42
47
 
43
48
  MIT License. Copyright 2013 Damien Mathieu
44
49
 
45
-
46
50
  ## Authors & contributors
47
51
 
48
52
  * Damien Mathieu <42@dmathieu.com>
53
+ * pitr <pitr.vern@gmail.com>
@@ -5,9 +5,12 @@ module AngularRailsTemplates
5
5
  config.angular_templates.ignore_prefix = 'templates/'
6
6
 
7
7
  config.before_initialize do |app|
8
- Sprockets::Engines #force autoloading
9
- Sprockets.register_engine '.ajs', AngularRailsTemplates::Template
10
- Sprockets.register_engine '.html', AngularRailsTemplates::Template
8
+ if app.config.assets
9
+ require 'sprockets'
10
+ Sprockets::Engines #force autoloading
11
+ Sprockets.register_engine '.ajs', AngularRailsTemplates::Template
12
+ Sprockets.register_engine '.html', AngularRailsTemplates::Template
13
+ end
11
14
  end
12
15
  end
13
16
  end
@@ -1,3 +1,3 @@
1
1
  module AngularRailsTemplates
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,62 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular-rails-templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Damien Mathieu
8
+ - pitr
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-30 00:00:00.000000000 Z
12
+ date: 2014-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
20
  version: '3.1'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
27
  version: '3.1'
30
28
  - !ruby/object:Gem::Dependency
31
- name: sprockets-rails
29
+ name: sprockets
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - ">="
44
40
  - !ruby/object:Gem::Version
45
41
  version: '0'
46
42
  - !ruby/object:Gem::Dependency
47
43
  name: uglifier
48
44
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
45
  requirements:
51
- - - ! '>='
46
+ - - ">="
52
47
  - !ruby/object:Gem::Version
53
48
  version: '0'
54
49
  type: :development
55
50
  prerelease: false
56
51
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
- - - ! '>='
53
+ - - ">="
60
54
  - !ruby/object:Gem::Version
61
55
  version: '0'
62
56
  description:
@@ -66,37 +60,34 @@ executables: []
66
60
  extensions: []
67
61
  extra_rdoc_files: []
68
62
  files:
69
- - README.md
70
63
  - LICENSE
64
+ - README.md
65
+ - lib/angular-rails-templates.rb
71
66
  - lib/angular-rails-templates/engine.rb
72
67
  - lib/angular-rails-templates/template.rb
73
68
  - lib/angular-rails-templates/version.rb
74
- - lib/angular-rails-templates.rb
75
- - app/assets/javascripts/angular-rails-templates.js.erb
76
69
  homepage: https://github.com/dmathieu/angular-rails-templates
77
70
  licenses:
78
71
  - MIT
72
+ metadata: {}
79
73
  post_install_message:
80
74
  rdoc_options: []
81
75
  require_paths:
82
76
  - lib
83
77
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
78
  requirements:
86
- - - ! '>='
79
+ - - ">="
87
80
  - !ruby/object:Gem::Version
88
81
  version: '0'
89
82
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
83
  requirements:
92
- - - ! '>='
84
+ - - ">="
93
85
  - !ruby/object:Gem::Version
94
86
  version: '0'
95
87
  requirements: []
96
88
  rubyforge_project:
97
- rubygems_version: 1.8.23
89
+ rubygems_version: 2.2.0
98
90
  signing_key:
99
- specification_version: 3
91
+ specification_version: 4
100
92
  summary: Use your angular templates with rails' asset pipeline
101
93
  test_files: []
102
- has_rdoc: