|
|
|
|
@ -81,7 +81,6 @@ define([
|
|
|
|
|
|
|
|
|
|
add_child_model: function(model) {
|
|
|
|
|
// Called when a child is added to children list.
|
|
|
|
|
var view = this.create_child_view(model);
|
|
|
|
|
var index = this.containers.length;
|
|
|
|
|
var uuid = utils.uuid();
|
|
|
|
|
var accordion_group = $('<div />')
|
|
|
|
|
@ -114,14 +113,17 @@ define([
|
|
|
|
|
var container_index = this.containers.push(accordion_group) - 1;
|
|
|
|
|
accordion_group.container_index = container_index;
|
|
|
|
|
this.model_containers[model.id] = accordion_group;
|
|
|
|
|
accordion_inner.append(view.$el);
|
|
|
|
|
|
|
|
|
|
this.create_child_view(model, function(view) {
|
|
|
|
|
accordion_inner.append(view.$el);
|
|
|
|
|
|
|
|
|
|
this.update();
|
|
|
|
|
this.update_titles();
|
|
|
|
|
that.update();
|
|
|
|
|
that.update_titles();
|
|
|
|
|
|
|
|
|
|
// Trigger the displayed event of the child view.
|
|
|
|
|
this.after_displayed(function() {
|
|
|
|
|
view.trigger('displayed');
|
|
|
|
|
// Trigger the displayed event of the child view.
|
|
|
|
|
that.after_displayed(function() {
|
|
|
|
|
view.trigger('displayed');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
@ -176,7 +178,6 @@ define([
|
|
|
|
|
|
|
|
|
|
add_child_model: function(model) {
|
|
|
|
|
// Called when a child is added to children list.
|
|
|
|
|
var view = this.create_child_view(model);
|
|
|
|
|
var index = this.containers.length;
|
|
|
|
|
var uuid = utils.uuid();
|
|
|
|
|
|
|
|
|
|
@ -184,33 +185,36 @@ define([
|
|
|
|
|
var tab = $('<li />')
|
|
|
|
|
.css('list-style-type', 'none')
|
|
|
|
|
.appendTo(this.$tabs);
|
|
|
|
|
view.parent_tab = tab;
|
|
|
|
|
|
|
|
|
|
var tab_text = $('<a />')
|
|
|
|
|
.attr('href', '#' + uuid)
|
|
|
|
|
.attr('data-toggle', 'tab')
|
|
|
|
|
.text('Page ' + index)
|
|
|
|
|
.appendTo(tab)
|
|
|
|
|
.click(function (e) {
|
|
|
|
|
|
|
|
|
|
// Calling model.set will trigger all of the other views of the
|
|
|
|
|
// model to update.
|
|
|
|
|
that.model.set("selected_index", index, {updated_view: this});
|
|
|
|
|
that.touch();
|
|
|
|
|
that.select_page(index);
|
|
|
|
|
this.create_child_view(model, function(view) {
|
|
|
|
|
view.parent_tab = tab;
|
|
|
|
|
|
|
|
|
|
var tab_text = $('<a />')
|
|
|
|
|
.attr('href', '#' + uuid)
|
|
|
|
|
.attr('data-toggle', 'tab')
|
|
|
|
|
.text('Page ' + index)
|
|
|
|
|
.appendTo(tab)
|
|
|
|
|
.click(function (e) {
|
|
|
|
|
|
|
|
|
|
// Calling model.set will trigger all of the other views of the
|
|
|
|
|
// model to update.
|
|
|
|
|
that.model.set("selected_index", index, {updated_view: that});
|
|
|
|
|
that.touch();
|
|
|
|
|
that.select_page(index);
|
|
|
|
|
});
|
|
|
|
|
tab.tab_text_index = that.containers.push(tab_text) - 1;
|
|
|
|
|
|
|
|
|
|
var contents_div = $('<div />', {id: uuid})
|
|
|
|
|
.addClass('tab-pane')
|
|
|
|
|
.addClass('fade')
|
|
|
|
|
.append(view.$el)
|
|
|
|
|
.appendTo(that.$tab_contents);
|
|
|
|
|
view.parent_container = contents_div;
|
|
|
|
|
|
|
|
|
|
// Trigger the displayed event of the child view.
|
|
|
|
|
that.after_displayed(function() {
|
|
|
|
|
view.trigger('displayed');
|
|
|
|
|
});
|
|
|
|
|
tab.tab_text_index = this.containers.push(tab_text) - 1;
|
|
|
|
|
|
|
|
|
|
var contents_div = $('<div />', {id: uuid})
|
|
|
|
|
.addClass('tab-pane')
|
|
|
|
|
.addClass('fade')
|
|
|
|
|
.append(view.$el)
|
|
|
|
|
.appendTo(this.$tab_contents);
|
|
|
|
|
view.parent_container = contents_div;
|
|
|
|
|
|
|
|
|
|
// Trigger the displayed event of the child view.
|
|
|
|
|
this.after_displayed(function() {
|
|
|
|
|
view.trigger('displayed');
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|