Browse Source

Merge c430b5e5e3 into ff95b5e408

pull/227/merge
Joachim Bauch 8 years ago committed by GitHub
parent
commit
6c80eb8c57
  1. 1
      src/i18n/helpers/checkHTML.py
  2. 6
      static/js/controllers/chatroomcontroller.js
  3. 5
      static/js/controllers/statusmessagecontroller.js
  4. 14
      static/js/controllers/uicontroller.js
  5. 15
      static/js/directives/chat.js
  6. 2
      static/partials/chat.html
  7. 6
      static/partials/chatroom.html
  8. 8
      static/partials/statusmessage.html

1
src/i18n/helpers/checkHTML.py

@ -27,6 +27,7 @@ def main(templates, output_folder=None): @@ -27,6 +27,7 @@ def main(templates, output_folder=None):
html = unicode(html, "UTF-8")
html = re.sub(r"\|(\w|:|\"|\')+", "", html)
html = html.replace(", $", ", ")
if output_folder:
tf = os.path.join(output_folder, os.path.split(fn)[1])

6
static/js/controllers/chatroomcontroller.js

@ -46,6 +46,8 @@ define(['angular', 'jquery', 'underscore', 'moment', 'text!partials/fileinfo.htm @@ -46,6 +46,8 @@ define(['angular', 'jquery', 'underscore', 'moment', 'text!partials/fileinfo.htm
}, 100));
var displayName = safeDisplayName;
// To be used by chatroom.html partial.
$scope.displayName = displayName;
var buddyImageSrc = $filter("buddyImageSrc");
var fileInfo = $compile(templateFileInfo);
var contactRequest = $compile(templateContactRequest);
@ -418,9 +420,9 @@ define(['angular', 'jquery', 'underscore', 'moment', 'text!partials/fileinfo.htm @@ -418,9 +420,9 @@ define(['angular', 'jquery', 'underscore', 'moment', 'text!partials/fileinfo.htm
case "LeftOrJoined":
$scope.showtime(new Date());
if (data.LeftOrJoined === "left") {
$scope.display(null, $("<i>" + displayName(from) + translation._(" is now offline.") + "</i>"));
$scope.display(null, $("<i>" + translation._("%1$s is now offline.", displayName(from)) + "</i>"));
} else {
$scope.display(null, $("<i>" + displayName(from) + translation._(" is now online.") + "</i>"));
$scope.display(null, $("<i>" + translation._("%1$s is now online.", displayName(from)) + "</i>"));
}
break;
case "Log":

5
static/js/controllers/statusmessagecontroller.js

@ -23,7 +23,10 @@ @@ -23,7 +23,10 @@
define([], function() {
// StatusmessageController
return ["$scope", "mediaStream", function($scope, mediaStream) {
return ["$scope", "mediaStream", "safeDisplayName", function($scope, mediaStream, safeDisplayName) {
// To be used by statusmessage.html partial.
$scope.displayName = safeDisplayName;
$scope.doHangup = function(reason, id) {
mediaStream.webrtc.doHangup(reason, id);

14
static/js/controllers/uicontroller.js

@ -488,7 +488,9 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'tex @@ -488,7 +488,9 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'tex
// Start to ring.
ringer.start();
// Show incoming call notification.
notification = desktopNotify.notify(translation._("Incoming call"), translation._("from") + " " + displayName(from), {
// TODO: This might not be correct in some languages where the
// name must come first.
notification = desktopNotify.notify(translation._("Incoming call"), translation._("from %1$s", displayName(from)), {
timeout: null
});
$scope.$emit("status", "ringing");
@ -789,21 +791,21 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'tex @@ -789,21 +791,21 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'tex
var message = null;
switch (type) {
case "busy":
message = displayName(details.from) + translation._(" is busy. Try again later.");
message = translation._("%1$s is busy. Try again later.", displayName(details.from));
break;
case "reject":
message = displayName(details.from) + translation._(" rejected your call.");
message = translation._("%1$s rejected your call.", displayName(details.from));
break;
case "pickuptimeout":
message = displayName(details.from) + translation._(" does not pick up.");
message = translation._("%1$s does not pick up.", displayName(details.from));
break;
case "incomingbusy":
toastr.info(moment().format("lll"), displayName(details.from) + translation._(" tried to call you"));
toastr.info(moment().format("lll"), translation._("%1$s tried to call you", displayName(details.from)));
break;
case "abortbeforepickup":
// Fall through
case "incomingpickuptimeout":
toastr.info(moment().format("lll"), displayName(details.from) + translation._(" called you"));
toastr.info(moment().format("lll"), translation._("%1$s called you", displayName(details.from)));
break;
}
if (message) {

15
static/js/directives/chat.js

@ -24,6 +24,10 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro @@ -24,6 +24,10 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro
return ["$compile", "safeDisplayName", "mediaStream", "safeApply", "desktopNotify", "translation", "playSound", "fileUpload", "randomGen", "buddyData", "appData", "$timeout", "geolocation", function($compile, safeDisplayName, mediaStream, safeApply, desktopNotify, translation, playSound, fileUpload, randomGen, buddyData, appData, $timeout, geolocation) {
// Translation helpers.
translation._("Chat with %1$s");
translation._("Room chat %1$s");
var displayName = safeDisplayName;
var groupChatId = "";
var maxMessageSize = 200000;
@ -138,7 +142,8 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro @@ -138,7 +142,8 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro
$scope.showGroupRoom(null, options);
} else {
$scope.showRoom(id, {
title: translation._("Chat with")
// Gets translated in template.
title: "Chat with %1$s"
}, options);
}
@ -160,7 +165,8 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro @@ -160,7 +165,8 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro
return;
}
var subscope = $scope.showRoom(id, {
title: translation._("Chat with")
// Gets translated in template.
title: "Chat with %1$s"
}, options);
subscope.sendChatServer(id, "Contact request", {
ContactRequest: {
@ -182,7 +188,8 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro @@ -182,7 +188,8 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro
scope.showGroupRoom = function(settings, options) {
var stngs = $.extend({
title: translation._("Room chat"),
// Gets translated in template.
title: "Room chat %1$s",
group: true
}, settings);
return scope.showRoom(controller.group, stngs, options);
@ -385,7 +392,7 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro @@ -385,7 +392,7 @@ define(['jquery', 'underscore', 'text!partials/chat.html', 'text!partials/chatro
// before we beep and shout.
if (!subscope.isgroupchat && from !== sessionid) {
playSound.play("chatmessage");
desktopNotify.notify(translation._("Message from ") + displayName(from), message);
desktopNotify.notify(translation._("Message from %1$s", displayName(from)), message);
appData.e.triggerHandler("uiNotification", ["chatmessage", {from: from, message: message, first: subscope.firstmessage}]);
}
subscope.firstmessage = false;

2
static/partials/chat.html

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
<a ng-repeat="room in getVisibleRooms()" ng-click="activateRoom(room.id, true, true)" class="list-group-item" ng-class="{newmessage: room.pending, disabled: !room.enabled}">
<span class="badge" ng-show="room.pending">{{room.pending}}</span>
<span ng-if="room.id !== ''">{{room.id|displayName}}</span>
<span ng-if="room.id === ''">{{_("Room chat")}} {{currentRoomName}}</span>
<span ng-if="room.id === ''">{{_("Room chat %1$s", currentRoomName)}}</span>
<button ng-if="room.id !== ''" class="btn btn-sm btn-default" ng-click="hideRoom(room.id)">
<i class="fa fa-trash-o"></i>
</button>

6
static/partials/chatroom.html

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<div ng-controller="ChatroomController" class="chat room-{{index}}" ng-class="{'newmessage': newmessage, 'visible': visible, 'chat-p2p': 'p2pstate', 'with_pictures': isgroupchat, 'active': active}">
<div class="chatheader"><div class="chatstatusicon" ng-click="deactivateRoom()"><i class="fa fa-angle-left"></i> <i class="fa fa fa-comments-o"></i></div><div class="chatheadertitle"><span ng-show="p2pstate" class="fa fa-exchange" title="{{_('Peer to peer')}}"/><span>{{settings.title}} {{id|displayName}}</span></div> <div class="ctrl"><i ng-hide="layout.chatMaximized" ng-click="toggleMax()" class="fa fa-expand"></i><i ng-show="layout.chatMaximized" ng-click="toggleMax()" class="fa fa-compress"></i><!--<i title="{{_('Close chat')}}" ng-click="hide()" class="fa fa-times"></i>--></div></div>
<div class="chatheader"><div class="chatstatusicon" ng-click="deactivateRoom()"><i class="fa fa-angle-left"></i> <i class="fa fa fa-comments-o"></i></div><div class="chatheadertitle"><span ng-show="p2pstate" class="fa fa-exchange" title="{{_('Peer to peer')}}"/><span>{{_(settings.title, displayName(id))}}</span></div> <div class="ctrl"><i ng-hide="layout.chatMaximized" ng-click="toggleMax()" class="fa fa-expand"></i><i ng-show="layout.chatMaximized" ng-click="toggleMax()" class="fa fa-compress"></i><!--<i title="{{_('Close chat')}}" ng-click="hide()" class="fa fa-times"></i>--></div></div>
<div class="chatmenu">
<div class="btn-group">
<button ng-if="!isgroupchat && roomType!='Conference'" class="btn btn-sm btn-default" title="{{_('Start video call')}}" ng-click="doCall()"><i class="fa fa-phone fa-fw"></i></button>
@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
</div>
<div class="chatbodybottom">
<div class="typinghint" ng-switch on="peerIsTyping">
<span ng-switch-when="start"><i class="fa fa-pencil"></i> {{id|displayName}} {{_('is typing...')}}</span>
<span ng-switch-when="stop"><i class="fa fa-pencil"></i> {{id|displayName}} {{_('has stopped typing...')}}</span>
<span ng-switch-when="start"><i class="fa fa-pencil"></i> {{_('%1$s is typing...', displayName(id))}}</span>
<span ng-switch-when="stop"><i class="fa fa-pencil"></i> {{_('%1$s has stopped typing...', displayName(id))}}</span>
</div>
<div class="inputbox">
<div>

8
static/partials/statusmessage.html

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
<span class="status-{{status}}" ng-switch on="status">
<span ng-switch-when="initializing">{{_("Initializing")}} <i class="fa fa-circle-o-notch fa-spin"></i></span>
<span ng-switch-when="waiting" ng-controller="UsersettingsController as usersettings"><span class="status-indicator"><i style="color:rgb(132,184,25)" class="fa fa-dot-circle-o" title="{{_('Online')}}"></i> {{id|displayName}}</span> <img class="userpicture" ng-show="master.buddyPicture" ng-src="{{master.buddyPicture}}" alt="" /><button ng-if="!authorizing && !myuserid && usersettings.loginUserid" type="button" class="btn btn-default" ng-click="usersettings.loginUserid()">{{_("Sign in")}}</button></span>
<span ng-switch-when="connecting"><span class="msg">{{_("Calling")}} {{dialing|displayName}}</span> <a class="btn btn-small btn-danger" ng-click="doAbort()"><i class="fa fa-circle-o-notch fa-spin"></i> {{_("Hangup")}}</a></span>
<span ng-switch-when="connected"><span class="msg">{{_("In call with")}} {{peer|displayName}}</span> <a class="btn btn-small btn-danger hiddenRoomTypeConference" ng-click="doHangup()"><i class="fa fa-sign-out"></i> {{_("Hangup")}}</a></span>
<span ng-switch-when="conference"><span class="msg">{{_("Conference with")}} {{peer|displayName}}<span>{{conferencePeers|displayConference}}</span></span> <a class="btn btn-small btn-danger hiddenRoomTypeConference" ng-click="doHangup()"><i class="fa fa-sign-out"></i> {{_("Hangup")}}</a></span>
<span ng-switch-when="connecting"><span class="msg">{{_("Calling %1$s", $parent.displayName(dialing))}}</span> <a class="btn btn-small btn-danger" ng-click="doAbort()"><i class="fa fa-circle-o-notch fa-spin"></i> {{_("Hangup")}}</a></span>
<span ng-switch-when="connected"><span class="msg">{{_("In call with %1$s", displayName(peer))}}</span> <a class="btn btn-small btn-danger hiddenRoomTypeConference" ng-click="doHangup()"><i class="fa fa-sign-out"></i> {{_("Hangup")}}</a></span>
<span ng-switch-when="conference"><span class="msg">{{_("Conference with %1$s", displayName(peer))}}<span>{{conferencePeers|displayConference}}</span></span> <a class="btn btn-small btn-danger hiddenRoomTypeConference" ng-click="doHangup()"><i class="fa fa-sign-out"></i> {{_("Hangup")}}</a></span>
<span ng-switch-when="closed"><span class="msg">{{_("Your are offline")}}</span> <a class="btn btn-small btn-success" ng-click="doReconnect()"><i class="fa fa-sign-in"></i> {{_("Go online")}}</a></span>
<span ng-switch-when="reconnecting">{{_("Connection interrupted")}} <i class="text-warning fa fa-circle-o-notch fa-spin"></i></span>
<span ng-switch-when="error"><span class="msg">{{_("An error occured")}}</span> <a class="btn btn-small btn-success" ng-click="doReconnect()"><i class="fa fa-refresh"></i> {{_("Retry")}}</a></span>
<span ng-switch-when="ringing"><span class="msg long">{{_("Incoming call")}} {{_("from")}} {{incoming|displayName}}</span> <span class="actions"><a class="btn btn-small btn-success btn-shakeityeah" ng-click="doAccept()"><i class="fa fa-phone"></i> {{_("Accept call")}}</a> <a class="btn btn-small btn-danger" ng-click="doReject()"><i class="fa fa-sign-out"></i> {{_("Reject")}}</a></span></span>
<span ng-switch-when="ringing"><span class="msg long">{{_("Incoming call from %1$s", displayName(incoming))}}</span> <span class="actions"><a class="btn btn-small btn-success btn-shakeityeah" ng-click="doAccept()"><i class="fa fa-phone"></i> {{_("Accept call")}}</a> <a class="btn btn-small btn-danger" ng-click="doReject()"><i class="fa fa-sign-out"></i> {{_("Reject")}}</a></span></span>
<span ng-switch-when="waitforusermedia"><span class="msg">{{_("Waiting for camera/microphone access")}}</span> <a class="btn btn-small btn-danger hiddenRoomTypeConference" ng-click="doHangup()"><i class="fa fa-circle-o-notch fa-spin"></i> {{_("Hangup")}}</a></span>
</span>

Loading…
Cancel
Save