Skip to content

Commit

Permalink
primeng: admin templates
Browse files Browse the repository at this point in the history
Co-Authored-by: Johnny Mariéthoz <[email protected]>
Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
jma and Garfield-fr committed Jan 9, 2025
1 parent 957c08d commit 6e46b53
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import { Component, Input } from '@angular/core';
@Component({
selector: 'admin-templates-brief-view',
template: `
<h5 class="mb-0 card-title">
<h5>
<a [routerLink]="[detailUrl.link]">{{ record.metadata.name }} </a>
@if (record.metadata.visibility === 'private') {
<small>
<i class="fa fa-lock text-secondary" aria-hidden="true"></i>
<i class="fa fa-lock text-color-secondary" aria-hidden="true"></i>
</small>
}
</h5>
<div class="card-text">
<ul class="list-inline mb-0">
<ul class="list-none m-0 p-0">
@if (record.metadata.description) {
<li>
{{ record.metadata.description | truncateText: 8 }}
Expand All @@ -45,7 +44,6 @@ import { Component, Input } from '@angular/core';
</li>
}
</ul>
</div>
`
})
export class TemplatesBriefViewComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,29 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
@if (record) {
<h2 id="template-name" class="pl-0">
<h2 id="template-name">
{{ record.metadata.name }}
@if (record.metadata.visibility && record.metadata.visibility === 'private') {
<i class="fa fa-lock text-secondary ml-2" aria-hidden="true"></i>
}
</h2>
<dl class="grid mt-2 mb-0">
<dl class="metadata">
<!-- DESCRIPTION -->
@if (record.metadata.description) {
<dt [ngClass]="dtCssClass">
<span class="label-title" translate>
Description
</span>
</dt>
<dd id="template-description" [ngClass]="ddCssClass" [innerHTML]="record.metadata.description | nl2br"></dd>
<dt translate>Description</dt>
<dd id="template-description" [innerHTML]="record.metadata.description | nl2br"></dd>
}
<!-- CREATOR -->
@if (record.metadata.creator.pid | getRecord: 'patrons' | async; as creator) {
<dt [ngClass]="dtCssClass">
<span class="label-title" translate>
Creator
</span>
</dt>
<dd id="template-creator" [ngClass]="ddCssClass">
<dt translate>Creator</dt>
<dd>
{{ $any(creator).metadata.first_name }} {{ $any(creator).metadata.last_name }}
</dd>
}
<!-- TYPE -->
@if (record.metadata.template_type) {
<dt [ngClass]="dtCssClass">
<span class="label-title" translate>
Type
</span>
</dt>
<dd id="template-type" [ngClass]="ddCssClass">
<dt translate>Type</dt>
<dd id="template-type">
{{ record.metadata.template_type }}
</dd>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ export class TemplateDetailViewComponent implements OnInit, OnDestroy {
/** Document record */
record: any;

/** Css classes for dd in template */
ddCssClass = 'col-9 mb-0';

/** Css classes for dt in template */
dtCssClass = 'col-3';

/** Record subscription */
private recordSubscription: Subscription;

Expand Down
4 changes: 3 additions & 1 deletion projects/admin/src/app/routes/templates-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class TemplatesRoute extends BaseRoute implements RouteInterface {
redirectUrl: (record: any) => {
return this.redirectUrl(
record.metadata,
'/records/templates/detail/'
'/records/templates/detail'
);
},
aggregationsOrder: [
Expand All @@ -77,11 +77,13 @@ export class TemplatesRoute extends BaseRoute implements RouteInterface {
{
label: _('Relevance'),
value: 'bestmatch',
icon: 'fa fa-sort-amount-desc',
defaultQuery: true
},
{
label: _('Name'),
value: 'name',
icon: 'fa fa-sort-alpha-asc',
defaultNoQuery: true
}
],
Expand Down

0 comments on commit 6e46b53

Please sign in to comment.