diff --git a/app/app.module.ts b/app/app.module.ts index 5357349..d90dec6 100644 --- a/app/app.module.ts +++ b/app/app.module.ts @@ -29,6 +29,7 @@ import { PageContentFormComponent } from "./pages/helpcontent/page-help-content- import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help-content.component"; import { CommunitiesComponent } from './pages/community/communities.component'; import { CommunityFormComponent } from './pages/community/community-form.component'; +import { CommunityEditFormComponent } from './pages/community/community-edit-form.component'; import { EntitiesComponent } from "./pages/helpcontent/entities.component"; import { EntityFormComponent } from "./pages/helpcontent/entity-form.component"; @@ -63,6 +64,7 @@ import { EntityFormComponent } from "./pages/helpcontent/entity-form.component"; EditPageHelpContentComponent, CommunitiesComponent, CommunityFormComponent, + CommunityEditFormComponent, EntitiesComponent, EntityFormComponent ], diff --git a/app/app.routing.ts b/app/app.routing.ts index 8b2846c..155e0c0 100644 --- a/app/app.routing.ts +++ b/app/app.routing.ts @@ -8,12 +8,14 @@ import { DashboardComponent } from "./dashboard.component"; import { TopicsComponent } from "./pages/faq/topics.components"; import { QuestionsComponent } from "./pages/faq/questions.component"; import { CommunitiesComponent } from './pages/community/communities.component'; +import { CommunityEditFormComponent } from "./pages/community/community-edit-form.component"; import { EntitiesComponent } from "./pages/helpcontent/entities.component"; import { PagesComponent } from "./pages/helpcontent/pages.component"; import { PageHelpContentsComponent } from "./pages/helpcontent/page-help-contents.component"; import { NewPageHelpContentComponent } from "./pages/helpcontent/new-page-help-content.component"; import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help-content.component"; + const appRoutes: Routes = [ { path: '', @@ -36,6 +38,10 @@ const appRoutes: Routes = [ path: 'communities', component: CommunitiesComponent, }, + { + path: 'community-edit-form', + component: CommunityEditFormComponent, + }, { path: 'entities', component: EntitiesComponent, diff --git a/app/pages/community/community-edit-form.component.html b/app/pages/community/community-edit-form.component.html new file mode 100644 index 0000000..75177b6 --- /dev/null +++ b/app/pages/community/community-edit-form.component.html @@ -0,0 +1,80 @@ +
+
Edit your community
+ +

Name:

+

Description:

+

Logo:

+ +
+
+ + +
+
+ +
+ + + +
+ + diff --git a/app/pages/community/community-edit-form.component.ts b/app/pages/community/community-edit-form.component.ts new file mode 100644 index 0000000..7355708 --- /dev/null +++ b/app/pages/community/community-edit-form.component.ts @@ -0,0 +1,41 @@ +import {Component, OnInit, Input} from '@angular/core'; +import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms"; +import { HelpContentService } from "../../services/help-content.service"; + +@Component({ + selector: 'community-edit-form', + templateUrl: './community-edit-form.component.html', +}) + +export class CommunityEditFormComponent implements OnInit{ + + @Input('group') + myForm: FormGroup; + + public errorMessage: string; + + constructor(public _fb: FormBuilder, private _helpContentService: HelpContentService){} + + ngOnInit(): void {} + + public get form() { + return this._fb.group({ + _id : '', + name : ['', Validators.required] + }); + } + + public reset() { + this.myForm.patchValue({ + name : '', + _id : '' + }); + } + + handleError(message: string, error) { + if(error == null) { + this.reset(); + } + this.errorMessage = message + ' (Server responded: ' + error + ')'; + } +}