Add community-edit-form
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@50243 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8485b2b4dc
commit
612f5da8bf
|
@ -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
|
||||
],
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<div id="community-edit-form " class="uk-container">
|
||||
<div class="entity-title uk-article-title">Edit your community</div>
|
||||
|
||||
<div> <p> Name: <input placeholder="OpenAIRE" type="text" class="uk-input uk-width-medium"/> </p>
|
||||
<p> Description: <input placeholder="description" type="text" class="uk-input uk-width-medium"/> </p>
|
||||
<p> Logo: </p>
|
||||
|
||||
<div class="js-upload uk-placeholder uk-text-center uk-width-medium">
|
||||
<div uk-form-custom>
|
||||
<span uk-icon="icon: cloud-upload"></span>
|
||||
<input type="file">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<progress id="js-progressbar" class="uk-progress" value="0" max="100" hidden></progress>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var bar = document.getElementById('js-progressbar');
|
||||
|
||||
UIkit.upload('.js-upload', {
|
||||
|
||||
url: '',
|
||||
multiple: true,
|
||||
|
||||
beforeSend: function () {
|
||||
console.log('beforeSend', arguments);
|
||||
},
|
||||
beforeAll: function () {
|
||||
console.log('beforeAll', arguments);
|
||||
},
|
||||
load: function () {
|
||||
console.log('load', arguments);
|
||||
},
|
||||
error: function () {
|
||||
console.log('error', arguments);
|
||||
},
|
||||
complete: function () {
|
||||
console.log('complete', arguments);
|
||||
},
|
||||
|
||||
loadStart: function (e) {
|
||||
console.log('loadStart', arguments);
|
||||
|
||||
bar.removeAttribute('hidden');
|
||||
bar.max = e.total;
|
||||
bar.value = e.loaded;
|
||||
},
|
||||
|
||||
progress: function (e) {
|
||||
console.log('progress', arguments);
|
||||
|
||||
bar.max = e.total;
|
||||
bar.value = e.loaded;
|
||||
},
|
||||
|
||||
loadEnd: function (e) {
|
||||
console.log('loadEnd', arguments);
|
||||
|
||||
bar.max = e.total;
|
||||
bar.value = e.loaded;
|
||||
},
|
||||
|
||||
completeAll: function () {
|
||||
console.log('completeAll', arguments);
|
||||
|
||||
setTimeout(function () {
|
||||
bar.setAttribute('hidden', 'hidden');
|
||||
}, 1000);
|
||||
|
||||
alert('Upload Completed');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
|
@ -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 + ')';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue