angular-rails 0.0.4 → 0.0.5

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.
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](backbone-rails) project to help bootstrap things. Later on I'll cut the cord.
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 of [https://github.com/centresource/angularjs_rails_demo](angular with Rails).
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
 
@@ -1,3 +1,3 @@
1
1
  module AngularRails
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
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-21 00:00:00.000000000Z
12
+ date: 2011-11-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2989880 !ruby/object:Gem::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: *2989880
24
+ version_requirements: *2986850
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: coffee-script
27
- requirement: &2989630 !ruby/object:Gem::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: *2989630
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