Update Marionette.js to v2.3.0

This commit is contained in:
Dmitriy Simushev 2014-12-18 12:57:44 +00:00
parent bcd2bb9242
commit a72a602120
22 changed files with 48 additions and 47 deletions

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Message,
childView: Mibew.Views.Message,
/**
* Class name for view's DOM element

View File

@ -28,7 +28,7 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Status,
childView: Mibew.Views.Status,
/**
* Class name for view's DOM element

View File

@ -21,7 +21,7 @@
/**
* Represents chat layout
*/
Mibew.Layouts.Chat = Backbone.Marionette.Layout.extend(
Mibew.Layouts.Chat = Backbone.Marionette.LayoutView.extend(
/** @lends Mibew.Layouts.Chat.prototype */
{
/**
@ -39,7 +39,7 @@
avatarRegion: '#avatar-region',
messagesRegion: {
selector: '#messages-region',
regionType: Mibew.Regions.Messages
regionClass: Mibew.Regions.Messages
},
statusRegion: '#status-region',
messageFormRegion: '#message-form-region'

View File

@ -21,7 +21,7 @@
/**
* Represents invitation layout
*/
Mibew.Layouts.Invitation = Backbone.Marionette.Layout.extend(
Mibew.Layouts.Invitation = Backbone.Marionette.LayoutView.extend(
/** @lends Mibew.Layouts.Invitation.prototype */
{
/**
@ -37,7 +37,7 @@
regions: {
messagesRegion: {
selector: '#invitation-messages-region',
regionType: Mibew.Regions.Messages
regionClass: Mibew.Regions.Messages
}
}
}

View File

@ -21,7 +21,7 @@
/**
* Represents leave message page layout
*/
Mibew.Layouts.LeaveMessage = Backbone.Marionette.Layout.extend(
Mibew.Layouts.LeaveMessage = Backbone.Marionette.LayoutView.extend(
/** @lends Mibew.Layouts.LeaveMessage.prototype */
{
/**

View File

@ -21,7 +21,7 @@
/**
* Represents survey layout
*/
Mibew.Layouts.Survey = Backbone.Marionette.Layout.extend(
Mibew.Layouts.Survey = Backbone.Marionette.LayoutView.extend(
/** @lends Mibew.Layouts.Survey.prototype */
{
/**

View File

@ -254,7 +254,7 @@
// Add module finalizer
chat.addFinalizer(function() {
// Close layout
Mibew.Objects.chatLayout.close();
Mibew.Objects.chatLayout.destroy();
// Stop call functions periodically

View File

@ -95,7 +95,7 @@
// Add module finalizer
invitation.addFinalizer(function() {
// Close layout
Mibew.Objects.invitationLayout.close();
Mibew.Objects.invitationLayout.destroy();
// Stop call functions periodically

View File

@ -58,8 +58,8 @@
// When message sent form should be hide and description should be
// changed
models.leaveMessageForm.on('submit:complete', function() {
objs.leaveMessageLayout.leaveMessageFormRegion.close();
objs.leaveMessageLayout.descriptionRegion.close();
objs.leaveMessageLayout.leaveMessageFormRegion.empty();
objs.leaveMessageLayout.descriptionRegion.empty();
objs.leaveMessageLayout.descriptionRegion.show(
new Mibew.Views.LeaveMessageSentDescription()
@ -71,7 +71,7 @@
// Add module finalizer
leaveMessage.addFinalizer(function() {
// Close layout
Mibew.Objects.leaveMessageLayout.close();
Mibew.Objects.leaveMessageLayout.destroy();
// Remove instance of leaveMessage form model
delete Mibew.Objects.Models.leaveMessageForm;

View File

@ -50,7 +50,7 @@
// Add module finalizer
survey.addFinalizer(function() {
// Close layout
Mibew.Objects.surveyLayout.close();
Mibew.Objects.surveyLayout.destroy();
// Remove instance of survey form model
delete Mibew.Objects.Models.surveyForm;

View File

@ -26,11 +26,11 @@
{
/**
* Show view event handler. Register handler to view's
* 'after:item:added' event.
* 'add:child' event.
* @param {Backbone.Marionette.ItemView} view View to show in region
*/
onShow: function(view) {
view.on('after:item:added', this.scrollToBottom, this);
view.on('add:child', this.scrollToBottom, this);
},
/**

View File

@ -24,22 +24,22 @@
* Mibew.Views.CompositeBase
* @private
* @param {Backbone.Model} item Collection item
* @param {Function} ItemViewType Default item view constructor
* @param {Object} itemViewOptions Additional item view options
* @param {Function} ChildViewType Default item view constructor
* @param {Object} childViewOptions Additional item view options
* @returns Item view instance
*/
var buildItemView = function(item, ItemViewType, itemViewOptions) {
var buildChildView = function(item, ChildViewType, childViewOptions) {
// Build options object
var options = _.extend({model: item}, itemViewOptions);
var options = _.extend({model: item}, childViewOptions);
// Try to find special view for this model
if (typeof item.getModelType != 'function') {
return new ItemViewType(options);
return new ChildViewType(options);
}
var modelType = item.getModelType();
if (modelType && Mibew.Views[modelType]) {
return new Mibew.Views[modelType](options);
} else {
return new ItemViewType(options);
return new ChildViewType(options);
}
}
@ -53,13 +53,13 @@
* Default item view constructor.
* @type Function
*/
itemView: Backbone.Marionette.ItemView,
childView: Backbone.Marionette.ItemView,
/**
* Return special contructor for an item view if it exists or the
* default constructor otherwise.
*/
buildItemView: buildItemView
buildChildView: buildChildView
}
);
@ -70,7 +70,7 @@
* Return special contructor for an item view if it exists or the
* default constructor otherwise.
*/
buildItemView: buildItemView
buildChildView: buildChildView
}
);

View File

@ -28,7 +28,7 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Control,
childView: Mibew.Views.Control,
/**
* Class name for view's DOM element

View File

@ -28,7 +28,7 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Message,
childView: Mibew.Views.Message,
/**
* Class name for view's DOM element

View File

@ -28,7 +28,7 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Agent,
childView: Mibew.Views.Agent,
/**
* Class name for view's DOM element
@ -49,7 +49,7 @@
*/
initialize: function() {
// Register events
this.on('itemview:before:render', this.updateIndexes, this);
this.on('childview:before:render', this.updateIndexes, this);
},
/**

View File

@ -30,13 +30,13 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.QueuedThread,
childView: Mibew.Views.QueuedThread,
/**
* DOM element for collection items
* @type String
*/
itemViewContainer: '#threads-container',
childViewContainer: '#threads-container',
/**
* Empty view constructor.
@ -64,7 +64,7 @@
* Pass some options to item view
* @returns {Object} Options object
*/
itemViewOptions: function(model) {
childViewOptions: function(model) {
var page = Mibew.Objects.Models.page;
return {
tagName: page.get('threadTag'),
@ -79,8 +79,8 @@
// Update time in timers
window.setInterval(_.bind(this.updateTimers, this), 2 * 1000);
// Register events
this.on('itemview:before:render', this.updateStyles, this);
this.on('composite:collection:rendered', this.updateTimers, this);
this.on('childview:before:render', this.updateStyles, this);
this.on('render:collection', this.updateTimers, this);
},
/**

View File

@ -30,13 +30,13 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Visitor,
childView: Mibew.Views.Visitor,
/**
* DOM element for collection items
* @type String
*/
itemViewContainer: '#visitors-container',
childViewContainer: '#visitors-container',
/**
* Empty view constructor.
@ -62,7 +62,7 @@
* Pass some options to item view
* @returns {Object} Options object
*/
itemViewOptions: function(model) {
childViewOptions: function(model) {
var page = Mibew.Objects.Models.page;
return {
tagName: page.get('visitorTag'),
@ -77,7 +77,7 @@
// Update time in timers
window.setInterval(_.bind(this.updateTimers, this), 2 * 1000);
// Register events
this.on('composite:collection:rendered', this.updateTimers, this);
this.on('render:collection', this.updateTimers, this);
},
/**

View File

@ -33,7 +33,7 @@
/**
* View initializer
* @param {Object} options Options object passed from
* {@link Mibew.Views.ThreadsCollection.prototype.itemViewOptions}
* {@link Mibew.Views.ThreadsCollection.prototype.childViewOptions}
*/
initialize: function(options) {
this.tagName = options.tagName;

View File

@ -33,7 +33,7 @@
/**
* View initializer
* @param {Object} options Options object passed from
* {@link Mibew.Views.VisitorsCollection.prototype.itemViewOptions}
* {@link Mibew.Views.VisitorsCollection.prototype.childViewOptions}
*/
initialize: function(options) {
this.tagName = options.tagName;

View File

@ -34,13 +34,13 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Control,
childView: Mibew.Views.Control,
/**
* DOM element for collection items
* @type String
*/
itemViewContainer: '.thread-controls',
childViewContainer: '.thread-controls',
/**
* CSS class name for view's DOM element

View File

@ -34,13 +34,13 @@
* Default item view constructor.
* @type Function
*/
itemView: Mibew.Views.Control,
childView: Mibew.Views.Control,
/**
* DOM element for collection items
* @type String
*/
itemViewContainer: '.visitor-controls',
childViewContainer: '.visitor-controls',
/**
* CSS class name for view's DOM element