-
-
-
+
+
{{profile.fullname}}
@@ -66,9 +65,7 @@
-
-
-
+
{{ 'addon.mod_workshop.feedbackby' | translate : {$a: evaluateGradingByProfile.fullname} }}
diff --git a/src/addon/mod/workshop/pages/submission/submission.html b/src/addon/mod/workshop/pages/submission/submission.html
index d2373d42c..bbadc5cf3 100644
--- a/src/addon/mod/workshop/pages/submission/submission.html
+++ b/src/addon/mod/workshop/pages/submission/submission.html
@@ -36,9 +36,7 @@
-
-
-
+
{{ 'addon.mod_workshop.feedbackby' | translate : {$a: evaluateByProfile.fullname} }}
@@ -97,9 +95,7 @@
-
-
-
+
{{ 'addon.mod_workshop.feedbackby' | translate : {$a: evaluateGradingByProfile.fullname} }}
diff --git a/src/addon/notes/components/list/addon-notes-list.html b/src/addon/notes/components/list/addon-notes-list.html
index 21f24aba2..c66e1e2f6 100644
--- a/src/addon/notes/components/list/addon-notes-list.html
+++ b/src/addon/notes/components/list/addon-notes-list.html
@@ -27,9 +27,7 @@
0">
-
-
-
+
{{note.userfullname}}
{{note.lastmodified | coreDateDayOrTime}}
{{ 'core.notsent' | translate }}
diff --git a/src/addon/notifications/pages/list/list.html b/src/addon/notifications/pages/list/list.html
index 0ee4eb357..32d742ccf 100644
--- a/src/addon/notifications/pages/list/list.html
+++ b/src/addon/notifications/pages/list/list.html
@@ -19,9 +19,7 @@
-
-
-
+
{{notification.userfromfullname}}
{{notification.timecreated | coreDateDayOrTime}}
diff --git a/src/components/chrono/chrono.ts b/src/components/chrono/chrono.ts
index ca8757a41..5770db45f 100644
--- a/src/components/chrono/chrono.ts
+++ b/src/components/chrono/chrono.ts
@@ -52,7 +52,7 @@ export class CoreChronoComponent implements OnChanges, OnDestroy {
}
/**
- * Component being initialized.
+ * Component being changed.
*/
ngOnChanges(changes: { [name: string]: SimpleChange }): void {
if (changes && changes.running) {
diff --git a/src/components/components.module.ts b/src/components/components.module.ts
index 487778e49..0e631c2b9 100644
--- a/src/components/components.module.ts
+++ b/src/components/components.module.ts
@@ -50,6 +50,7 @@ import { CoreAttachmentsComponent } from './attachments/attachments';
import { CoreIonTabsComponent } from './ion-tabs/ion-tabs';
import { CoreIonTabComponent } from './ion-tabs/ion-tab';
import { CoreInfiniteLoadingComponent } from './infinite-loading/infinite-loading';
+import { CoreUserAvatarComponent } from './user-avatar/user-avatar';
@NgModule({
declarations: [
@@ -85,7 +86,8 @@ import { CoreInfiniteLoadingComponent } from './infinite-loading/infinite-loadin
CoreAttachmentsComponent,
CoreIonTabsComponent,
CoreIonTabComponent,
- CoreInfiniteLoadingComponent
+ CoreInfiniteLoadingComponent,
+ CoreUserAvatarComponent
],
entryComponents: [
CoreContextMenuPopoverComponent,
@@ -128,7 +130,8 @@ import { CoreInfiniteLoadingComponent } from './infinite-loading/infinite-loadin
CoreAttachmentsComponent,
CoreIonTabsComponent,
CoreIonTabComponent,
- CoreInfiniteLoadingComponent
+ CoreInfiniteLoadingComponent,
+ CoreUserAvatarComponent
]
})
export class CoreComponentsModule {}
diff --git a/src/components/user-avatar/core-user-avatar.html b/src/components/user-avatar/core-user-avatar.html
new file mode 100644
index 000000000..d98bbdece
--- /dev/null
+++ b/src/components/user-avatar/core-user-avatar.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/src/components/user-avatar/user-avatar.scss b/src/components/user-avatar/user-avatar.scss
new file mode 100644
index 000000000..ad4989164
--- /dev/null
+++ b/src/components/user-avatar/user-avatar.scss
@@ -0,0 +1,15 @@
+ion-avatar.user-avatar {
+ position: relative;
+
+ .contact-status {
+ position: absolute;
+ @include position(null, 0, 0, null);
+ width: 14px;
+ height: 14px;
+ border-radius: 50%;
+ &.online {
+ border: 1px solid white;
+ background-color: $core-online-color;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/components/user-avatar/user-avatar.ts b/src/components/user-avatar/user-avatar.ts
new file mode 100644
index 000000000..3755c7bd4
--- /dev/null
+++ b/src/components/user-avatar/user-avatar.ts
@@ -0,0 +1,113 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { Component, Input, OnInit, OnChanges, SimpleChange } from '@angular/core';
+import { NavController } from 'ionic-angular';
+import { CoreSitesProvider } from '@providers/sites';
+
+/**
+ * Component to display a "user avatar".
+ *
+ * Example:
+ */
+@Component({
+ selector: 'ion-avatar.user-avatar',
+ templateUrl: 'core-user-avatar.html'
+})
+export class CoreUserAvatarComponent implements OnInit, OnChanges {
+ @Input() user: any;
+ // The following params will override the ones in user object.
+ @Input() profileUrl?: string;
+ @Input() fullname?: string;
+ @Input() protected userId?: number; // If provided or found it will be used to link the image to the profile.
+ @Input() protected courseId?: number;
+
+ // Variable to check if we consider this user online or not.
+ protected timetoshowusers = 300000; // Miliseconds default.
+ protected myUser = false;
+ protected currentUserId: number;
+
+ constructor(private navCtrl: NavController, private sitesProvider: CoreSitesProvider) {
+ this.currentUserId = this.sitesProvider.getCurrentSiteUserId();
+ }
+
+ /**
+ * Component being initialized.
+ */
+ ngOnInit(): void {
+ console.error(this.user);
+ this.setFields();
+
+ // @TODO: This setting is not currently available so we are always using the default setting.
+ /*if (!this.myUser) {
+ let minutes = 5;
+ this.sitesProvider.getCurrentSite().getConfig('block_online_users_timetosee').then((timetosee) => {
+ minutes = timetosee || minutes;
+ }).catch(() => {
+ // Ignore errors.
+ }).finally(() => {
+ this.timetoshowusers = minutes * 60000;
+ });
+ }*/
+ }
+
+ /**
+ * Listen to changes.
+ */
+ ngOnChanges(changes: { [name: string]: SimpleChange }): void {
+ // If something change, update the fields.
+ if (changes) {
+ this.setFields();
+ }
+ }
+
+ /**
+ * Set fields from user.
+ */
+ protected setFields(): void {
+ this.profileUrl = this.profileUrl || this.user.profileimageurl || this.user.userprofileimageurl ||
+ this.user.userpictureurl || this.user.profileimageurlsmall;
+
+ this.fullname = this.fullname || this.user.fullname || this.user.userfullname;
+
+ this.userId = this.userId || this.user.userid;
+ this.courseId = this.courseId || this.user.courseid;
+
+ // If not available we cannot ensure the avatar is from the current user.
+ this.myUser = this.userId && this.userId == this.currentUserId;
+ }
+
+ /**
+ * Helper function for checking the time meets the 'online' condition.
+ *
+ * @return boolean
+ */
+ isOnline(): boolean {
+ const time = new Date().getTime() - this.timetoshowusers;
+
+ return !this.myUser && ((this.user.lastaccess && this.user.lastaccess * 1000 >= time) || this.user.isonline);
+ }
+
+ /**
+ * Function executed image clicked.
+ */
+ gotoProfile(event: any): void {
+ // If the event prevented default action, do nothing.
+ if (!event.defaultPrevented && this.userId) {
+ event.preventDefault();
+ event.stopPropagation();
+ this.navCtrl.push('CoreUserProfilePage', { userId: this.userId, courseId: this.courseId });
+ }
+ }
+}
diff --git a/src/core/comments/pages/viewer/viewer.html b/src/core/comments/pages/viewer/viewer.html
index 5087edd96..a9e7de661 100644
--- a/src/core/comments/pages/viewer/viewer.html
+++ b/src/core/comments/pages/viewer/viewer.html
@@ -12,9 +12,7 @@
-
-
-
+
{{ comment.fullname }}
{{ comment.time }}
diff --git a/src/core/courses/pages/course-preview/course-preview.html b/src/core/courses/pages/course-preview/course-preview.html
index 2a52bad10..9300ed0c9 100644
--- a/src/core/courses/pages/course-preview/course-preview.html
+++ b/src/core/courses/pages/course-preview/course-preview.html
@@ -26,10 +26,8 @@
{{ 'core.teachers' | translate }}
-
-
-
-
+
+
{{contact.fullname}}
diff --git a/src/core/mainmenu/pages/more/more.html b/src/core/mainmenu/pages/more/more.html
index b7b585c76..3b2c070cb 100644
--- a/src/core/mainmenu/pages/more/more.html
+++ b/src/core/mainmenu/pages/more/more.html
@@ -5,10 +5,8 @@
-
-
-
-
+
+
{{siteInfo.fullname}}
diff --git a/src/core/user/components/participants/core-user-participants.html b/src/core/user/components/participants/core-user-participants.html
index 287c76baa..14a9ef664 100644
--- a/src/core/user/components/participants/core-user-participants.html
+++ b/src/core/user/components/participants/core-user-participants.html
@@ -9,9 +9,7 @@
0" no-margin>
-
-
-
+
{{ 'core.lastaccess' | translate }}: {{ participant.lastaccess * 1000 | coreFormatDate:"dfmediumdate"}}
diff --git a/src/theme/variables.scss b/src/theme/variables.scss
index 44d572b52..7eeb788e9 100644
--- a/src/theme/variables.scss
+++ b/src/theme/variables.scss
@@ -111,6 +111,8 @@ $button-md-box-shadow: 0 2px 2px 1px rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0,
$refresher-icon-color: $core-color !default;
+$core-online-color: #5cb85c;
+
// Moodle Mobile variables
// --------------------------------------------------