Add thread status to Mibew.Models.Thread

This commit is contained in:
Dmitriy Simushev 2013-01-29 12:08:10 +00:00
parent dd79c9aa21
commit 7e70d5b14b
3 changed files with 40 additions and 5 deletions

View File

@ -5,4 +5,4 @@
Copyright (c) 2005-2011 Mibew Messenger Community
License: http://mibew.org/license.php
*/
(function(a){a.Models.Thread=a.Models.Base.extend({defaults:{id:0,token:0,lastId:0}})})(Mibew);
(function(a){a.Models.Thread=a.Models.Base.extend({defaults:{id:0,token:0,lastId:0,state:null},STATE_QUEUE:0,STATE_WAITING:1,STATE_CHATTING:2,STATE_CLOSED:3,STATE_LOADING:4,STATE_LEFT:5})})(Mibew);

View File

@ -20,7 +20,7 @@ b.Server.prototype.registerFunction=function(a,b){a in this.functions||(this.fun
(function(a){a.Models.Control=a.Models.Base.extend({defaults:{title:"",weight:0}})})(Mibew);
(function(a,b){a.Models.Page=b.Model.extend()})(Mibew,Backbone);
(function(a,b){a.Models.Sound=b.Model.extend({play:function(a){this.set({file:a});this.trigger("sound:play",this)}})})(Mibew,Backbone);
(function(a){a.Models.Thread=a.Models.Base.extend({defaults:{id:0,token:0,lastId:0}})})(Mibew);
(function(a){a.Models.Thread=a.Models.Base.extend({defaults:{id:0,token:0,lastId:0,state:null},STATE_QUEUE:0,STATE_WAITING:1,STATE_CHATTING:2,STATE_CLOSED:3,STATE_LOADING:4,STATE_LEFT:5})})(Mibew);
(function(a){a.Models.User=a.Models.Base.extend({defaults:{isAgent:!1,name:""}})})(Mibew);
(function(a,b){a.Collections.Controls=b.Collection.extend({comparator:function(a){return a.get("weight")}})})(Mibew,Backbone);
(function(b,c,d){b.Views.Control=c.Marionette.ItemView.extend({template:d.templates.default_control,modelEvents:{change:"render"},events:{mouseover:"mouseOver",mouseleave:"mouseLeave"},attributes:function(){var a=[];a.push("control");this.className&&(a.push(this.className),this.className="");var b=this.getDashedControlType();b&&a.push(b);return{"class":a.join(" ")}},mouseOver:function(){var a=this.getDashedControlType();this.$el.addClass("active"+(a?"-"+a:""))},mouseLeave:function(){var a=this.getDashedControlType();

View File

@ -9,7 +9,7 @@
(function(Mibew){
/**
* Create an instance of thread
* @constructor
* @class
*/
Mibew.Models.Thread = Mibew.Models.Base.extend(
/** @lends Mibew.Models.Thread.prototype */
@ -36,8 +36,43 @@
* Last message id received by the thread
* @type Number
*/
lastId: 0
}
lastId: 0,
/**
* Thread's state
* @type Number
*/
state: null
},
/** Thread state constants */
/**
* User in the users queue
*/
STATE_QUEUE: 0,
/**
* User waiting for operator
*/
STATE_WAITING: 1,
/**
* Conversation in progress
*/
STATE_CHATTING: 2,
/**
* Thread closed
*/
STATE_CLOSED: 3,
/**
* Thread just created
*/
STATE_LOADING: 4,
/**
* User left message without starting a conversation
*/
STATE_LEFT: 5
/** End of thread state constants */
}
);
})(Mibew);