define(['jquery', 'underscore', 'backbone', 'app', './input/inputLoader'], function($, _, Backbone, App, load_input) { // Renders settings over view page return Backbone.View.extend({ tagName: 'div', template: _.compile($("#template-config").html()), templateItem: _.compile($("#template-config-item").html()), // Will only render one time with further attribute updates rendered: false, events: { 'click .btn-primary': 'submit' // TODO cancel }, initialize: function() { }, // TODO: correct cleanup after building up so many views and models render: function() { if (!this.rendered) { this.$el.html(this.template(this.model.toJSON())); // TODO: only render one time, rest of the attributes set manually // initialize the popover this.$('.page-header a').popover({ placement: 'left', trigger: 'hover' }); var container = this.$('.control-content'); var self = this; _.each(this.model.get('items'), function(item) { var el = $('