diff --git a/app/app.module.ts b/app/app.module.ts index 5919ec5..3dda26f 100644 --- a/app/app.module.ts +++ b/app/app.module.ts @@ -29,7 +29,6 @@ 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/community-edit-form.component'; import { EntitiesComponent } from "./pages/entity/entities.component"; import { EntityFormComponent } from "./pages/entity/entity-form.component"; import { DivIdsComponent } from "./pages/divId/divIds.component"; @@ -46,12 +45,14 @@ import {Meta} from './openaireLibrary/sharedComponents/metaService'; import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module'; import {FeedbackModule} from './openaireLibrary/sharedComponents/feedback/feedback.module'; +import {CommunityEditFormModule} from './pages/community/community-edit-form/community-edit-form.module'; + import {FreeGuard} from './openaireLibrary/login/freeGuard.guard'; import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard'; import { ConnectAdminLoginGuard} from './openaireLibrary/login/connectAdminLoginGuard.guard'; import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver'; import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; -import{ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.module'; +import {ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.module'; import {StatsComponent} from "./pages/stats/stats.component"; //, , ErrorModule CookieLawModule @NgModule({ @@ -67,7 +68,8 @@ import {StatsComponent} from "./pages/stats/stats.component"; ReactiveFormsModule, // JWBootstrapSwitchModule, CKEditorModule, - BottomModule, FeedbackModule, NavigationBarModule, CookieLawModule, ClaimsAdminModule + BottomModule, FeedbackModule, NavigationBarModule, CookieLawModule, ClaimsAdminModule, + CommunityEditFormModule, // , CookieLawModule, ErrorModule ], declarations: [ @@ -87,7 +89,6 @@ import {StatsComponent} from "./pages/stats/stats.component"; EditPageHelpContentComponent, CommunitiesComponent, CommunityFormComponent, - CommunityEditFormComponent, EntitiesComponent, EntityFormComponent, DivIdsComponent, diff --git a/app/pages/community/community-edit-form/community-edit-form.component.html b/app/pages/community/community-edit-form/community-edit-form.component.html index eb30463..ee5dd30 100644 --- a/app/pages/community/community-edit-form/community-edit-form.component.html +++ b/app/pages/community/community-edit-form/community-edit-form.component.html @@ -1,14 +1,12 @@
-
Edit your community
- -
- +
Edit your community
+
+

Name:

Short Name:

Description:

Logo Url:

- -
- - +
+ +
diff --git a/app/pages/community/community-edit-form/community-edit-form.component.ts b/app/pages/community/community-edit-form/community-edit-form.component.ts index da0b5dd..f34221e 100644 --- a/app/pages/community/community-edit-form/community-edit-form.component.ts +++ b/app/pages/community/community-edit-form/community-edit-form.component.ts @@ -1,6 +1,10 @@ -import {Component, OnInit, Input} from '@angular/core'; -import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms"; -import { HelpContentService } from "../../../services/help-content.service"; +import {Component, OnInit, Input} from '@angular/core'; +import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms"; +import {ActivatedRoute, Router} from '@angular/router'; + +import {HelpContentService} from "../../../services/help-content.service"; +import {CommunityService} from "../../../openaireLibrary/connect/community/community.service"; +import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; @Component({ selector: 'community-edit-form', @@ -16,11 +20,35 @@ export class CommunityEditFormComponent implements OnInit{ public res=[]; - constructor(public _fb: FormBuilder, private _helpContentService: HelpContentService){} + params: any; + + public communityId = null; + public community = null; + public properties:EnvProperties = null; + + constructor (private route: ActivatedRoute, + private _router: Router, + public _fb: FormBuilder, + private _helpContentService: HelpContentService, + private _communityService: CommunityService){ } - ngOnInit(){ - + ngOnInit() { + this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.route.queryParams.subscribe( + communityId => { + this.communityId = communityId['communityId']; + if (this.communityId != null) { + this._communityService.getCommunity(this.properties.communityAPI+this.communityId).subscribe ( + community => { + this.community = community; + this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; + console.log(community); + }); + } + }); + }); } public get form() { diff --git a/assets/env-properties.json b/assets/env-properties.json index 125acf2..b148f70 100644 --- a/assets/env-properties.json +++ b/assets/env-properties.json @@ -57,7 +57,7 @@ "adminToolsAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-admin-tools/", "adminToolsCommunity" :"openaire", - + "communityAPI": "https://dev-openaire.d4science.org/openaire/community/", "csvLimit": 2000, "pagingLimit": 20, "resultsPerPage": 10,