Merge pull request #1581 from crazyserver/MOBILE-2679
MOBILE-2679 myoverview: Add hidden and starred optionsmain
commit
58e7149b06
|
@ -12,13 +12,13 @@
|
||||||
"addon.badges.recipientdetails": "badges",
|
"addon.badges.recipientdetails": "badges",
|
||||||
"addon.block_activitymodules.pluginname": "block_activity_modules",
|
"addon.block_activitymodules.pluginname": "block_activity_modules",
|
||||||
"addon.block_myoverview.all": "block_myoverview",
|
"addon.block_myoverview.all": "block_myoverview",
|
||||||
|
"addon.block_myoverview.favourites": "block_myoverview",
|
||||||
"addon.block_myoverview.future": "block_myoverview",
|
"addon.block_myoverview.future": "block_myoverview",
|
||||||
|
"addon.block_myoverview.hiddencourses": "block_myoverview",
|
||||||
"addon.block_myoverview.inprogress": "block_myoverview",
|
"addon.block_myoverview.inprogress": "block_myoverview",
|
||||||
"addon.block_myoverview.lastaccessed": "block_myoverview",
|
"addon.block_myoverview.lastaccessed": "block_myoverview",
|
||||||
"addon.block_myoverview.morecourses": "block_myoverview",
|
"addon.block_myoverview.morecourses": "block_myoverview",
|
||||||
"addon.block_myoverview.nocoursesfuture": "block_myoverview",
|
"addon.block_myoverview.nocourses": "block_myoverview",
|
||||||
"addon.block_myoverview.nocoursesinprogress": "block_myoverview",
|
|
||||||
"addon.block_myoverview.nocoursespast": "block_myoverview",
|
|
||||||
"addon.block_myoverview.past": "block_myoverview",
|
"addon.block_myoverview.past": "block_myoverview",
|
||||||
"addon.block_myoverview.pluginname": "block_myoverview",
|
"addon.block_myoverview.pluginname": "block_myoverview",
|
||||||
"addon.block_myoverview.title": "block_myoverview",
|
"addon.block_myoverview.title": "block_myoverview",
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
<ion-option value="inprogress">{{ 'addon.block_myoverview.inprogress' | translate }}</ion-option>
|
<ion-option value="inprogress">{{ 'addon.block_myoverview.inprogress' | translate }}</ion-option>
|
||||||
<ion-option value="future">{{ 'addon.block_myoverview.future' | translate }}</ion-option>
|
<ion-option value="future">{{ 'addon.block_myoverview.future' | translate }}</ion-option>
|
||||||
<ion-option value="past">{{ 'addon.block_myoverview.past' | translate }}</ion-option>
|
<ion-option value="past">{{ 'addon.block_myoverview.past' | translate }}</ion-option>
|
||||||
|
<ion-option value="favourite" *ngIf="showFavourite">{{ 'addon.block_myoverview.favourites' | translate }}</ion-option>
|
||||||
|
<ion-option value="hidden" *ngIf="showHidden">{{ 'addon.block_myoverview.hiddencourses' | translate }}</ion-option>
|
||||||
</ion-select>
|
</ion-select>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
<!-- "Sort" selector. -->
|
<!-- "Sort" selector. -->
|
||||||
|
@ -35,11 +37,7 @@
|
||||||
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="courses[selectedFilter].length == 0">
|
<core-empty-box *ngIf="courses[selectedFilter].length == 0" image="assets/img/icons/courses.svg" [message]="'addon.block_myoverview.nocourses' | translate"></core-empty-box>
|
||||||
<core-empty-box *ngIf="selectedFilter == 'inprogress'" image="assets/img/icons/courses.svg" [message]="'addon.block_myoverview.nocoursesinprogress' | translate"></core-empty-box>
|
|
||||||
<core-empty-box *ngIf="selectedFilter == 'future'" image="assets/img/icons/courses.svg" [message]="'addon.block_myoverview.nocoursesfuture' | translate"></core-empty-box>
|
|
||||||
<core-empty-box *ngIf="selectedFilter == 'past'" image="assets/img/icons/courses.svg" [message]="'addon.block_myoverview.nocoursespast' | translate"></core-empty-box>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Filter courses. -->
|
<!-- Filter courses. -->
|
||||||
<ion-searchbar #searchbar *ngIf="showFilter" [(ngModel)]="courses.filter" (ionInput)="filterChanged($event)" (ionCancel)="filterChanged()" [placeholder]="'core.courses.filtermycourses' | translate">
|
<ion-searchbar #searchbar *ngIf="showFilter" [(ngModel)]="courses.filter" (ionInput)="filterChanged($event)" (ionCancel)="filterChanged()" [placeholder]="'core.courses.filtermycourses' | translate">
|
||||||
|
|
|
@ -40,7 +40,9 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
||||||
all: [],
|
all: [],
|
||||||
past: [],
|
past: [],
|
||||||
inprogress: [],
|
inprogress: [],
|
||||||
future: []
|
future: [],
|
||||||
|
favourite: [],
|
||||||
|
hidden: []
|
||||||
};
|
};
|
||||||
selectedFilter = 'inprogress';
|
selectedFilter = 'inprogress';
|
||||||
sort = 'title';
|
sort = 'title';
|
||||||
|
@ -51,9 +53,13 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
||||||
all: {},
|
all: {},
|
||||||
inprogress: {},
|
inprogress: {},
|
||||||
past: {},
|
past: {},
|
||||||
future: {}
|
future: {},
|
||||||
|
favourite: {},
|
||||||
|
hidden: {}
|
||||||
};
|
};
|
||||||
showFilter = false;
|
showFilter = false;
|
||||||
|
showFavourite = false;
|
||||||
|
showHidden = false;
|
||||||
showSelectorFilter = false;
|
showSelectorFilter = false;
|
||||||
showSortFilter = false;
|
showSortFilter = false;
|
||||||
|
|
||||||
|
@ -162,8 +168,10 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
||||||
|
|
||||||
this.courses.filter = '';
|
this.courses.filter = '';
|
||||||
this.showFilter = false;
|
this.showFilter = false;
|
||||||
this.showSelectorFilter = this.courses.past.length > 0 || this.courses.future.length > 0 || (courses.length > 0 &&
|
this.showSelectorFilter = courses.length > 0 && (this.courses.past.length > 0 || this.courses.future.length > 0 ||
|
||||||
typeof courses[0].enddate != 'undefined');
|
typeof courses[0].enddate != 'undefined');
|
||||||
|
this.showHidden = this.showSelectorFilter && typeof courses[0].hidden != 'undefined';
|
||||||
|
this.showFavourite = this.showSelectorFilter && typeof courses[0].isfavourite != 'undefined';
|
||||||
if (!this.showSelectorFilter) {
|
if (!this.showSelectorFilter) {
|
||||||
// No selector, show all.
|
// No selector, show all.
|
||||||
this.selectedFilter = 'all';
|
this.selectedFilter = 'all';
|
||||||
|
@ -276,22 +284,34 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.courses.all = courses;
|
this.courses.all = [];
|
||||||
this.courses.past = [];
|
this.courses.past = [];
|
||||||
this.courses.inprogress = [];
|
this.courses.inprogress = [];
|
||||||
this.courses.future = [];
|
this.courses.future = [];
|
||||||
|
this.courses.favourite = [];
|
||||||
|
this.courses.hidden = [];
|
||||||
|
|
||||||
const today = moment().unix();
|
const today = moment().unix();
|
||||||
courses.forEach((course) => {
|
courses.forEach((course) => {
|
||||||
if ((course.enddate && course.enddate < today) || course.completed) {
|
if (course.hidden) {
|
||||||
// Courses that have already ended.
|
this.courses.hidden.push(course);
|
||||||
this.courses.past.push(course);
|
} else {
|
||||||
} else if (course.startdate > today) {
|
this.courses.all.push(course);
|
||||||
// Courses that have not started yet.
|
|
||||||
this.courses.future.push(course);
|
if ((course.enddate && course.enddate < today) || course.completed) {
|
||||||
} else {
|
// Courses that have already ended.
|
||||||
// Courses still in progress.
|
this.courses.past.push(course);
|
||||||
this.courses.inprogress.push(course);
|
} else if (course.startdate > today) {
|
||||||
|
// Courses that have not started yet.
|
||||||
|
this.courses.future.push(course);
|
||||||
|
} else {
|
||||||
|
// Courses still in progress.
|
||||||
|
this.courses.inprogress.push(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (course.isfavourite) {
|
||||||
|
this.courses.favourite.push(course);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
"all": "All",
|
"all": "All",
|
||||||
"future": "Future",
|
"future": "Future",
|
||||||
"inprogress": "In progress",
|
"inprogress": "In progress",
|
||||||
|
"favourites" : "Starred",
|
||||||
|
"hiddencourses": "Hidden",
|
||||||
"lastaccessed": "Last accessed",
|
"lastaccessed": "Last accessed",
|
||||||
"morecourses": "More courses",
|
"morecourses": "More courses",
|
||||||
"nocoursesfuture": "No future courses",
|
"nocourses": "No courses",
|
||||||
"nocoursesinprogress": "No in progress courses",
|
|
||||||
"nocoursespast": "No past courses",
|
|
||||||
"past": "Past",
|
"past": "Past",
|
||||||
"pluginname": "Course Overview",
|
"pluginname": "Course Overview",
|
||||||
"title": "Title"
|
"title": "Title"
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
"addon.badges.recipientdetails": "Recipient details",
|
"addon.badges.recipientdetails": "Recipient details",
|
||||||
"addon.block_activitymodules.pluginname": "Activities",
|
"addon.block_activitymodules.pluginname": "Activities",
|
||||||
"addon.block_myoverview.all": "All",
|
"addon.block_myoverview.all": "All",
|
||||||
|
"addon.block_myoverview.favourites": "Starred",
|
||||||
"addon.block_myoverview.future": "Future",
|
"addon.block_myoverview.future": "Future",
|
||||||
|
"addon.block_myoverview.hiddencourses": "Hidden",
|
||||||
"addon.block_myoverview.inprogress": "In progress",
|
"addon.block_myoverview.inprogress": "In progress",
|
||||||
"addon.block_myoverview.lastaccessed": "Last accessed",
|
"addon.block_myoverview.lastaccessed": "Last accessed",
|
||||||
"addon.block_myoverview.morecourses": "More courses",
|
"addon.block_myoverview.morecourses": "More courses",
|
||||||
"addon.block_myoverview.nocoursesfuture": "No future courses",
|
"addon.block_myoverview.nocourses": "No courses",
|
||||||
"addon.block_myoverview.nocoursesinprogress": "No in progress courses",
|
|
||||||
"addon.block_myoverview.nocoursespast": "No past courses",
|
|
||||||
"addon.block_myoverview.past": "Past",
|
"addon.block_myoverview.past": "Past",
|
||||||
"addon.block_myoverview.pluginname": "Course Overview",
|
"addon.block_myoverview.pluginname": "Course Overview",
|
||||||
"addon.block_myoverview.title": "Title",
|
"addon.block_myoverview.title": "Title",
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
ion-app.app-root core-block {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
core-loading.core-loading-center {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
.core-loading-container {
|
||||||
|
margin-top: 10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core-empty-box .core-empty-box {
|
||||||
|
position: relative;
|
||||||
|
z-index: initial;
|
||||||
|
@include position(initial, initial, null, initial);
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
<ion-card [attr.course-color]="course.id % 10">
|
<ion-card [attr.course-color]="course.id % 10">
|
||||||
<div (click)="openCourse(course)" class="core-course-thumb" [class.core-course-color-img]="course.imageThumb">
|
<div (click)="openCourse(course)" class="core-course-thumb" [class.core-course-color-img]="course.imageThumb">
|
||||||
<img *ngIf="course.imageThumb" [src]="course.imageThumb" core-external-content alt=""/>
|
<img *ngIf="course.imageThumb" [src]="course.imageThumb" core-external-content alt=""/>
|
||||||
|
<core-icon name="fa-star" *ngIf="course.isfavourite"></core-icon>
|
||||||
</div>
|
</div>
|
||||||
<ion-item tappable text-wrap detail-none (click)="openCourse(course)" [title]="course.displayname || course.fullname" class="core-course-link" [class.item-disabled]="course.visible == 0">
|
<ion-item tappable text-wrap detail-none (click)="openCourse(course)" [title]="course.displayname || course.fullname" class="core-course-link" [class.item-disabled]="course.visible == 0">
|
||||||
<h2><core-format-text [text]="course.displayname || course.fullname"></core-format-text></h2>
|
<h2><core-format-text [text]="course.displayname || course.fullname"></core-format-text></h2>
|
||||||
|
|
|
@ -29,6 +29,16 @@ ion-app.app-root core-courses-course-progress {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ion-icon {
|
||||||
|
position: absolute;
|
||||||
|
@include position(0, null, null, 0);
|
||||||
|
padding: 16px;
|
||||||
|
color: $gray-darker;
|
||||||
|
-webkit-text-stroke-width: 0.5px;
|
||||||
|
-webkit-text-stroke-color: $gray-lighter;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.core-course-link {
|
.core-course-link {
|
||||||
|
|
Loading…
Reference in New Issue