Last active
August 29, 2015 14:04
-
-
Save samelliott89/163071d9aacdd847e2b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//resrouce | |
require 'angular' | |
bs = window.angular.module 'backstage' | |
bs.factory 'Stories', [ | |
'$resource', 'transform', ($resource, transform) -> | |
resource = $resource '/api/stories/suggestions', | |
get: | |
method: 'get' | |
transformResponse: transform.response 'stories' | |
] | |
bs.factory 'StoryWizard', [ | |
'$resource', 'transform', ($resource, transform) -> | |
resource = $resource '/api/_admin/stories/suggestions', | |
add: | |
method: 'post', | |
url: '/api/_admin/stories/suggestions' | |
transformResponse: transform.response 'stories' | |
update: | |
method: 'put', | |
url: '/api/_admin/stories/suggestions' | |
transformResponse: transform.response 'stories' | |
] | |
//controller | |
require 'angular' | |
_ = require 'underscore' | |
bs = window.angular.module 'backstage' | |
bs.controller 'StoryWizardCtrl', [ | |
'$state', 'Stories', ($state, Stories) -> | |
@stories = [] | |
return | |
] | |
//response | |
{ | |
"stories": [ | |
{ | |
"bond": "have", | |
"messages": { | |
"vintage": [ | |
"Secret: This is actually a hand-me-down, though it looks brand new!", | |
"Finally! Been eyeing this for years!" | |
], | |
"buy": [ | |
"Love this one - I bought for myself. Jealous? You should be.", | |
"I'm a sucker for anything on sale." | |
], | |
"gift": [ | |
"This one is safe from the 're-wrap for distant relatives' list.", | |
"Best. Present. Ever." | |
] | |
} | |
}, | |
{ | |
"bond": "want", | |
"messages": { | |
"want": [ | |
"This needs to be at my place.", | |
"Hint hint. #BirthdayPresent" | |
] | |
} | |
}, | |
{ | |
"bond": "admire", | |
"messages": { | |
"admire": [ | |
"Wow, this is amazing! #incredible", | |
"We #admire what we can't #have" | |
] | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment