BB: Populate the favourites view
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/handlebars.js/4.0.5/handlebars.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone-min.js"></script>
SCSS
* {
-webkit-font-smoothing: antialiased;
}
body {
padding: 5%;
}
JavaScript
console.clear();
var favouritesData = [
{
"id": 1,
"title": "My favourite search 1"
},
{
"id": 2,
"title": "My favourite search 2"
}
];
// 1) Create a Search View and render it into DOM
// 2) Create a Search Favourites Select View, this View should have a select tag
// 3) Create a Search Favourites Option View, this View should have an option tag
// 4) Create a Search Favourite Model
// 5) Create a Search Favourites Collection that contains the Search Favourite Model
// 6) After the Search View renders, instance a Favourites Select View
// Pass an instance of the Favourites Collection into this View consisting of the favouriteData
// 7) Render the Search View into the Search View element