Project

General

Profile

« Previous | Next » 

Revision 60569

[Admin | New-UI]: Add new types on logo url and simple urls inputs

View differences:

modules/uoa-admin-portal/branches/new-UI/src/app/pages/dashboard/dashboard.component.ts
1
/**
2
 * Created by stefania on 3/21/16.
3
 */
4

  
5
import {Component, ElementRef, OnInit} from '@angular/core';
6
import {ActivatedRoute} from '@angular/router';
7
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
8
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
9
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
10
import {Title} from '@angular/platform-browser';
11
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
12

  
13
@Component({
14
    selector: 'dashboard',
15
    templateUrl: 'dashboard.component.html',
16
})
17
export class DashboardComponent implements OnInit {
18
  communityId: string = null;
19
  communityType = null;
20
  properties: EnvProperties;
21

  
22
  constructor( private element: ElementRef,
23
               private  route: ActivatedRoute,
24
               private title: Title,
25
               private _communityService: CommunityService) {}
26

  
27
  ngOnInit() {
28
    this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
29
        this.title.setTitle('Administration Dashboard | Overview');
30
        this.properties = data.envSpecific;
31
        this.route.queryParams.subscribe(data => {
32
          HelperFunctions.scroll();
33
          this.communityId = ((data['communityId']) ? data['communityId'] : data['community']);
34
          ConnectHelper.setPortalTypeFromPid(this.communityId);
35

  
36
          this._communityService.getCommunity(this.communityId).subscribe (
37
            community => {
38
                this.communityType = community.type;
39
            },
40
            error => {
41
              console.error('Server responded: ' + error);
42
            }
43
          );
44
        });
45
    });
46

  
47
  }
48
}
modules/uoa-admin-portal/branches/new-UI/src/app/pages/dashboard/dashboard.module.ts
1
import { NgModule } from '@angular/core';
2
import {DashboardRoutingModule} from './dashboard-routing.module';
3
import {RouterModule} from '@angular/router';
4
import {DashboardComponent} from './dashboard.component';
5
import {CommonModule} from '@angular/common';
6
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
7
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
8

  
9
@NgModule({
10
  imports: [
11
    CommonModule, DashboardRoutingModule, RouterModule
12
  ],
13
  declarations: [DashboardComponent],
14
  providers: [IsCommunity, ConnectAdminLoginGuard],
15
  exports: [DashboardComponent]
16
})
17
export class DashboardModule { }
modules/uoa-admin-portal/branches/new-UI/src/app/pages/dashboard/dashboard-routing.module.ts
1
import { NgModule } from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {DashboardComponent} from './dashboard.component';
4
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
5
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
6

  
7
@NgModule({
8
  imports: [
9
    RouterModule.forChild([
10
      { path: '', canActivate: [IsCommunity, ConnectAdminLoginGuard], component: DashboardComponent}
11
    ])
12
  ]
13
})
14
export class DashboardRoutingModule { }
modules/uoa-admin-portal/branches/new-UI/src/app/pages/dashboard/dashboard.component.html
1
<div id="dashboard" class="uk-margin-large-bottom">
2
    <div id="content">
3

  
4
        <div class="content-wrapper">
5
            <div class="uk-child-width-1-3@m uk-grid-small uk-grid-margin uk-margin-top" uk-grid="" uk-height-match=".target">
6
                  <div *ngIf="communityId != 'openaire' && this.communityId !== 'connect'" class="uk-card uk-card-default uk-card-body uk-card-hover">
7
                    <h4 class="uk-card-title">
8
                        <span class="uk-margin-small-right uk-icon" uk-icon="album"></span>
9
                        Profile
10
                    </h4>
11
                    <div class="target uk-margin">
12
                      Edit community information, change logo url, add community managers or organizations related to
13
                      community <span *ngIf="properties.environment == 'development'"> and customize css layout</span>.
14
                    </div>
15
                    <div>
