Style the reconnect banner, clean up apply usage

This commit is contained in:
Tor Hveem 2015-03-14 21:10:19 +01:00
parent ca5542e46d
commit 7029511029
4 changed files with 13 additions and 8 deletions

View file

@ -267,11 +267,13 @@ td.time {
top: 35px;
position: fixed;
z-index: 9999;
background-color: #eee;
color: #333;
width: 100%;
width: 80%;
margin: 0;
padding: 5px;
left: 10%;
}
#reconnect a {
color: white;
}
.footer {

View file

@ -289,15 +289,17 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
</tr>
</tbody>
</table><span id="end-of-buffer"></span>
<div id="reconnect" ng-if="reconnecting">
<i class="glyphicon glyphicon-refresh"></i> Reconnecting... <a ng-click="reconnect()">Try now</a>
</div>
</div>
<div class="footer" ng-class="{'withnicklist': showNicklist}">
<div input-bar input-id="sendMessage" command="command"></div>
</div>
</div>
<div id="soundNotification"></div>
<div id="reconnect" class="alert alert-danger" ng-click="reconnect()" ng-show="reconnecting">
<p><strong>Connection to WeeChat lost</strong></p>
<i class="glyphicon glyphicon-refresh"></i>
Reconnecting... <a class="btn btn-tiny" ng-click="reconnect()">Click to try to reconnect now</a>
</div>
<div id="settingsModal" class="gb-modal" data-state="hidden">
<div class="backdrop" ng-click="closeModal($event)"></div>
<div class="modal-dialog">

View file

@ -184,10 +184,10 @@ weechat.factory('connection',
$log.info('Attempting to reconnect...');
var d = connectionData;
connect(d[0], d[1], d[2], d[3], d[4], function() {
$rootScope.reconnecting = false;
// on success, update active buffer
models.setActiveBuffer(bufferId);
$log.info('Sucessfully reconnected to relay');
$rootScope.reconnecting = false;
}, function() {
// on failure, schedule another attempt
if (timeout >= 600000) {
@ -217,6 +217,8 @@ weechat.factory('connection',
}
$rootScope.reconnecting = true;
// Have to do this to get the reconnect banner to show
$rootScope.$apply();
var bufferId = models.getActiveBuffer().id,
timeout = 3000; // start with a three-second timeout

View file

@ -110,7 +110,6 @@ function($rootScope, $q) {
$rootScope.$emit('onMessage', message);
}
$rootScope.$apply();
};
var connect = function(url,