Skip to content

Commit

Permalink
Merge pull request #584 from CruGlobal/metatoolDefaultVariant
Browse files Browse the repository at this point in the history
GT-1660 track the default variant as a relationship
  • Loading branch information
frett authored Jun 30, 2022
2 parents d914b86 + 55a9a20 commit 39b7a48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/app/components/edit-resource/edit-resource.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@
<label>Default Variant</label>
<select
class="custom-select"
[(ngModel)]="resource['attr-default-variant']"
[(ngModel)]="resource['default-variant']"
[compareWith]="compareTools"
>
<option
*ngFor="let variant of resource.variants"
[ngValue]="variant.abbreviation"
>
<option *ngFor="let variant of resource.variants" [ngValue]="variant">
{{ variant.name }}
</option>
</select>
Expand Down
2 changes: 1 addition & 1 deletion src/app/models/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class Resource {
showTranslations: boolean;
metatool?: Resource;
variants: Resource[];
'default-variant'?: Resource;
translations: Translation[];
attachments: Attachment[];
pages: Page[];
Expand All @@ -35,7 +36,6 @@ export class Resource {
| 'gospel'
| 'growth'
| 'training';
'attr-default-variant'?: string;
'attr-default-order'?: number;
'attr-hidden'?: boolean;
'attr-spotlight'?: boolean;
Expand Down
4 changes: 3 additions & 1 deletion src/app/service/resource/resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export class ResourceService extends AbstractService {
system_id: Resource.getSystemId(resource),
resource_type_id: Resource.getResourceTypeId(resource),
metatool_id: (resource.metatool && resource.metatool.id) || null,
default_variant_id:
(resource['default-variant'] && resource['default-variant'].id) ||
null,
onesky_project_id: resource.oneskyProjectId,
description: resource.description,
manifest: resource.manifest,
Expand All @@ -83,7 +86,6 @@ export class ResourceService extends AbstractService {
'attr-about-overview-video-youtube':
resource.aboutOverviewVideoYoutube || null,
'attr-category': resource['attr-category'] || null,
'attr-default-variant': resource['attr-default-variant'] || null,
'attr-default-order': resource['attr-default-order'] || null,
'attr-hidden': resource['attr-hidden'] || null,
'attr-spotlight': resource['attr-spotlight'] || null,
Expand Down

0 comments on commit 39b7a48

Please sign in to comment.