Make some page alignments in all pages

This commit is contained in:
Konstantinos Triantafyllou 2022-06-30 18:23:14 +03:00
parent eef84e9fe5
commit cf95075ae4
7 changed files with 148 additions and 139 deletions

@ -1 +1 @@
Subproject commit 7ebf4f7f9054c2119d5e3d1eb07d3cb0d52a8aeb
Subproject commit 936c870abcb48b632f3a1433130e8701c813fa65

View File

@ -1,83 +1,100 @@
<div page-content>
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div header>
<community-info tab="organizations"></community-info>
<div class="uk-flex uk-flex-right@m uk-flex-center uk-margin-small-top">
<a *ngIf="!organizationsEnabled" (click)="enableAffiliations()" class="uk-flex uk-flex-middle uk-text-uppercase uk-margin-right">
<button class="large uk-icon-button uk-button-secondary">
<icon name="preview"></icon>
</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">
Enable Organizations Page
</button>
</a>
<a (click)="editAffiliationOpen()" class="uk-flex uk-flex-middle uk-text-uppercase">
<button class="large uk-icon-button uk-button-secondary">
<icon name="add"></icon>
</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">
Add New Organization
</button>
</a>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Organizations
</div>
<h1 class="uk-h4 uk-margin-remove">{{community.shortTitle}}</h1>
</div>
</div>
<community-info tab="organizations"></community-info>
</div>
<div inner>
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
<div class="uk-flex uk-flex-center uk-flex-right@m uk-margin-top">
<button *ngIf="!organizationsEnabled" class="uk-button uk-button-default uk-margin-right" [class.uk-disabled]="loading"
[disabled]="loading"
(click)="enableAffiliations()">Enable Organizations Page
</button>
<button class="uk-button uk-button-default uk-flex uk-flex-middle"
[disabled]="loading" [class.uk-disabled]="loading"
(click)="editAffiliationOpen()">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left">New Organization</span>
</button>
</div>
<div *ngIf="!loading && affiliations">
<div *ngIf="affiliations.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No organizations found</div>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="affiliations.length > 0">
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="affiliations.length"
[pageSize]="pageSize" [type]="'supporting organization' + (affiliations.length > 1?'s':'')">
</no-load-paging>
<div class="uk-margin-medium">
<div *ngFor="let affiliation of currentPage; let i=index"
class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-flex-middle" uk-grid>
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle" uk-grid>
<div class="uk-width-small">
<img [src]="affiliation.logo_url | urlPrefix">
<div *ngIf="!loading">
<div *ngIf="affiliations.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No organizations found</div>
</div>
<div *ngIf="affiliations.length > 0">
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="affiliations.length"
[pageSize]="pageSize" [type]="'supporting organization' + (affiliations.length > 1?'s':'')">
</no-load-paging>
<div class="uk-grid uk-grid-large uk-child-width-1-1 uk-child-width-1-2@m uk-margin-top uk-margin-bottom">
<div *ngFor="let affiliation of currentPage; let i=index">
<div class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-card-body">
<div class="uk-flex uk-flex-middle uk-flex-column">
<div class="uk-width-small uk-height-max-small">
<img [src]="affiliation.logo_url | urlPrefix">
</div>
<h5>{{affiliation.name}}</h5>
<div class="uk-text-truncate uk-text-small">
<span class="uk-text-meta uk-margin-xsmall-right">URL:</span>
<a [href]="affiliation.website_url | urlPrefix" class="uk-link"
target="_blank">{{affiliation.website_url}}</a>
</div>
</div>
</div>
<div class="uk-width-auto">
<h6>{{affiliation.name}}</h6>
URL: <a [href]="affiliation.website_url | urlPrefix" target="_blank">{{affiliation.website_url}}</a>
</div>
</div>
<div class="uk-width-auto@m uk-width-1-1">
<div class="uk-width-1-1 uk-flex uk-flex-center">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="editAffiliationOpen(getIndex(i))" class="uk-button action uk-flex uk-flex-middle">
<icon name="edit"></icon>
<span class="uk-margin-small-left">Edit Organization</span>
</a>
<a (click)="deleteAffiliationOpen(getIndex(i))" class="uk-button action uk-flex uk-flex-middle uk-margin-small-top">
<icon name="remove" ratio="0.9"></icon>
<span class="uk-margin-small-left">Delete Organization</span>
</a>
<div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="editAffiliationOpen(i)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="edit" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Edit</span>
</a>
</div>
</div>
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<button class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="deleteAffiliationOpen(i)">
<icon name="delete" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Delete</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="uk-margin-small-top">
<paging-no-load [currentPage]="page"
[totalResults]="affiliations.length" [size]="pageSize"
(pageChange)="updatePage($event)" customClasses="uk-flex-right@m uk-flex-center">
</paging-no-load>
</div>
</div>
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="affiliations.length"
[pageSize]="pageSize" [type]="'supporting organization' + (affiliations.length > 1?'s':'')">
</no-load-paging>
</div>
</div>
</div>
</div>
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid" (alertOutput)="editAffiliation()">
<form *ngIf="affiliationFb" [formGroup]="affiliationFb">
<div class="uk-grid uk-padding uk-padding-remove-horizontal uk-child-width-1-1" uk-grid>
<div dashboard-input label="Name" placeholder="Write organization's name" [formInput]="affiliationFb.get('name')"></div>
<div dashboard-input label="Logo URL" type="logoURL" placeholder="Write your organization's logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
<div dashboard-input label="Website URL" type="URL" placeholder="Write your organization's website URL" [formInput]="affiliationFb.get('website_url')"></div>
<div class="uk-grid uk-child-width-1-1" uk-grid>
<div input placeholder="Name" [formInput]="affiliationFb.get('name')"></div>
<div input type="logoURL" placeholder="Logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
<div input type="URL" placeholder="Website URL" [formInput]="affiliationFb.get('website_url')"></div>
</div>
</form>
</modal-alert>
<modal-alert #removeAffiliationModal (alertOutput)="removeAffiliation()">
<modal-alert #removeAffiliationModal [overflowBody]="false" (alertOutput)="removeAffiliation()">
</modal-alert>

