Add notification support
This commit is contained in:
parent
236a82ec4e
commit
c0f22c4ec8
14
js/models.js
14
js/models.js
|
@ -21,13 +21,18 @@ models.service('models', ['colors', function(colors) {
|
|||
|
||||
this.setActiveBuffer = function(bufferId) {
|
||||
|
||||
if (this.getActiveBuffer()) {
|
||||
this.getActiveBuffer().active = false;
|
||||
}
|
||||
|
||||
activeBuffer = _.find(this.model['buffers'], function(buffer) {
|
||||
if (buffer['id'] == bufferId) {
|
||||
return buffer;
|
||||
}
|
||||
});
|
||||
activeBuffer.notification = false;
|
||||
activeBuffer.active = true;
|
||||
|
||||
console.log(this.activeBuffer);
|
||||
}
|
||||
|
||||
this.getBuffers = function() {
|
||||
|
@ -37,7 +42,6 @@ models.service('models', ['colors', function(colors) {
|
|||
this.getBuffer = function(bufferId) {
|
||||
return _.find(this.model['buffers'], function(buffer) {
|
||||
if (buffer['id'] == bufferId) {
|
||||
console.log('yé');
|
||||
return buffer;
|
||||
}
|
||||
});
|
||||
|
@ -54,6 +58,12 @@ models.service('models', ['colors', function(colors) {
|
|||
var fullName = message['full_name']
|
||||
var pointer = message['pointers'][0]
|
||||
var lines = []
|
||||
var active = false;
|
||||
var notification = false;
|
||||
|
||||
var notify = function() {
|
||||
notification = true;
|
||||
}
|
||||
|
||||
var addLine = function(line) {
|
||||
lines.push(line);
|
||||
|
|
|
@ -202,21 +202,15 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'models', 'pluginManager',
|
|||
var handleBufferLineAdded = function(message) {
|
||||
var buffer_line = {}
|
||||
|
||||
message = new models.BufferLine(message);
|
||||
|
||||
var message = new models.BufferLine(message);
|
||||
var buffer = models.getBuffer(message.buffer);
|
||||
message.metadata = pluginManager.contentForMessage(message.text);
|
||||
buffer.addLine(message);
|
||||
|
||||
console.log(message);
|
||||
console.log(message.buffer);
|
||||
console.log(models.getBuffer(message.buffer));
|
||||
models.getBuffer(message.buffer).addLine(message);
|
||||
|
||||
|
||||
|
||||
//if (!_isActiveBuffer(message.buffer)) {
|
||||
// $rootScope.buffers[message.buffer]['notification'] = true;
|
||||
//}
|
||||
|
||||
//$rootScope.buffers[message.buffer]['lines'].push(message);
|
||||
if (!buffer.active) {
|
||||
buffer.notification = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue