/cfzwww/static/javascript/app/company/company_list_view.js
JavaScript | 30 lines | 28 code | 2 blank | 0 comment | 0 complexity | 717e49ca2c2276cef57e86ddc157e8aa MD5 | raw file
- define([
- 'jquery',
- 'lodash',
- 'backbone',
- 'app/company/companies_collections',
- 'text!templates/company/list.html'
- ], function($, _, backbone, companiesCollection, companyListTemplate){
- var companyListView = Backbone.View.extend({
- el: $("#companies"),
- initialize: function(){
- this.collection = companiesCollection;
- },
- render: function(){
- this.loadResults();
- },
- loadResults: function(){
- this.collection.fetch({success: function(collections){
- var data = {
- companies: collections.models,
- _: _
- };
- var compiledTemplate = _.template(companyListTemplate, data);
- $("#companies").html(compiledTemplate);
- }});
- }
- });
- return new companyListView();
- });