Skip to content

Commit

Permalink
Merge branch 'Titohma-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomah committed Apr 15, 2023
2 parents 81c2003 + a519ce4 commit e8c659f
Show file tree
Hide file tree
Showing 37 changed files with 406 additions and 33 deletions.
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"cli": {
"schematicCollections": [
"@ionic/angular-toolkit"
]
],
"analytics": false
},
"schematics": {
"@ionic/angular-toolkit:component": {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "les-sagas-mp3",
"version": "0.10.1",
"version": "0.11.0",
"author": "Les Sagas MP3",
"homepage": "https://github.com/Les-Sagas-MP3",
"scripts": {
Expand Down
44 changes: 24 additions & 20 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ const routes: Routes = [
redirectTo: 'news',
pathMatch: 'full'
},
{
path: 'news',
loadChildren: () => import('./pages/news/list-news/list-news.module').then( m => m.ListNewsPageModule)
},
{
path: 'news/:id',
loadChildren: () => import('./pages/news/view-news/view-news.module').then( m => m.ViewNewsPageModule)
},
{
path: 'sagas',
loadChildren: () => import('./pages/sagas/list-sagas/list-sagas.module').then(m => m.ListSagasPageModule)
Expand All @@ -16,41 +24,37 @@ const routes: Routes = [
loadChildren: () => import('./pages/sagas/view-saga/view-saga.module').then(m => m.ViewSagaPageModule)
},
{
path: 'news',
loadChildren: () => import('./pages/news/list-news/list-news.module').then(m => m.ListNewsPageModule)
path: 'sagas/:id/edit',
loadChildren: () => import('./pages/sagas/edit-saga/edit-saga.module').then( m => m.EditSagaPageModule)
},
{
path: 'news/:id',
loadChildren: () => import('./pages/news/view-news/view-news.module').then(m => m.ViewNewsPageModule)
path: 'sagas/:sagaId/seasons/:seasonId',
loadChildren: () => import('./pages/episodes/list-episodes/list-episodes.module').then( m => m.ListEpisodesPageModule)
},
{
path: 'login',
loadChildren: () => import('./pages/login/login.module').then(m => m.LoginPageModule)
path: 'sagas/:sagaId/seasons/:seasonId/edit',
loadChildren: () => import('./pages/sagas/edit-season/edit-season.module').then( m => m.EditSeasonPageModule)
},
{
path: 'signup',
loadChildren: () => import('./pages/signup/signup.module').then(m => m.SignupPageModule)
path: 'sagas/:saga/episode/:episode',
loadChildren: () => import('./pages/episodes/play-episode/play-episode.module').then( m => m.PlayEpisodePageModule)
},
{
path: 'sync',
loadChildren: () => import('./pages/admin/sync/sync.module').then(m => m.SyncPageModule)
path: 'sagas/:saga/episode/:episode/edit',
loadChildren: () => import('./pages/episodes/edit-episode/edit-episode.module').then( m => m.EditEpisodePageModule)
},
{
path: 'sagas/:sagaId/seasons/:seasonId',
loadChildren: () => import('./pages/sagas/episodes/list-episodes/list-episodes.module').then(m => m.ListEpisodesPageModule)
path: 'login',
loadChildren: () => import('./pages/login/login.module').then(m => m.LoginPageModule)
},
{
path: 'sagas/:sagaId/seasons/:seasonId/edit',
loadChildren: () => import('./pages/sagas/edit-season/edit-season.module').then(m => m.EditSeasonPageModule)
path: 'signup',
loadChildren: () => import('./pages/signup/signup.module').then(m => m.SignupPageModule)
},
{
path: 'sagas/:saga/episode/:episode',
loadChildren: () => import('./pages/sagas/episodes/play-episode/play-episode.module').then(m => m.PlayEpisodePageModule)
path: 'sync',
loadChildren: () => import('./pages/admin/sync/sync.module').then(m => m.SyncPageModule)
},
{
path: 'sagas/:saga/episode/:episode/edit',
loadChildren: () => import('./pages/sagas/episodes/edit-episode/edit-episode.module').then(m => m.EditEpisodePageModule)
}

];

Expand Down
2 changes: 1 addition & 1 deletion src/app/entities/saga.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SagaModel } from '../models/saga.model';
import { SagaModel } from '../models/saga/saga.model';
import { Author } from './author';
import { Category } from './category';
import { Season } from './season';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuditModel } from './audit.model';
import { AuditModel } from '../audit.model';

export class SagaModel extends AuditModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class EditEpisodePage implements OnInit {
this.episodeService.update(episode)
.subscribe(data => {
console.debug(data);
this.navCtrl.navigateForward("sagas/" + this.saga.id)
loading.dismiss();
}, error => {
console.error(error);
Expand All @@ -118,6 +119,7 @@ export class EditEpisodePage implements OnInit {
this.episodeService.update(episode)
.subscribe(data => {
console.debug(data);
this.navCtrl.navigateForward("sagas/" + this.saga.id)
loading.dismiss();
}, error => {
console.error(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@
<ion-icon name="play-outline"></ion-icon> {{ episode.displayedNumber }} - {{ episode.title }}
</ion-label>
</ion-item>
<ion-item button="true" (click)="addEpisode()" *ngIf="authService.currentTokenValue">
<ion-label>
< Ajouter un épisode >
</ion-label>
</ion-item>
</ion-list>
</ion-content>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ActionSheetController, LoadingController } from '@ionic/angular';
import { Episode } from 'src/app/entities/episode';
import { Saga } from 'src/app/entities/saga';
import { Season } from 'src/app/entities/season';
import { EpisodeModel } from 'src/app/models/episode.model';
import { AuthService } from 'src/app/services/auth/auth.service';
import { ConfigService } from 'src/app/services/config/config.service';
import { EpisodesService } from 'src/app/services/episodes/episodes.service';
Expand Down Expand Up @@ -45,12 +46,24 @@ export class ListEpisodesPage implements OnInit {
this.season = Season.fromModel(data);
this.episodeService.getAllByIds(this.season.episodesRef)
.subscribe(data => {
this.season.episodes = Episode.fromModels(data);
this.season.episodes = Episode.fromModels(data).sort((first, second) => 0 - (first.number > second.number ? -1 : 1));
loading.dismiss();
})
});
});
});
}

addEpisode() {
var episode = new EpisodeModel();
if(this.season.episodes.length > 0) {
episode.number = this.season.episodes[this.season.episodes.length - 1].number + 1;
}
episode.seasonRef = this.season.id;
this.episodeService.create(episode)
.subscribe(data => {
this.ngOnInit();
});
}

}
17 changes: 17 additions & 0 deletions src/app/pages/sagas/edit-saga/edit-saga-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { EditSagaPage } from './edit-saga.page';

