Skip to content

Commit 6a5b685

Browse files
authored
Merge pull request #1053 from crazyserver/MOBILE-2103
Mobile 2103
2 parents 6cc4ac2 + 3792a64 commit 6a5b685

File tree

7 files changed

+45
-18
lines changed

7 files changed

+45
-18
lines changed

www/addons/messages/services/handlers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ angular.module('mm.addons.messages')
371371
}
372372

373373
function updateUnreadConversationsCount(siteId) {
374-
return $mmaMessages.getUnreadConversationsCount().then(function(unread) {
374+
siteId = siteId || $mmSite.getId();
375+
return $mmaMessages.getUnreadConversationsCount(undefined, siteId).then(function(unread) {
375376
// Leave badge enter if there is a 0+ or a 0.
376377
$scope.badge = parseInt(unread, 10) > 0 ? unread : '';
377378
// Update badge.

www/addons/mod/quiz/scss/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ p.mma-mod-quiz-warning {
4848
.mm-timer {
4949
min-height: 41px;
5050
border: 0;
51-
padding: 2px 0 1px 25px;
51+
padding: 1px 0 1px 25px;
5252

5353
.icon {
5454
left: 0;

www/addons/notifications/services/handlers.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ angular.module('mm.addons.notifications')
2323
* @ngdoc service
2424
* @name $mmaNotificationsHandlers
2525
*/
26-
.factory('$mmaNotificationsHandlers', function($log, $mmaNotifications, $mmEvents, $mmSitesManager, $mmUtil,
26+
.factory('$mmaNotificationsHandlers', function($log, $mmaNotifications, $mmEvents, $mmSitesManager, $mmUtil, $mmSite,
2727
mmaNotificationsReadChangedEvent, mmaNotificationsReadCronEvent, $mmAddonManager) {
2828
$log = $log.getInstance('$mmaNotificationsHandlers');
2929

@@ -106,7 +106,8 @@ angular.module('mm.addons.notifications')
106106
}
107107

108108
function updateUnreadNotificationsCount(siteId) {
109-
return $mmaNotifications.getUnreadNotificationsCount().then(function(unread) {
109+
siteId = siteId || $mmSite.getId();
110+
return $mmaNotifications.getUnreadNotificationsCount(undefined, siteId).then(function(unread) {
110111
// Leave badge enter if there is a 0+ or a 0.
111112
$scope.badge = parseInt(unread, 10) > 0 ? unread : '';
112113
// Update badge.

www/addons/pushnotifications/services/pushnotifications.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ angular.module('mm.addons.pushnotifications')
260260
* @module mm.addons.pushnotifications
261261
* @ngdoc method
262262
* @name $mmaPushNotifications#updateAddonCounter
263-
* @param {String} siteId Site ID.
264-
* @param {String} addon Registered addon name to set the badge number.
265-
* @param {Number} number The number to be stored.
266-
* @return {Promise} Promise resolved with the stored badge counter for the addon on the site.
263+
* @param {String} [siteId] Site ID. If not defined, use current site.
264+
* @param {String} addon Registered addon name to set the badge number.
265+
* @param {Number} number The number to be stored.
266+
* @return {Promise} Promise resolved with the stored badge counter for the addon on the site.
267267
*/
268268
self.updateAddonCounter = function(siteId, addon, number) {
269269
if ($mmPushNotificationsDelegate.isCounterHandlerRegistered(addon)) {
@@ -403,12 +403,14 @@ angular.module('mm.addons.pushnotifications')
403403
/**
404404
* Save the addon/site badgecounter on the database.
405405
*
406-
* @param {String} siteId Site ID.
406+
* @param {String} [siteId] Site ID. If not defined, use current site.
407407
* @param {Number} number The number to be stored.
408408
* @param {String} [addon] Registered addon name. If not defined it will store the site total.
409409
* @return {Promise} Promise resolved with the stored badge counter for the addon or site.
410410
*/
411411
function saveAddonBadge(siteId, number, addon) {
412+
siteId = siteId || $mmSite.getId();
413+
412414
var entry = {
413415
siteid: siteId,
414416
addon: addon || 'site',

www/core/components/courses/scss/styles.scss

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,21 @@ $doughnut-text-colour: $gray-darker;
9797

9898
.icon {
9999
position: absolute;
100-
top: 50%;
101100
text-align: center;
102101
/*rtl:ignore*/
103-
left: 50%;
102+
left: -1px;
103+
top: -1px;
104+
right: 0;
105+
bottom: 0;
104106
margin: 0;
105-
transform: translate(-42%, -50%);
106107
color: $white;
107-
height: ($chart-size / 2) + 10px;
108-
width: ($chart-size / 2) + 10px;
108+
height: $chart-size;
109+
width: $chart-size;
110+
line-height: $chart-size;
109111
font-size: ($chart-size / 2) + 10px;
112+
&:before {
113+
width: $chart-size;
114+
}
110115
}
111116
}
112117
}

www/core/components/login/controllers/reconnect.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ angular.module('mm.core.login')
4545

4646
$scope.credentials.username = site.infos.username;
4747
$scope.siteurl = site.infos.siteurl;
48+
$scope.sitename = site.infos.sitename;
49+
50+
// Check logoURL if user avatar is not set.
51+
if ($scope.site.avatar.startsWith(site.infos.siteurl + '/theme/image.php')) {
52+
$scope.site.avatar = false;
53+
return site.getPublicConfig().then(function(config) {
54+
$scope.logourl = config.logourl || config.compactlogourl;
55+
});
56+
}
4857
});
4958

5059
if (siteConfig) {

www/core/components/login/templates/reconnect.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22
<ion-content mm-state-class padding="true" class="mm-center-view">
33
<div class="mm-view-content">
44
<div class="box">
5-
<div class="item item-text-wrap item-avatar-center item-borderless">
6-
<img ng-src="{{site.avatar}}" class="avatar" mm-external-content siteid="site.id" alt="{{ 'mm.core.pictureof' | translate:{$a: site.fullname} }}" role="presentation">
7-
<h2 class="padding">{{siteurl}}</h2>
8-
<p ng-if="!isLoggedOut"><i class="icon ion-alert-circled padding"></i> {{ 'mm.login.reconnectdescription' | translate }}</p>
5+
<div class="item item-text-wrap item-avatar-center item-borderless" ng-class="{'item-avatar-center': site.avatar, 'text-center': !site.avatar}">
6+
<img ng-if="site.avatar" ng-src="{{site.avatar}}" class="avatar" mm-external-content siteid="site.id" alt="{{ 'mm.core.pictureof' | translate:{$a: site.fullname} }}" role="presentation">
7+
<!-- Show site logo or a default image. -->
8+
<img ng-if="!site.avatar && logourl" ng-src="{{logourl}}" class="avatar-full" mm-external-content role="presentation">
9+
<img ng-if="!site.avatar && !logourl" ng-src="img/moodle.png" class="avatar-full moodle-logo" role="presentation">
10+
11+
<!-- If no sitename show big siteurl. -->
12+
<p ng-if="!sitename" class="item-heading padding">{{siteurl}}</p>
13+
<!-- If sitename, show big sitename and small siteurl. -->
14+
<p ng-if="sitename" class="item-heading padding">{{sitename}}</p>
15+
<p ng-if="sitename">{{siteurl}}</p>
16+
17+
<p class="padding-top" ng-if="!isLoggedOut"><i class="icon ion-alert-circled padding"></i> {{ 'mm.login.reconnectdescription' | translate }}</p>
918
</div>
1019
<div class="list item padding">
1120
<h2>{{ 'mm.login.username' | translate }}</h2>

0 commit comments

Comments
 (0)