codecombat/test/demo/views/achievement/UserAchievements.demo.coffee
Ruben Vereecken 3fd396974d Merge branch 'master' into achievements
Conflicts:
	app/views/DemoView.coffee
	app/views/docs/ComponentDocumentationView.coffee
	app/views/editor/level/LevelEditView.coffee
	server/users/User.coffee
2014-08-13 10:43:42 +02:00

29 lines
929 B
CoffeeScript

Achievement = require 'models/Achievement'
Achievements = require 'collections/AchievementCollection'
UserAchievementsView = require 'views/user/AchievementsView'
EarnedAchievement = require 'models/EarnedAchievement'
EarnedAchievementCollection = require 'collections/EarnedAchievementCollection'
fixtures = require '../../fixtures/achievements'
module.exports = ->
view = new UserAchievementsView {}, me.get '_id'
respond = (request) ->
return unless request
if request.url.match /db\/achievement/
request.response
status: 200
responseText: JSON.stringify fixtures.achievements
else if request.url.match /db\/user\/[a-z0-9]*\/achievements/
request.response
status: 200
responseText: JSON.stringify fixtures.earnedAchievements
else
request.response
status: 404
_.each jasmine.Ajax.requests.all(), (request) -> respond request
view.render()