const routes: Routes = [
{
path: '',
component: EditSagaPage
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class EditSagaPageRoutingModule {}
21 changes: 21 additions & 0 deletions src/app/pages/sagas/edit-saga/edit-saga.module.ts
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 { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { IonicModule } from '@ionic/angular';

import { EditSagaPageRoutingModule } from './edit-saga-routing.module';

import { EditSagaPage } from './edit-saga.page';

@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
IonicModule,
EditSagaPageRoutingModule
],
declarations: [EditSagaPage]
})
export class EditSagaPageModule {}
64 changes: 64 additions & 0 deletions src/app/pages/sagas/edit-saga/edit-saga.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-buttons slot="primary">
<ion-button routerDirection="backward" *ngIf="authService.currentTokenValue" type="submit" (click)="save()">
<ion-icon name="save"></ion-icon>
</ion-button>
</ion-buttons>
<ion-title>{{ saga.title }}</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<form [formGroup]="sagaForm" novalidate>
<ion-list lines="full" class="ion-no-margin">
<ion-list-header lines="full">
<ion-label>Informations</ion-label>
</ion-list-header>
<ion-item>
<ion-label position="floating">Titre</ion-label>
<ion-input type="string" value="{{ saga.title }}" formControlName="title"></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">URL</ion-label>
<ion-input value="{{ saga.url }}" formControlName="url"></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">URL Wiki</ion-label>
<ion-input value="{{ saga.urlWiki }}" formControlName="urlWiki"></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">Etat</ion-label>
<ion-input value="{{ saga.status }}" formControlName="status"></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">Synopsis</ion-label>
<ion-textarea value="{{ saga.synopsis }}" formControlName="synopsis"></ion-textarea>
</ion-item>
<ion-item>
<ion-label position="floating">Origine</ion-label>
<ion-textarea value="{{ saga.origin }}" formControlName="origin"></ion-textarea>
</ion-item>
<ion-item>
<ion-label position="floating">Génèse</ion-label>
<ion-textarea value="{{ saga.genese }}" formControlName="genese"></ion-textarea>
</ion-item>
<ion-item>
<ion-label position="floating">Récompenses</ion-label>
<ion-textarea value="{{ saga.awards }}" formControlName="awards"></ion-textarea>
</ion-item>
<ion-item>
<ion-label position="floating">Bannière</ion-label>
<ion-input class="fileUpload" type="file" formControlName="banner" (change)="onBannerChange($event)">{{ bannerSource }}</ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">Pochette</ion-label>
<ion-input class="fileUpload" type="file" formControlName="cover" (change)="onCoverChange($event)">{{ coverSource }}</ion-input>
</ion-item>
</ion-list>
</form>
</ion-content>
Empty file.
24 changes: 24 additions & 0 deletions src/app/pages/sagas/edit-saga/edit-saga.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { EditSagaPage } from './edit-saga.page';

describe('EditSagaPage', () => {
let component: EditSagaPage;
let fixture: ComponentFixture<EditSagaPage>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ EditSagaPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();

fixture = TestBed.createComponent(EditSagaPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit e8c659f

Please sign in to comment.