Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
4,837 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { EditBitstreamPageComponent } from './edit-bitstream-page/edit-bitstream-page.component'; | ||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; | ||
import { BitstreamPageResolver } from './bitstream-page.resolver'; | ||
|
||
const EDIT_BITSTREAM_PATH = ':id/edit'; | ||
|
||
/** | ||
* Routing module to help navigate Bitstream pages | ||
*/ | ||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild([ | ||
{ | ||
path: EDIT_BITSTREAM_PATH, | ||
component: EditBitstreamPageComponent, | ||
resolve: { | ||
bitstream: BitstreamPageResolver | ||
}, | ||
canActivate: [AuthenticatedGuard] | ||
} | ||
]) | ||
], | ||
providers: [ | ||
BitstreamPageResolver, | ||
] | ||
}) | ||
export class BitstreamPageRoutingModule { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { SharedModule } from '../shared/shared.module'; | ||
import { EditBitstreamPageComponent } from './edit-bitstream-page/edit-bitstream-page.component'; | ||
import { BitstreamPageRoutingModule } from './bitstream-page-routing.module'; | ||
|
||
/** | ||
* This module handles all components that are necessary for Bitstream related pages | ||
*/ | ||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
SharedModule, | ||
BitstreamPageRoutingModule | ||
], | ||
declarations: [ | ||
EditBitstreamPageComponent | ||
] | ||
}) | ||
export class BitstreamPageModule { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router'; | ||
import { RemoteData } from '../core/data/remote-data'; | ||
import { Observable } from 'rxjs/internal/Observable'; | ||
import { find } from 'rxjs/operators'; | ||
import { hasValue } from '../shared/empty.util'; | ||
import { Bitstream } from '../core/shared/bitstream.model'; | ||
import { BitstreamDataService } from '../core/data/bitstream-data.service'; | ||
|
||
/** | ||
* This class represents a resolver that requests a specific bitstream before the route is activated | ||
*/ | ||
@Injectable() | ||
export class BitstreamPageResolver implements Resolve<RemoteData<Bitstream>> { | ||
constructor(private bitstreamService: BitstreamDataService) { | ||
} | ||
|
||
/** | ||
* Method for resolving a bitstream based on the parameters in the current route | ||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot | ||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot | ||
* @returns Observable<<RemoteData<Item>> Emits the found bitstream based on the parameters in the current route, | ||
* or an error if something went wrong | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Bitstream>> { | ||
return this.bitstreamService.findById(route.params.id) | ||
.pipe( | ||
find((RD) => hasValue(RD.error) || RD.hasSucceeded), | ||
); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<ng-container *ngVar="(bitstreamRD$ | async) as bitstreamRD"> | ||
<div class="container" *ngVar="(bitstreamFormatsRD$ | async) as formatsRD"> | ||
<div class="row" *ngIf="bitstreamRD?.hasSucceeded && formatsRD?.hasSucceeded"> | ||
<div class="col-md-2"> | ||
<ds-thumbnail [thumbnail]="bitstreamRD?.payload"></ds-thumbnail> | ||
</div> | ||
<div class="col-md-10"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<h3>{{bitstreamRD?.payload?.name}} <span class="text-muted">({{bitstreamRD?.payload?.sizeBytes | dsFileSize}})</span></h3> | ||
</div> | ||
</div> | ||
</div> | ||
<ds-form [formId]="'edit-bitstream-form-id'" | ||
[formGroup]="formGroup" | ||
[formModel]="formModel" | ||
[formLayout]="formLayout" | ||
[submitLabel]="'form.save'" | ||
(submitForm)="onSubmit()" | ||
(cancel)="onCancel()" | ||
(dfChange)="onChange($event)"></ds-form> | ||
</div> | ||
</div> | ||
<ds-error *ngIf="bitstreamRD?.hasFailed" message="{{'error.bitstream' | translate}}"></ds-error> | ||
<ds-loading *ngIf="!bitstreamRD || !formatsRD || bitstreamRD?.isLoading || formatsRD?.isLoading" | ||
message="{{'loading.bitstream' | translate}}"></ds-loading> | ||
</div> | ||
</ng-container> |
8 changes: 8 additions & 0 deletions
8
src/app/+bitstream-page/edit-bitstream-page/edit-bitstream-page.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
:host { | ||
::ng-deep { | ||
.switch { | ||
position: absolute; | ||
top: $spacer*2.5; | ||
} | ||
} | ||
} |
Oops, something went wrong.