Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile 4653 #4305

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"ionic.ionic",
"dbaeumer.vscode-eslint",
"angular.ng-template"
"angular.ng-template",
"nesterenok.js-beautify-extentions",
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features",
"editor.defaultFormatter": "nesterenok.js-beautify-extentions",
},
"editor.formatOnSave": true,
"eslint.format.enable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ <h3>
<ion-item>
<ion-label>
@if (course) {
<h3><ng-container *ngTemplateOutlet="date" /></h3>
<h3><ng-container *ngTemplateOutlet="date" /></h3>
} @else {
<h4><ng-container *ngTemplateOutlet="date" /></h4>
<h4><ng-container *ngTemplateOutlet="date" /></h4>
}
<ng-template #date>
{{ dayEvents.dayTimestamp * 1000 | coreFormatDate:"strftimedaydate" }}
Expand Down
52 changes: 26 additions & 26 deletions src/addons/blog/pages/edit-entry/edit-entry.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,35 @@ <h1>{{ entry ? entry.subject : 'addon.blog.addnewentry' | translate }}</h1>
[componentId]="entry?.id ?? 0" />

@if (courseId && associatedCourse) {
<ion-item class="divider section" (click)="toggleAssociations()" button [detail]="false"
[attr.aria-label]="(associationsExpanded ? 'core.collapse' : 'core.expand') | translate"
[attr.aria-expanded]="associationsExpanded" aria-controls="addon-blog-associations"
[class.expandable-status-icon-expanded]="associationsExpanded">
<ion-icon [name]="associationsExpanded ? 'fas-chevron-down' : 'fas-chevron-right'" flip-rtl slot="start"
class="expandable-status-icon" />
<ion-label>
<h2>{{ 'addon.blog.associations' | translate }}</h2>
</ion-label>
</ion-item>
<div id="addon-blog-associations">
@if (associationsExpanded) {
<ion-item>
@if (associatedModule) {
<ion-toggle formControlName="associateWithModule">
<core-format-text [text]="'addon.blog.associatewithmodule' | translate: {
<ion-item class="divider section" (click)="toggleAssociations()" button [detail]="false"
[attr.aria-label]="(associationsExpanded ? 'core.collapse' : 'core.expand') | translate"
[attr.aria-expanded]="associationsExpanded" aria-controls="addon-blog-associations"
[class.expandable-status-icon-expanded]="associationsExpanded">
<ion-icon [name]="associationsExpanded ? 'fas-chevron-down' : 'fas-chevron-right'" flip-rtl slot="start"
class="expandable-status-icon" />
<ion-label>
<h2>{{ 'addon.blog.associations' | translate }}</h2>
</ion-label>
</ion-item>
<div id="addon-blog-associations">
@if (associationsExpanded) {
<ion-item>
@if (associatedModule) {
<ion-toggle formControlName="associateWithModule">
<core-format-text [text]="'addon.blog.associatewithmodule' | translate: {
$a: { modtype: associatedModule.modname, modname: associatedModule.name }
}" [contextLevel]="moduleContext" [contextInstanceId]="modId" [courseId]="courseId" />
</ion-toggle>
} @else if (associatedCourse) {
<ion-toggle formControlName="associateWithCourse">
<core-format-text
[text]="'addon.blog.associatewithcourse' | translate: { $a: { coursename: associatedCourse.fullname } }"
[contextLevel]="courseContext" [contextInstanceId]="courseId" [courseId]="courseId" />
</ion-toggle>
</ion-toggle>
} @else if (associatedCourse) {
<ion-toggle formControlName="associateWithCourse">
<core-format-text
[text]="'addon.blog.associatewithcourse' | translate: { $a: { coursename: associatedCourse.fullname } }"
[contextLevel]="courseContext" [contextInstanceId]="courseId" [courseId]="courseId" />
</ion-toggle>
}
</ion-item>
}
</ion-item>
}
</div>
</div>
}

<ion-button class="ion-margin" expand="block" [ariaLabel]="'core.save' | translate"
Expand Down
200 changes: 101 additions & 99 deletions src/addons/blog/pages/index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,122 +25,124 @@ <h1>{{ title | translate }}</h1>

<core-loading [hideUntil]="loaded()">
@if (showMyEntriesToggle) {
<ion-item class="ion-text-wrap">
<ion-toggle [(ngModel)]="onlyMyEntries" (ionChange)="onlyMyEntriesToggleChanged(onlyMyEntries)">
{{ 'addon.blog.showonlyyourentries' | translate }}
</ion-toggle>
</ion-item>
<ion-item class="ion-text-wrap">
<ion-toggle [(ngModel)]="onlyMyEntries" (ionChange)="onlyMyEntriesToggleChanged(onlyMyEntries)">
{{ 'addon.blog.showonlyyourentries' | translate }}
</ion-toggle>
</ion-item>
}