View File

@ -13,8 +13,8 @@ import {Page} from "../../openaireLibrary/utils/entities/adminTool/page";
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {Subscription} from "rxjs";
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
declare var UIkit;
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
@Component({
selector: 'affiliations',
@ -26,11 +26,12 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
public index = 0;
public affiliations: Affiliation[];
public affiliationFb: FormGroup;
public communityId: string;
public community: CommunityInfo;
public organizationsPage: Page;
public page: number = 1;
public pageSize: number = 10;
private subs: any[] = [];
public stickyPageHeader: boolean = false;
@ViewChild('affiliationModal') affiliationModal: AlertModal;
@ViewChild('removeAffiliationModal') removeAffiliationModal: AlertModal;
@ -46,11 +47,13 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
ngOnInit() {
this.loading = true;
this.subs.push(this.route.params.subscribe(params => {
this.communityId = params['community'];
this.title.setTitle(this.communityId.toUpperCase() + ' | Organizations');
this.getAffiliations();
this.organizationsPageStatus();
this.subs.push(this.communityService.getCommunityAsObservable().subscribe( community => {
this.community = community;
if (this.community) {
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Organizations');
this.getAffiliations();
this.organizationsPageStatus();
}
}));
}
@ -64,14 +67,14 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
getAffiliations() {
this.loading = true;
this.affiliationService.initAffiliations(this.communityId);
this.affiliationService.initAffiliations(this.community.communityId);
this.affiliationService.affiliations.subscribe(
affiliations => {
this.affiliations = affiliations;
this.loading = false;
},
error => {
console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error);
console.error("Affiliations Component: Error getting affiliations for community with id: " + this.community.communityId, error);
this.loading = false;
}
);
@ -86,7 +89,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
this.index = index;
if (index === -1) {
affiliation = new Affiliation();
affiliation.communityId = this.communityId;
affiliation.communityId = this.community.communityId;
this.affiliationModal.alertTitle = 'Add Organization';
this.affiliationModal.okButtonText = 'Add';
} else {
@ -135,7 +138,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
editAffiliation() {
this.loading = true;
this.affiliationService.updateAffiliation(this.properties.communityAPI + this.communityId + '/organizations',
this.affiliationService.updateAffiliation(this.properties.communityAPI + this.community.communityId + '/organizations',
this.affiliationFb.value).subscribe((affiliation) => {
if (affiliation) {
if (this.index === -1) {
@ -158,7 +161,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
removeAffiliation() {
this.loading = true;
this.affiliationService.deleteAffiliation(this.properties.communityAPI + this.communityId + '/organizations',
this.affiliationService.deleteAffiliation(this.properties.communityAPI + this.community.communityId + '/organizations',
this.affiliations[this.index].id).subscribe((deleteOK) => {
this.affiliations.splice(this.index, 1);
if (this.currentPage.length === 0) {
@ -172,37 +175,25 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
}
private organizationsPageStatus() {
this.helpContentService.getCommunityPagesByRoute(this.communityId, '/organizations', this.properties.adminToolsAPIURL).subscribe((page) => {
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, '/organizations', this.properties.adminToolsAPIURL).subscribe((page) => {
this.organizationsPage = page;
})
}
handleUpdateError(message: string) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise(message, "danger");
this.loading = false;
}
handleUpdateSuccess(message) {
UIkit.notification(message, {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise(message);
this.loading = false;
}
enableAffiliations() {
this.helpContentService.togglePages(this.communityId, [this.organizationsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.helpContentService.togglePages(this.community.communityId, [this.organizationsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.organizationsPage.isEnabled = true;
UIkit.notification('Organizations Page has been <b>enabled successfully</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Organizations Page has been <b>enabled successfully</b>');
}, error => {
this.handleUpdateError('An error has been occurred. Try again later!');
});

View File

@ -19,11 +19,12 @@ import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-loa
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
import {HelpContentService} from "../../services/help-content.service";
import {PagingModule} from "../../openaireLibrary/utils/paging.module";
@NgModule({
imports: [
AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule,
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, CommunityInfoModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, CommunityInfoModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule
],
declarations: [
AffiliationsComponent

View File

@ -42,38 +42,40 @@ type Tab = 'all' | 'communities' | 'ris';
placeholder="Search Communities" searchInputClass="outer"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1 uk-flex uk-flex-right"></div>
</div>
<div *ngIf="loading" class="uk-margin-medium-top uk-padding-large">
<loading></loading>
</div>
<div *ngIf="!loading" uk-height-match="target: .titleContainer; row: false">
<div uk-height-match="target: .logoContainer; row: false">
<div *ngIf="tab != 'ris' && communities.length > 0" class="uk-section">
<h4>Research Communities</h4>
<div class="uk-grid uk-child-width-1-4@xl uk-child-width-1-3@l uk-child-width-1-2@m uk-grid-match" uk-grid>
<ng-template ngFor [ngForOf]="filteredCommunities" let-community let-i="index">
<ng-container *ngTemplateOutlet="communityBox; context: {community:community}"></ng-container>
</ng-template>
</div>
<div *ngIf="filteredCommunities.length == 0"
class="uk-card uk-card-default uk-card-no-height uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
No communities found
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!loading" uk-height-match="target: .titleContainer; row: false">
<div *ngIf="noResults" class="uk-section uk-padding-remove-top">
<div class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No communities to manage yet</div>
</div>
</div>
<div *ngIf="noResults" class="message">
<h4 class="uk-text-center">
No communities to manage yet
</h4>
</div>
<div *ngIf="tab != 'communities' && ris.length > 0" [class.uk-margin-large-top]="tab === 'all'" class="uk-section">
<h4>Research Initiatives</h4>
<div class="uk-grid uk-grid-match uk-child-width-1-4@xl uk-child-width-1-3@l uk-child-width-1-2@m" uk-grid>
<ng-template ngFor [ngForOf]="filteredRis" let-community let-i="index">
<ng-container *ngTemplateOutlet="communityBox; context: {community:community}"></ng-container>
</ng-template>
<div uk-height-match="target: .logoContainer; row: false">
<div *ngIf="tab != 'ris' && communities.length > 0" class="uk-section uk-padding-remove-top">
<h4>Research Communities</h4>
<div class="uk-grid uk-child-width-1-4@xl uk-child-width-1-3@l uk-child-width-1-2@m uk-grid-match" uk-grid>
<ng-template ngFor [ngForOf]="filteredCommunities" let-community let-i="index">
<ng-container *ngTemplateOutlet="communityBox; context: {community:community}"></ng-container>
</ng-template>
</div>
<div *ngIf="filteredCommunities.length == 0"
class="uk-card uk-card-default uk-card-no-height uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
No communities found
</div>
</div>
<div *ngIf="filteredRis.length == 0"
class="uk-card uk-card-default uk-card-no-height uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
No initiatives found
<div *ngIf="tab != 'communities' && ris.length > 0" [class.uk-padding-remove-top]="tab == 'ris'" class="uk-section">
<h4>Research Initiatives</h4>
<div class="uk-grid uk-grid-match uk-child-width-1-4@xl uk-child-width-1-3@l uk-child-width-1-2@m" uk-grid>
<ng-template ngFor [ngForOf]="filteredRis" let-community let-i="index">
<ng-container *ngTemplateOutlet="communityBox; context: {community:community}"></ng-container>
</ng-template>
</div>
<div *ngIf="filteredRis.length == 0"
class="uk-card uk-card-default uk-card-no-height uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
No initiatives found
</div>
</div>
</div>
</div>

View File

@ -23,10 +23,10 @@
</button>
</div>
</div>
<div class="uk-section uk-section uk-position-relative">
<div class="uk-section uk-position-relative" style="min-height: 60vh">
<div *ngIf="!showLoading">
<div class="uk-margin-bottom">
<div class="uk-margin uk-grid" >
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-expand" uk-tooltip="Get e-mail notification when there are changes in the managers list of your community">
Notify me for any changes in the managers list</div>
<mat-slide-toggle [checked]="userNotifications.notifyForNewManagers"
@ -34,7 +34,7 @@
{{userNotifications.notifyForNewManagers?' Enabled':'Disabled'}}
</mat-slide-toggle>
</div>
<div class="uk-margin uk-grid">
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-expand" uk-tooltip="Get e-mail notification when a user subscribes in your community">
Notify me for new members
</div>
@ -45,7 +45,7 @@
</div>
<hr class="uk-margin-medium">
<div *ngFor="let notification of notifications; let i=index">
<div class="uk-margin uk-grid">
<div class="uk-margin uk-grid" uk-grid>
<div class="uk-width-expand"
title="Get e-mail notification when users create new links related your community">
Notify me for any linking actions related to your community</div>

View File

@ -47,7 +47,10 @@ declare var UIkit;
</button>
</div>
</div>
<div class="uk-section uk-section-small">
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!loading" class="uk-container">
<form *ngIf="curatorFb" [formGroup]="curatorFb">
<div class="uk-grid uk-margin-large-bottom" uk-grid>
@ -86,17 +89,15 @@ declare var UIkit;
<div *ngFor="let affiliation of affiliations.controls; let i=index">
<div class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-card-body">
<div class="uk-grid uk-flex-middle" uk-grid>
<div class="uk-width-small">
<div class="uk-flex uk-flex-middle uk-flex-column">
<div class="uk-width-small uk-height-max-small">
<img [src]="affiliation.value.logo_url | urlPrefix">
</div>
<div class="uk-width-expand">
<h6>{{affiliation.value.name}}</h6>
<div class="uk-text-truncate">
<span class="uk-text-meta uk-margin-xsmall-right">URL:</span>
<a [href]="affiliation.value.website_url | urlPrefix" class="uk-link"
target="_blank">{{affiliation.value.website_url}}</a>
</div>
<h5>{{affiliation.value.name}}</h5>
<div class="uk-text-truncate uk-text-small">
<span class="uk-text-meta uk-margin-xsmall-right">URL:</span>
<a [href]="affiliation.value.website_url | urlPrefix" class="uk-link"
target="_blank">{{affiliation.value.website_url}}</a>
</div>
</div>
</div>
@ -116,7 +117,7 @@ declare var UIkit;
<button class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="deleteAffiliationOpen(i)">
<icon name="delete" [flex]="true"></icon>
<span class="uk-margin-xsmall-left"> Delete</span>
<span class="uk-margin-xsmall-left">Delete</span>
</button>
</div>
</div>
@ -133,9 +134,6 @@ declare var UIkit;
</div>
</form>
</div>
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
</div>
</div>
</div>