16
                      <a routerLink="/community-edit-form"  [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Community Profile</a><br>
17
                      <a routerLink="/organizations"  [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Organizations</a><br>
18
                      <!--<a routerLink="/customize-layout"
19
                         [queryParams]="{communityId: this.communityId}"
20
                          class="uk-button uk-button-text">Customize Layout</a>-->
21
                    </div>
22
                  </div>
23
                  <div *ngIf="communityId != 'openaire' && this.communityId !== 'connect'" class="uk-card uk-card-default uk-card-body uk-card-hover">
24
                      <h4 class="uk-card-title">
25
                        <span class="uk-margin-small-right uk-icon" uk-icon="list"></span>
26
                        Content
27
                      </h4>
28
                      <div class="target uk-margin">
29
                        Manage projects, content providers{{(communityType && communityType != 'ri')?', subjects':''}} and zenodo communities that are related to the research community.
30
                      </div>
31
                      <div>
32
                        <a routerLink="/manage-projects" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Projects</a> <br>
33
                        <a routerLink="/manage-content-providers" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Content providers</a> <br>
34
                        <a routerLink="/manage-zenodo-communities" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Zenodo communities</a> <br>
35
                        <a *ngIf="communityType && communityType != 'ri'" routerLink="/manage-subjects" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Subjects</a> <br>
36
                      </div>
37
                    </div>
38
                  <div *ngIf="communityId != 'openaire' && this.communityId !== 'connect'" class="uk-card uk-card-default uk-card-body uk-card-hover">
39
                    <h4 class="uk-card-title">
40
                      <span class="uk-margin-small-right uk-icon" uk-icon="image"></span>
41
                      Statistics &amp; Charts
42
                    </h4>
43
                    <div class="target uk-margin">
44
                      Manage statistical numbers & charts that will be displayed in the community overview and graph analysis views.
45
                    </div>
46
                    <div>
47
                      <a routerLink="/stats"  [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Statistics &amp; charts</a>
48
                    </div>
49
                  </div>
50
                <div *ngIf="communityId != 'openaire' && this.communityId !== 'connect'" class="uk-card uk-card-default uk-card-body uk-card-hover">
51
                  <h4 class="uk-card-title">
52
                      <span class="uk-margin-small-right uk-icon" uk-icon="link"></span>
53
                      Links
54
                  </h4>
55
                  <div class="target uk-margin">
56
                      Manage user claims related to the research community.
57
                  </div>
58
                  <div>
59
                    <a routerLink="/claims"  [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Links</a>
60
                  </div>
61
                </div>
62
                <div class="uk-card uk-card-default uk-card-body uk-card-hover">
63
                  <h4 class="uk-card-title">
64
                    <span class="uk-margin-small-right uk-icon" uk-icon="file-edit"></span>
65
                    Help texts
66
                  </h4>
67
                  <div class="target uk-margin">
68
                     Add or edit help text in research community pages.
69
                  </div>
70
                  <div>
71
                    <a routerLink="/pageContents" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Help texts in pages</a><br>
72
                    <a *ngIf="communityId === 'openaire' || communityId === 'connect'"
73
                       routerLink="/classContents" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Help texts in classes</a>
74
                  </div>
75
                  </div>
76
                <div   *ngIf="communityType && communityType == 'ri' && communityId!='openaire' && this.communityId !== 'connect'"  class="uk-card uk-card-default uk-card-body uk-card-hover">
77
                  <h4 class="uk-card-title">
78
                      <span class="uk-margin-small-right uk-icon" uk-icon="settings"></span>
79
                      Text mining rules
80
                  </h4>
81
                  <div class="target uk-margin">
82
                     Manage text mining rules, test the rules and see the results, save and load mining profiles.
83
                  </div>
84
                  <div>
85
                    <a routerLink="/mining/manage-profiles"  [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">Text mining rules</a>
86
                  </div>
87
                </div>
88
                <div   *ngIf="communityId!='openaire' && this.communityId !== 'connect'"  class="uk-card uk-card-default uk-card-body uk-card-hover">
89
                  <h4 class="uk-card-title">
90
                    <span class="uk-margin-small-right uk-icon" uk-icon="user"></span>
91
                    Users
92
                  </h4>
93
                  <div class="target uk-margin">
94
                    Invite more users to subscribe, manage community subscribers, your personal info and notification settings.
95
                  </div>
96
                  <div>
97
                     <a [href]="'https://beta.'+this.communityId+'.openaire.eu/invite'" target="_blank" class="uk-button uk-button-text">
98
                       <span>Invite to subscribe </span>
99
                     </a>
100
                     <br>
101
                     <a routerLink="/manage-subscribers" routerLinkActive="active" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">
102
                         <span>Subscribers</span>
103
                     </a>
104
                     <br>
105
                     <a routerLink="/personal" routerLinkActive="active" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">
106
                       <span>Personal Info </span>
107
                     </a>
108
                     <br>
109
                     <a routerLink="/manage-user-notifications" routerLinkActive="active" [queryParams]="{communityId: this.communityId}" class="uk-button uk-button-text">
110
                         <span>Notification settings </span>
111
                     </a>
112
                  </div>
113
                </div>
114
            </div>
115
        </div>
116
    </div>
117
</div>
modules/uoa-admin-portal/branches/new-UI/src/app/pages/users/personal-info/personal-info.component.ts
14 14
import {HelpContentService} from "../../../services/help-content.service";
15 15
import {Page} from "../../../domain/page";
16 16
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
17
import {StringUtils} from "../../../openaireLibrary/utils/string-utils.class";
17 18

  
18 19
declare var UIkit;
19 20

  
......
95 96
                      <div class="uk-grid uk-grid-divider uk-flex-middle" uk-grid>
96 97
                        <div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle" uk-grid>
97 98
                          <div class="uk-width-small">
98
                            <img [src]="affiliation.value.logo_url">
99
                            <img [src]="urlPrefix(affiliation.value.logo_url) + affiliation.value.logo_url">
99 100
                          </div>
100 101
                          <div class="uk-width-auto">
101 102
                            <h6>{{affiliation.value.name}}</h6>
102
                            URL: <a [href]="affiliation.value.website_url">{{affiliation.value.website_url}}</a>
103
                            URL: <a [href]="urlPrefix(affiliation.value.website_url) + affiliation.value.website_url" target="_blank">{{affiliation.value.website_url}}</a>
103 104
                          </div>
104 105
                        </div>
105 106
                        <div class="uk-width-auto@m uk-width-1-1">
......
121 122
                  </div>
122 123
                </div>
123 124
                <div class="uk-width-1-1 uk-text-small">
124
                  Your personal info will be visible in the Curators' page of your Community Gateway.
125
                  Your personal info will be visible in the Curators page of your Community Gateway.
125 126
                  Read <a (click)="privacy()">privacy policy statement</a>.
126 127
                </div>
127 128
              </div>
......
148 149
      <form *ngIf="affiliationFb" [formGroup]="affiliationFb">
149 150
        <div class="uk-grid uk-padding uk-padding-remove-horizontal uk-child-width-1-1" uk-grid>
150 151
          <div dashboard-input label="Name" placeholder="Write affiliation's name" [formInput]="affiliationFb.get('name')"></div>
151
          <div dashboard-input label="Logo URL" placeholder="Write your affiliation's logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
152
          <div dashboard-input label="Website URL" placeholder="Write your affiliation's website URL" [formInput]="affiliationFb.get('website_url')"></div>
152
          <div dashboard-input label="Logo URL" type="logoURL" placeholder="Write your affiliation's logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
153
          <div dashboard-input label="Website URL" type="URL" placeholder="Write your affiliation's website URL" [formInput]="affiliationFb.get('website_url')"></div>
153 154
        </div>
154 155
      </form>
155 156
    </modal-alert>
......
268 269
      affiliations.push(this.fb.group({
269 270
        id: this.fb.control(affiliation.id),
270 271
        name: this.fb.control(affiliation.name, Validators.required),
271
        logo_url: this.fb.control(affiliation.logo_url, Validators.required),
272
        website_url: this.fb.control(affiliation.website_url, Validators.required),
272
        logo_url: this.fb.control(affiliation.logo_url, [Validators.required, StringUtils.urlValidator()]),
273
        website_url: this.fb.control(affiliation.website_url, [Validators.required, StringUtils.urlValidator()]),
273 274
      }));
274 275
    });
275 276
    this.curatorFb = this.fb.group({
......
422 423
    this.affiliationFb = this.fb.group({
423 424
      id: this.fb.control(affiliation.id),
424 425
      name: this.fb.control(affiliation.name, Validators.required),
425
      logo_url: this.fb.control(affiliation.logo_url, Validators.required),
426
      website_url: this.fb.control(affiliation.website_url, Validators.required)
426
      logo_url: this.fb.control(affiliation.logo_url, [Validators.required, StringUtils.urlValidator()]),
427
      website_url: this.fb.control(affiliation.website_url, [Validators.required, StringUtils.urlValidator()])
427 428
    });
428 429
    this.affiliationModal.okButtonLeft = false;
429 430
    this.affiliationModal.cancelButtonText = 'Cancel';
......
468 469
      this.curatorsPage.isEnabled = true;
469 470
    });
470 471
  }
472
  
473
  public urlPrefix(url: string): string {
474
    return StringUtils.urlPrefix(url);
475
  }
471 476
}
modules/uoa-admin-portal/branches/new-UI/src/app/pages/users/personal-info/personal-info.module.ts
13 13
import {InputModule} from "../../../openaireLibrary/sharedComponents/input/input.module";
14 14
import {IconsModule} from "../../../openaireLibrary/utils/icons/icons.module";
15 15
import {IconsService} from "../../../openaireLibrary/utils/icons/icons.service";
16
import {edit, photo, remove} from "../../../openaireLibrary/utils/icons/icons";
16
import {add, edit, photo, remove} from "../../../openaireLibrary/utils/icons/icons";
17 17

  
18 18
@NgModule({
19 19
  imports: [
......
35 35

  
36 36
export class PersonalInfoModule {
37 37
  constructor(private iconsService: IconsService) {
38
    this.iconsService.registerIcons([photo, edit, remove])
38
    this.iconsService.registerIcons([photo, edit, remove, add])
39 39
  }
40 40
}
modules/uoa-admin-portal/branches/new-UI/src/app/pages/affiliations/affiliations.component.html
33 33
                </div>
34 34
                <div class="uk-width-auto">
35 35
                  <h6>{{affiliation.name}}</h6>
36
                  URL: <a [href]="urlPrefix(affiliation.website_url) + affiliation.website_url">{{affiliation.website_url}}</a>
36
                  URL: <a [href]="urlPrefix(affiliation.website_url) + affiliation.website_url"  target="_blank">{{affiliation.website_url}}</a>
37 37
                </div>
38 38
              </div>
39 39
              <div class="uk-width-auto@m uk-width-1-1">
......
41 41
                  <div class="uk-padding-small uk-padding-remove-horizontal">
42 42
                    <a (click)="editAffiliationOpen(i)" class="uk-button action uk-flex uk-flex-middle">
43 43
                      <icon name="edit" ratio="0.7"></icon>
44
                      <span class="uk-margin-small-left">Edit Affiliation</span>
44
                      <span class="uk-margin-small-left">Edit Organization</span>
45 45
                    </a>
46 46
                    <a (click)="deleteAffiliationOpen(i)" class="uk-button action uk-flex uk-flex-middle uk-margin-small-top">
47 47
                      <icon name="remove" ratio="0.7"></icon>
48
                      <span class="uk-margin-small-left">Delete Affiliation</span>
48
                      <span class="uk-margin-small-left">Delete Organization</span>
49 49
                    </a>
50 50
                  </div>
51 51
                </div>
......
61 61
  <form *ngIf="affiliationFb" [formGroup]="affiliationFb">
62 62
    <div class="uk-grid uk-padding uk-padding-remove-horizontal uk-child-width-1-1" uk-grid>
63 63
      <div dashboard-input label="Name" placeholder="Write organization's name" [formInput]="affiliationFb.get('name')"></div>
64
      <div dashboard-input label="Logo URL" placeholder="Write your organization's logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
65
      <div dashboard-input label="Website URL" placeholder="Write your organization's website URL" [formInput]="affiliationFb.get('website_url')"></div>
64
      <div dashboard-input label="Logo URL" type="logoURL" placeholder="Write your organization's logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
65
      <div dashboard-input label="Website URL" type="URL" placeholder="Write your organization's website URL" [formInput]="affiliationFb.get('website_url')"></div>
66 66
    </div>
67 67
  </form>
68 68
</modal-alert>
modules/uoa-admin-portal/branches/new-UI/src/app/pages/affiliations/affiliations.component.ts
93 93
      communityId: this.fb.control(affiliation.communityId, Validators.required),
94 94
      id: this.fb.control(affiliation.id),
95 95
      name: this.fb.control(affiliation.name, Validators.required),
96
      logo_url: this.fb.control(affiliation.logo_url, Validators.required),
97
      website_url: this.fb.control(affiliation.website_url, Validators.required)
96
      logo_url: this.fb.control(affiliation.logo_url, [Validators.required, StringUtils.urlValidator()]),
97
      website_url: this.fb.control(affiliation.website_url, [Validators.required, StringUtils.urlValidator()])
98 98
    });
99 99
    this.affiliationModal.okButtonLeft = false;
100 100
    this.affiliationModal.cancelButtonText = 'Cancel';
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community-info/profile/edit-community/edit-community.component.ts
32 32
               hint="The description of the community."
33 33
               [rows]="4" [formInput]="communityFb.get('description')" label="Description"></div>
34 34
          <input #file id="photo" type="file" class="uk-hidden" (change)="fileChangeEvent($event)"/>
35
          <div dashboard-input class="uk-width-1-1" [hideControl]="communityFb.get('isUpload').value"
35
          <div dashboard-input class="uk-width-1-1" type="logoURL" [hideControl]="communityFb.get('isUpload').value" flex="top"
36 36
               hint="Upload or link the logo of the community." [placeholder]="'Write link to the logo'"
37 37
               [formInput]="communityFb.get('logoUrl')" label="Logo">
38
            <div *ngIf="!communityFb.get('isUpload').value" class="uk-width-2-5@l uk-width-1-1">
38
            <div *ngIf="!communityFb.get('isUpload').value" class="uk-width-2-5@l uk-width-1-1" style="margin-top: 7px;">
39 39
              <div class="uk-grid uk-flex uk-flex-middle" uk-grid>
40 40
                <div class="uk-width-3-4@l uk-width-1-1 uk-flex uk-flex-center">
41 41
                  <button class="uk-button uk-button-secondary uk-flex uk-flex-middle uk-flex-wrap"
......
49 49
                </div>
50 50
              </div>
51 51
            </div>
52
            <div *ngIf="communityFb.get('isUpload').value" class="uk-width-1-1 uk-flex uk-flex-middle">
52
            <div *ngIf="communityFb.get('isUpload').value" class="uk-width-1-1 uk-flex uk-flex-middle" style="margin-top: 7px;">
53 53
              <div class="uk-card uk-card-default uk-text-center uk-border-circle">
54 54
                <img class="uk-position-center" [src]="photo">
55 55
              </div>
......
65 65
              </div>
66 66
            </div>
67 67
          </div>
68
          <div *ngIf="!communityFb.get('isUpload').value && !secure" class="uk-margin-remove-top uk-width-1-1">
69
            <div class="uk-flex uk-flex-right" uk-grid>
70
              <div class="uk-width-3-5@l uk-width-1-1 uk-text-small uk-text-warning">
71
                <span class="uk-text-bold">Note:</span> Prefer urls like "<span class="uk-text-bold">https://</span>example.com/my-secure-image.png"
72
                instead of "<span class="uk-text-bold">http://</span>example.com/my-image.png".
73
                <span class="uk-text-bold">Browsers may not load non secure content.</span>
74
              </div>
75
            </div>
76
          </div>
77 68
          <div *ngIf="uploadError" class="uk-text-danger uk-width-1-1">{{uploadError}}</div>
78 69
          <div dashboard-input class="uk-width-1-1" [formInput]="communityFb.get('status')"
79 70
               hint="Set the visibility status for your community's profile." type="select" [options]="statuses"
......
94 85
    {label: 'Visible to managers', value: 'manager'},
95 86
    {label: 'Hidden', value: 'hidden'}
96 87
  ]
97
  public secure: boolean = false;
98 88
  public community: CommunityInfo;
99 89
  public isNew: boolean;
100 90
  public properties: EnvProperties = properties
......
153 143
            this.communityFb.updateValueAndValidity();
154 144
          }
