This file contains hidden or 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
| <!-- Most Abstract --> | |
| <quiz quiz="quiz"></quiz> | |
| <!-- 2 --> | |
| <form class="quiz"> | |
| <h1>{{quiz.title}}</h1> | |
| <question-set questions="quiz.questions"></question-set> | |
| </form> |
This file contains hidden or 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
| <div ng-repeat="answer in question.answers"> | |
| <input type="text" ng-model="answer.text" /> | |
| <input type="checkbox" ng-model="answer.correct" /> | |
| </div> | |
| <!-- --> | |
| <answer ng-repeat="answer in answers" answer-model="answer"></answer> |
This file contains hidden or 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
| 'use strict'; | |
| angular.module('quizApp') | |
| .factory('Question', function () { | |
| var Question = function (question, answers, correct_answer) { | |
| this.question = question; | |
| this.answers = []; | |
| this.correct_answer = correct_answer; | |
| }; |
This file contains hidden or 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
| var sinon = require('sinon'); | |
| var Promise = require('bookshelf/dialects/base/promise').Promise; | |
| var Bookshelf = require('bookshelf'); | |
| var unhandled = sinon.spy(); | |
| var caught = sinon.spy(); | |
| Promise.onPossiblyUnhandledRejection(unhandled); |
This file contains hidden or 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
| toJSON: -> | |
| json = super | |
| json.status = json.status.name | |
| json |
This file contains hidden or 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
| 'use strict'; | |
| var DB = require('./db'); | |
| var Joi = require('joi'); | |
| var Promise = require('bluebird'); | |
| var _ = require('lodash'); | |
| var Model = DB.Model.extend({ | |
| constructor: function () { | |
| DB.Model.apply(this, arguments); |
This file contains hidden or 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
| create = { | |
| handler: function(request, reply) { | |
| return new Address().save({ | |
| name: request.payload.name, | |
| address_line1: request.payload.address_line1 | |
| }) | |
| .call('fetch') | |
| .then(reply) | |
| .catch(reply); | |
| } |
This file contains hidden or 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
| module.exports = Bookshelf.Model.extend({ | |
| initialize: function () { | |
| this.on('saving', this.validate); | |
| }, | |
| validate: function () {} | |
| }); |
This file contains hidden or 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
| var ModelBase = Bookshelf.Model.extend(); | |
| var CollectionBase = Bookshelf.Collection.extend({ | |
| toJSON: function () { | |
| var json = Bookshelf.Collection.toJSON.apply(this, arguments); | |
| json.object = this.model.prototype.object; | |
| return json; | |
| }); | |
| }); |
This file contains hidden or 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
| it('should be able to run normal queries inside transaction blocks', function() { | |
| return knex('accounts') | |
| .returning('id') | |
| .insert({ | |
| first_name: 'Transacting', | |
| last_name: 'User', | |
| email:'[email protected]', | |
| logins: 1, | |
| about: 'Lorem ipsum Dolore labore incididunt enim.', |