BB Useful

by kyllle

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.2/backbone-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>

SCSS

* {
  -webkit-font-smoothing: antialiased;
}

body {
    padding: 5%;
}

JavaScript

console.clear();

// Useful

// Collection comparator
comparator: function(model){
	return model.get('position');
}



// Model methods
App.Model.Coffee = Backbone.Model.extend({

	url: 'http://www.madefreshcoffee.com/read.php?sku=bd86292a-241a-11e2-b97c-12313d04a24a',

	getAuthor: function() {
		return this.get('author');
	},

	getIngredients: function() {
		return this.get('ingredients');
	},

	getMessge: function() {
		return this.get('message');
	},

	getName: function() {
		return this.get('name');
	},

	getURL: function() {
		return this.get('readUrl');
	},

	setAuthor: function(newAuthor) {
		this.set({author: newAuthor});
	},

	setIngredients: function(newIngredients) {
		this.set({ingredients: newIngredients});
	},

	setMessge: function(newMessage) {
		this.set({message: newMessage});
	},

	setName: function(newName) {
		this.set({name: newName});
	}

});

// Model testing https://github.com/KDawg/JasmineTestingBackBoneModel/blob/master/tests/spec/models/CoffeeModelSpec.js