@if (hasOfflineDataToSync()) {
<ion-card class="core-warning-card">
<ion-item>
<ion-icon name="fas-triangle-exclamation" slot="start" aria-hidden="true" />
<ion-label>{{ 'core.hasdatatosync' | translate:{ $a: 'addon.blog.blog' | translate } }}</ion-label>
</ion-item>
</ion-card>
<ion-card class="core-warning-card">
<ion-item>
<ion-icon name="fas-triangle-exclamation" slot="start" aria-hidden="true" />
<ion-label>{{ 'core.hasdatatosync' | translate:{ $a: 'addon.blog.blog' | translate } }}</ion-label>
</ion-item>
</ion-card>
}

@for (entry of entries; track getEntryTemplateId(entry)) {
<div class="entry ion-padding-start ion-padding-top ion-padding-end" [id]="getEntryTemplateId(entry)">
<div class="entry-subject flex ion-text-wrap ion-justify-content-between ion-align-items-center">
<h3>
<core-format-text [text]="entry.subject" [contextLevel]="contextLevel" [contextInstanceId]="contextInstanceId"
[courseId]="entry.courseid" />
@if (entry.userid === currentUserId && entry.publishTranslated === 'publishtonoone') {
<span class="entry-draft">
<ion-badge color="warning"> {{ 'addon.blog.publishtonoone' | translate }} </ion-badge>
</span>
<div class="entry ion-padding-start ion-padding-top ion-padding-end" [id]="getEntryTemplateId(entry)">
<div class="entry-subject flex ion-text-wrap ion-justify-content-between ion-align-items-center">
<h3>
<core-format-text [text]="entry.subject" [contextLevel]="contextLevel" [contextInstanceId]="contextInstanceId"
[courseId]="entry.courseid" />
@if (entry.userid === currentUserId && entry.publishTranslated === 'publishtonoone') {
<span class="entry-draft">
<ion-badge color="warning"> {{ 'addon.blog.publishtonoone' | translate }} </ion-badge>
</span>
}

@if (!getEntryId(entry) || entry.updatedOffline) {
<span class="entry-draft">
<ion-badge color="light">
<ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" />
{{ 'core.notsent' | translate }}
</ion-badge>
</span>
}
</h3>

@if (entry.userid === currentUserId && optionsAvailable && !entry.deleted) {
<ion-button fill="clear" [ariaLabel]="'core.displayoptions' | translate"
(click)="showEntryActionsPopover($event, entry)" class="entry-options">
<ion-icon slot="icon-only" aria-hidden="true" name="ellipsis-vertical" />
</ion-button>
}

@if (!getEntryId(entry) || entry.updatedOffline) {
<span class="entry-draft">
<ion-badge color="light">
<ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" />
{{ 'core.notsent' | translate }}
</ion-badge>
</span>
@if (entry.deleted) {
<ion-button slot="end" fill="clear" color="danger" (click)="undoDelete(entry)"
[ariaLabel]="'core.restore' | translate">
<ion-icon name="fas-rotate-left" slot="icon-only" aria-hidden="true" />
</ion-button>
}
</h3>

@if (entry.userid === currentUserId && optionsAvailable && !entry.deleted) {
<ion-button fill="clear" [ariaLabel]="'core.displayoptions' | translate" (click)="showEntryActionsPopover($event, entry)"
class="entry-options">
<ion-icon slot="icon-only" aria-hidden="true" name="ellipsis-vertical" />
</ion-button>
}

@if (entry.deleted) {
<ion-button slot="end" fill="clear" color="danger" (click)="undoDelete(entry)" [ariaLabel]="'core.restore' | translate">
<ion-icon name="fas-rotate-left" slot="icon-only" aria-hidden="true" />
</ion-button>
}
</div>

<div class="entry-creation-info flex ion-align-items-center">
<div class="entry-avatar">
<core-user-avatar [user]="entry.user" [courseId]="entry.courseid" />
</div>

@if (entry.user?.fullname && entry.created) {
<span [innerHTML]="'core.bynameondate' | translate: {
<div class="entry-creation-info flex ion-align-items-center">
<div class="entry-avatar">
<core-user-avatar [user]="entry.user" [courseId]="entry.courseid" />
</div>

@if (entry.user?.fullname && entry.created) {
<span [innerHTML]="'core.bynameondate' | translate: {
'$a': { name: '<strong>' + entry.user?.fullname + '</strong>', date: (entry.created | coreDateDayOrTime) }
}"></span>
} @else if (!entry.user?.fullname && entry.created) {
<span>{{ entry.created | coreDateDayOrTime }}</span>
}
</div>

<div class="entry-summary" [collapsible-item]="64">
<div class="ion-margin-bottom">
<core-format-text [text]="entry.summary" [component]="component" [componentId]="getEntryId(entry)"
[contextLevel]="contextLevel" [contextInstanceId]="contextInstanceId" [courseId]="entry.courseid" />
} @else if (!entry.user?.fullname && entry.created) {
<span>{{ entry.created | coreDateDayOrTime }}</span>
}
</div>

@if (tagsEnabled && entry.tags && entry.tags!.length > 0) {
<ion-item class="ion-text-wrap" lines="none">
<ion-label>
<div slot="start">{{ 'core.tag.tags' | translate }}:</div>
<core-tag-list [tags]="entry.tags" />
</ion-label>
</ion-item>
}
<div class="entry-summary" [collapsible-item]="64">
<div class="ion-margin-bottom">
<core-format-text [text]="entry.summary" [component]="component" [componentId]="getEntryId(entry)"
[contextLevel]="contextLevel" [contextInstanceId]="contextInstanceId" [courseId]="entry.courseid" />
</div>

@if (tagsEnabled && entry.tags && entry.tags!.length > 0) {
<ion-item class="ion-text-wrap" lines="none">
<ion-label>
<div slot="start">{{ 'core.tag.tags' | translate }}:</div>
<core-tag-list [tags]="entry.tags" />
</ion-label>
</ion-item>
}

<core-files [files]="entry.attachmentfiles" [component]="component" [componentId]="getEntryId(entry) ?? entry.created" />
<core-files [files]="entry.attachmentfiles" [component]="component"
[componentId]="getEntryId(entry) ?? entry.created" />

@if (entry.uniquehash) {
<ion-item [href]="entry.uniquehash" core-link [detail]="true" lines="none">
<ion-label>{{ 'addon.blog.linktooriginalentry' | translate }}</ion-label>
</ion-item>
}
</div>
@if (entry.uniquehash) {
<ion-item [href]="entry.uniquehash" core-link [detail]="true" lines="none">
<ion-label>{{ 'addon.blog.linktooriginalentry' | translate }}</ion-label>
</ion-item>
}
</div>

@if (entry.lastmodified > entry.created || (entry.userid === currentUserId && entry.publishstate !== 'draft')) {
<ion-item class="entry-last-modification" lines="none">
@if (entry.lastmodified > entry.created) {
<ion-note class="flex ion-align-items-center" slot="start">
<ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" />
{{ entry.lastmodified | coreTimeAgo }}
</ion-note>
@if (entry.lastmodified > entry.created || (entry.userid === currentUserId && entry.publishstate !== 'draft')) {
<ion-item class="entry-last-modification" lines="none">
@if (entry.lastmodified > entry.created) {
<ion-note class="flex ion-align-items-center" slot="start">
<ion-icon name="fas-clock" [attr.aria-label]="'core.lastmodified' | translate" />
{{ entry.lastmodified | coreTimeAgo }}
</ion-note>
}

@if (entry.userid === currentUserId && entry.publishstate !== 'draft') {
<ion-badge class="entry-visibility-permission" color="success" slot="end">
<ion-icon name="fas-eye" />
{{ 'addon.blog.' + entry.publishTranslated | translate }}
</ion-badge>
}
</ion-item>
}

@if (entry.userid === currentUserId && entry.publishstate !== 'draft') {
<ion-badge class="entry-visibility-permission" color="success" slot="end">
<ion-icon name="fas-eye" />
{{ 'addon.blog.' + entry.publishTranslated | translate }}
</ion-badge>
@if (getEntryId(entry) && commentsEnabled) {
<core-comments [component]="this.component" [itemId]="getEntryId(entry)" area="format_blog" [instanceId]="entry.userid"
contextLevel="user" [showItem]="true" [courseId]="entry.courseid" />
}
</ion-item>
}

@if (getEntryId(entry) && commentsEnabled) {
<core-comments [component]="this.component" [itemId]="getEntryId(entry)" area="format_blog" [instanceId]="entry.userid"
contextLevel="user" [showItem]="true" [courseId]="entry.courseid" />
}

</div>
</div>
} @empty {
<core-empty-box icon="far-newspaper" [message]="'addon.blog.noentriesyet' | translate" />
<core-empty-box icon="far-newspaper" [message]="'addon.blog.noentriesyet' | translate" />
}

<core-infinite-loading [enabled]="canLoadMore" (action)="loadMore($event)" [error]="loadMoreError" />
Expand All @@ -149,12 +151,12 @@ <h3>

<!-- Create a blog entry. -->
@if ((filter.userid === currentUserId || showMyEntriesToggle) && loaded() && optionsAvailable) {
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end">
<ion-fab-button (click)="createNewEntry()" [attr.aria-label]="'addon.blog.addnewentry' | translate">
<ion-icon name="fas-pen-to-square" aria-hidden="true" />
<span class="sr-only">{{ 'addon.blog.addnewentry' | translate }}</span>
</ion-fab-button>
</ion-fab>
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end">
<ion-fab-button (click)="createNewEntry()" [attr.aria-label]="'addon.blog.addnewentry' | translate">
<ion-icon name="fas-pen-to-square" aria-hidden="true" />
<span class="sr-only">{{ 'addon.blog.addnewentry' | translate }}</span>
</ion-fab-button>
</ion-fab>
}

</ion-content>
Loading