- addMessage: function(type, text, flash) {
- if (!flash) {
- flash = text;
- }
- this.messages.push({type: type, text: text});
- this.flashMessages.push({type: type, text: flash});
- if (this.flashMessages.length == 1) {
- this.set('firstFlashMessage', this.flashMessages[0]);
- setTimeout(this.changeFlashMessage.bind(this), 1000 * 10);
- }
- },
+ addMessage: function(type, tag, text, flash)
+ {
+ if (!tag) tag = '#default'
+
+ if (!flash) {
+ flash = text;
+ }
+
+ this.messages.push({
+ type: type,
+ text: text
+ });
+
+ this.flashMessages.push({
+ type: type,
+ text: flash,
+ tag: tag
+ });
+
+ if(this.timeout) {
+ if(this.flashMessages[0] && (this.flashMessages[0].tag == tag))
+ {
+ clearTimeout(this.timeout);
+ this.timeout = null;
+ this.changeFlashMessage();
+ }
+ }
+
+ else {
+ /* queue was empty at the start */
+ if (this.flashMessages.length == 1) {
+ console.log("MSC-added-fisrt", Date(), this);
+ this.set('firstFlashMessage', this.flashMessages[0]);
+ this.timeout = setTimeout(this.changeFlashMessage.bind(this), 3000);
+ }
+
+ }
+
+ },