155 145
        }));
156
        this.secure = (!this.communityFb.get('logoUrl').value || this.communityFb.get('logoUrl').value.includes('https://'));
157
        this.subscriptions.push(this.communityFb.get('logoUrl').valueChanges.subscribe(value => {
158
          this.secure = (!value || value.includes('https://'));
159
        }));
160 146
        this.initPhoto();
161 147
        if (!isNew) {
162 148
          if (!this.isAdmin) {
......
218 204
      this.removePhoto();
219 205
      this.subscriptions.push(this.communityService.updateCommunity(
220 206
        this.properties.communityAPI + this.community.communityId, this.communityFb.value).subscribe(() => {
221
          this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
222
            UIkit.notification(community.shortTitle + ' has been <b>successfully created</b>', {
223
              status: 'success',
224
              timeout: 6000,
225
              pos: 'bottom-right'
226
            });
227
            callback(community);
207
        this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
208
          UIkit.notification(community.shortTitle + ' has been <b>successfully created</b>', {
209
            status: 'success',
210
            timeout: 6000,
211
            pos: 'bottom-right'
228 212
          });
213
          callback(community);
214
        });
229 215
      }, error => {
230 216
        UIkit.notification('An error has occurred. Please try again later', {
231 217
          status: 'danger',
modules/uoa-admin-portal/branches/new-UI/src/app/app.routing.ts
204 204
        canActivateChild: [AdminLoginGuard],
205 205
        data: {portal: 'openaire'}
206 206
    },
207
    {   path: 'icons',
208
        pathMatch: 'full',
209
        loadChildren: './openaireLibrary/utils/icons/icons-preview/icons-preview.module#IconsPreviewModule',
210
        data: {hasSidebar: false, hasHeader: false}
211
    },
207 212
    {
208 213
        path: 'admin-tools',
209 214
        loadChildren: './pages/admin-tools/portal-admin-tools-routing.module#PortalAdminToolsRoutingModule',

Also available in: Unified diff