Browse Source

Cound chat message badge per chat.

pull/16/head
Simon Eisenmann 11 years ago
parent
commit
557dc99f1b
  1. 2
      html/main.html
  2. 4
      src/styles/components/_bar.scss
  3. 2
      src/styles/components/_chat.scss
  4. 12
      static/js/controllers/mediastreamcontroller.js
  5. 11
      static/js/directives/chat.js

2
html/main.html

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<status-message ng-controller="StatusmessageController"></status-message>
<div class="ng-cloak right">
<button title="{{_('Share your screen')}}" class="btn aenablebtn" ng-show="master.settings.screensharingMedia && (status=='connected' || status=='conference' || enabledScreenshare)" ng-model="layout.screenshare" btn-checkbox><i class="fa fa-desktop"></i></button>
<button title="{{_('Chat')}}" ng-show="roomstatus" class="btn" ng-class="{messagesunseen: chatMessagesUnseen>0}" ng-model="layout.chat" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-comments-o"></i><span class="badge" ng-show="chatMessagesUnseen && !layout.chat">{{chatMessagesUnseen}}</span></button>
<button title="{{_('Chat')}}" ng-show="roomstatus" class="btn" ng-class="{messagesunseen: chatMessagesUnseen>0}" ng-model="layout.chat" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-comments-o"></i><span class="badge" ng-show="chatMessagesUnseen">{{chatMessagesUnseen}}</span></button>
<button title="{{_('Mute microphone')}}" class="btn amutebtn" ng-model="microphoneMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-microphone-slash"></i></button>
<button title="{{_('Turn camera off')}}" class="btn amutebtn" ng-model="cameraMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-eye-slash"></i></button>
<button title="{{_('Settings')}}" class="btn" ng-model="layout.settings" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-cog"></i></button>

4
src/styles/components/_bar.scss

@ -121,11 +121,11 @@ position:relative; @@ -121,11 +121,11 @@ position:relative;
}
#bar .badge {
background-color: #84b819;
font-size:.3em;
height:12px;
font-size:.4em;
position:absolute;
right:0px;
top:2px;
border:1px solid white;
}
#bar .userpicture {
margin:-5px 0.5em 0px 0.5em;

2
src/styles/components/_chat.scss

@ -148,7 +148,7 @@ position:absolute; @@ -148,7 +148,7 @@ position:absolute;
left:0px;
right:0px;
top:0px;
bottom:80px;
bottom:75px;
}
.chat .output {
overflow-x: hidden;

12
static/js/controllers/mediastreamcontroller.js

@ -678,12 +678,18 @@ define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter'], function(_, BigS @@ -678,12 +678,18 @@ define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter'], function(_, BigS
});
$scope.$on("chatincoming", function() {
var chatMessagesUnseen = {};
$scope.$on("chatincoming", function(event, id) {
var count = chatMessagesUnseen[id] || 0;
count++;
chatMessagesUnseen[id]=count;
$scope.chatMessagesUnseen++;
});
$scope.$on("chatseen", function() {
$scope.chatMessagesUnseen=0;
$scope.$on("chatseen", function(event, id) {
var count = chatMessagesUnseen[id] || 0;
delete chatMessagesUnseen[id];
$scope.chatMessagesUnseen = $scope.chatMessagesUnseen - count ;
});
_.defer(function() {

11
static/js/directives/chat.js

@ -156,7 +156,7 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], @@ -156,7 +156,7 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'],
scope.killRoom(id);
};
subscope.seen = function() {
scope.$emit("chatseen");
scope.$emit("chatseen", subscope.id);
if (subscope.newmessage) {
subscope.newmessage = false;
subscope.$broadcast("seen");
@ -234,7 +234,9 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], @@ -234,7 +234,9 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'],
safeApply(subscope);
});
subscope.$on("incoming", function(event, message, from, userid) {
scope.$emit("chatincoming");
if (from !== userid) {
scope.$emit("chatincoming", subscope.id);
}
if (subscope.firstmessage || !desktopNotify.windowHasFocus) {
var room = event.targetScope.id;
// Make sure we are not in group chat or the message is from ourselves
@ -274,6 +276,7 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], @@ -274,6 +276,7 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'],
});
} else {
if (options.restore) {
if (!subscope.visible) {
controller.visibleRooms.push(id);
@ -368,6 +371,10 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], @@ -368,6 +371,10 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'],
}
};
scope.$watch("layout.chat", function(chat) {
iElement.removeClass("flip");
});
scope.$on("room", function(event, room) {
if (room == null) {
scope.hideRoom(controller.group);

Loading…
Cancel
Save