Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit df07c31

Browse files
committed
use ng-api-services
1 parent b0c9b4f commit df07c31

File tree

8 files changed

+19
-25
lines changed

8 files changed

+19
-25
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"angular-mocks": "^1.3.x",
1212
"sinon": "http://sinonjs.org/releases/sinon-1.12.1.js",
1313
"auto-config-fake-server": "2.x.x",
14-
"appirio-tech-api-schemas": "3.0.309"
14+
"appirio-tech-api-schemas": "5.x.x"
1515
},
1616
"dependencies": {
1717
"angular": "^1.4.x",
@@ -20,6 +20,7 @@
2020
"angular-resource": "^1.3.x",
2121
"appirio-tech-ng-file-upload": "0.x.x",
2222
"appirio-tech-ng-ui-components": "0.x.x",
23+
"appirio-tech-ng-api-services": "0.x.x",
2324
"zepto": "1.1.x"
2425
},
2526
"ignore": [

example/js-files.jade

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
- controllers.push('designs')
3333
- controllers.push('estimate')
3434

35-
- services.push('submit-work-api')
3635
- services.push('submit-work')
37-
- services.push('features')
3836
- services.push('nav')
3937

4038
each directive in directives
@@ -56,6 +54,7 @@ end
5654
- bowers.push('angular-ui-router/release/angular-ui-router')
5755
- bowers.push('appirio-tech-ng-file-upload/dist/main')
5856
- bowers.push('appirio-tech-ng-ui-components/dist/main')
57+
- bowers.push('appirio-tech-ng-api-services/dist/main')
5958

6059
= "\n"
6160
// build:js lib.js

example/scripts/mock.coffee

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1+
'use strict'
2+
13
AutoConfigFakeServer.init()
24

35
AutoConfigFakeServer.fakeServer.autoRespond = true
46

5-
schemas = [
6-
'bower_components/appirio-tech-api-schemas/apiary/apworkmicroservice.json'
7-
]
8-
97
fixtures = []
108

11-
for schema in schemas
12-
if window.FIXTURES[schema]
13-
fixtures.push window.FIXTURES[schema]
14-
else
15-
msg = 'mock data for ' + schema + ' can not be found'
16-
17-
console.error msg
9+
for key, fixture of window.FIXTURES
10+
# apiary/messaging14.json needs to be updated on apiary
11+
fixtures.push fixture unless key == 'bower_components/appirio-tech-api-schemas/apiary/messaging14.json'
1812

1913
AutoConfigFakeServer.consume fixtures
2014

21-
localStorage.setItem('userJWTToken', '"yyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwaS50b3Bjb2Rlci1kZXYuY29tIiwiZXhwIjoxNDMzMjcxNzYwLCJ1c2VySWQiOiI0MDEzNTUxNiIsImlhdCI6MTQzMzI3MTE2MCwianRpIjoiMDZhNzVjM2EtMTQ0MC00MWE3LTk5N2YtZmFmMGVjZjFmOGM1In0.okSjl5KOmGQ6hJEoQxk4SVkFra65_Id6KUQGdAVmJNe"')
15+
token = '"yyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwaS50b3Bjb2Rlci1kZXYuY29tIiwiZXhwIjoxNDMzMjcxNzYwLCJ1c2VySWQiOiI0MDEzNTUxNiIsImlhdCI6MTQzMzI3MTE2MCwianRpIjoiMDZhNzVjM2EtMTQ0MC00MWE3LTk5N2YtZmFmMGVjZjFmOGM1In0.okSjl5KOmGQ6hJEoQxk4SVkFra65_Id6KUQGdAVmJNe"'
16+
17+
localStorage.setItem 'userJWTToken', token

gulpfile.coffee

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ configs.templateCache.push
2727
root : 'views/'
2828
module: 'example'
2929

30-
configs.ngConstants =
31-
constants:
32-
API_URL: 'http://api.topcoder.com/v3'
3330

3431
### END CONFIG ###
3532
loadTasksModule = require __dirname + '/node_modules/appirio-gulp-tasks/load-tasks.coffee'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"devDependencies": {
77
"appirio-work-styles": "0.x.x",
8-
"appirio-gulp-tasks": "2.x.x",
8+
"appirio-gulp-tasks": "3.x.x",
99
"gulp": "^3.8.11"
1010
}
1111
}

src/scripts/controllers/submit-work.controller.coffee

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SubmitWorkController = (
55
SubmitWorkService
66
NavService
77
$state
8-
SubmitWorkAPIService
8+
WorkAPIService
99
) ->
1010
vm = this
1111
$scope.activeState = NavService.activeState
@@ -56,7 +56,7 @@ SubmitWorkController = (
5656

5757
vm.save = (onSuccess = null) ->
5858
unless vm.work.id
59-
resource = SubmitWorkAPIService.save vm.work
59+
resource = WorkAPIService.save vm.work
6060

6161
resource.$promise.then (data) ->
6262
vm.work.id = data.result.content
@@ -72,7 +72,7 @@ SubmitWorkController = (
7272
params =
7373
id: vm.work.id
7474

75-
resource = SubmitWorkAPIService.put params, vm.work
75+
resource = WorkAPIService.put params, vm.work
7676

7777
resource.$promise.then (data) ->
7878
onSuccess?(data)
@@ -109,7 +109,7 @@ SubmitWorkController = (
109109
params =
110110
id: $scope.workId
111111

112-
resource = SubmitWorkAPIService.get params
112+
resource = WorkAPIService.get params
113113

114114
resource.$promise.then (data) ->
115115
vm.work = data.result.content
@@ -127,7 +127,7 @@ SubmitWorkController.$inject = [
127127
'SubmitWorkService'
128128
'NavService'
129129
'$state'
130-
'SubmitWorkAPIService'
130+
'WorkAPIService'
131131
]
132132

133133
angular.module('appirio-tech-ng-submit-work').controller 'SubmitWorkController', SubmitWorkController

src/scripts/services/submit-work-api.service.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ srv = ($resource, API_URL) ->
1919

2020
srv.$inject = ['$resource', 'API_URL']
2121

22-
angular.module('appirio-tech-ng-submit-work').factory 'SubmitWorkAPIService', srv
22+
angular.module('appirio-tech-ng-submit-work').factory 'WorkAPIService', srv

src/scripts/submit-work.module.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dependencies = [
55
'ngResource'
66
'app.constants'
77
'duScroll'
8+
'appirio-tech-ng-api-services'
89
]
910

1011
angular.module 'appirio-tech-ng-submit-work', dependencies

0 commit comments

Comments
 (0)