angular-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/angular-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-helpers.coffee +18 -0
- metadata +6 -6
data/README.md
CHANGED
@@ -4,7 +4,7 @@ This project lets you use angularjs with the yummy Rails 3.1 asset pipeline. Th
|
|
4
4
|
|
5
5
|
## Warning!! Code-Theft :)
|
6
6
|
|
7
|
-
This README (and some of the accompanying code) is being copied/pasted/ripped from the [http://github.com/codebrew/backbone-rails
|
7
|
+
This README (and some of the accompanying code) is being copied/pasted/ripped from the [backbone-rails](http://github.com/codebrew/backbone-rails) project to help bootstrap things. Later on I'll cut the cord.
|
8
8
|
|
9
9
|
## Requirements
|
10
10
|
|
@@ -66,7 +66,7 @@ You will have those routes set up. Note that this class will need to be injecte
|
|
66
66
|
|
67
67
|
PhotoGalleryCtrl.$inject = ['$route', '$xhr']
|
68
68
|
|
69
|
-
This is pretty much an adaption of the routing code at a demo
|
69
|
+
This is pretty much an adaption of the routing code at a demo by [Daniel Nelson](https://github.com/centresource/angularjs_rails_demo).
|
70
70
|
|
71
71
|
## Example Usage
|
72
72
|
|
@@ -20,3 +20,21 @@ class @Router
|
|
20
20
|
constructor:($route, $xhr)->
|
21
21
|
@setupXhr($xhr)
|
22
22
|
@initRoutes $route, @routes()
|
23
|
+
|
24
|
+
@resourceService = (serviceName, path, resourceTypes...)->
|
25
|
+
if resourceTypes.length is 0
|
26
|
+
resourceTypes.push 'index', 'create', 'update', 'destroy'
|
27
|
+
commandHash = {}
|
28
|
+
for type in resourceTypes
|
29
|
+
commandHash[type] = switch type
|
30
|
+
when 'index'
|
31
|
+
{ method:'GET', isArray:true }
|
32
|
+
when 'create'
|
33
|
+
{ method: 'POST' }
|
34
|
+
when 'update'
|
35
|
+
{ method: 'PUT' }
|
36
|
+
when 'destroy'
|
37
|
+
{ method: 'DELETE' }
|
38
|
+
|
39
|
+
angular.service serviceName, ($resource)->
|
40
|
+
$resource path, {}, commandHash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angular-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-23 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &2986850 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2986850
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: coffee-script
|
27
|
-
requirement: &
|
27
|
+
requirement: &2986600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.2.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2986600
|
36
36
|
description: Helpers for angularjs in a rails project (ripped from backbone-rails)
|
37
37
|
email:
|
38
38
|
- nate@ludicast.com
|