Project

General

Profile

« Previous | Next » 

Revision 60806

[admin| branch new-UI]

Customizations:
- use Layout for class (get, save)
- add contrast check

Remove showImage directive

View differences:

modules/uoa-admin-portal/branches/new-UI/src/app/pages/content-providers/add-content-providers.component.html
33 33
          <div class="uk-grid uk-grid-divider uk-padding-small" uk-grid>
34 34
            <div class="uk-width-expand@m uk-width-1-1">
35 35
              <result-preview [properties]="properties" [showOrganizations]="true"
36
                              [showSubjects]="true" [result]="getResultPreview(result)" [showImage]="true"
36
                              [showSubjects]="true" [result]="getResultPreview(result)"
37 37
                              [externalUrl]="contentProviderUrl">
38 38
              </result-preview>
39 39
            </div>
......
75 75
                    [totalResults]="openaireSearchUtils.totalResults">
76 76
    </no-load-paging>
77 77
  </ng-container>
78
</div>
78
</div>
modules/uoa-admin-portal/branches/new-UI/src/app/pages/projects/add-projects.component.html
63 63
          <div class="uk-grid uk-grid-divider uk-padding-small" uk-grid>
64 64
            <div class="uk-width-expand@m uk-width-1-1">
65 65
              <result-preview [properties]="properties" [showOrganizations]="true"
66
                              [showSubjects]="true" [result]="getResultPreview(result)" [showImage]="true"
66
                              [showSubjects]="true" [result]="getResultPreview(result)"
67 67
                              [externalUrl]="projectUrl">
68 68
              </result-preview>
69 69
            </div>
modules/uoa-admin-portal/branches/new-UI/src/app/pages/customization/Border.component.ts
5 5
  selector: 'border',
6 6
  template: `
7 7
    <div class="uk-grid uk-margin-remove">
8
      <div class="uk-width-small uk-margin-small-top uk-padding-remove-left"> Radius (in pixels):</div>
8
      <div class="uk-width-small uk-margin-small-top uk-padding-remove-left"> Radius (px):</div>
9 9
      <div class="uk-width-small uk-padding-remove-left">
10 10
        <input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="radius" (ngModelChange)="borderChanged()" type="number" min="0"  />
11 11
      </div>
12 12
    </div>
13 13
    <div class="uk-grid uk-margin-remove">
14
      <div class="uk-width-small uk-margin-small-top uk-padding-remove-left"> Width (in pixels):</div>
14
      <div class="uk-width-small uk-margin-small-top uk-padding-remove-left"> Width (px):</div>
15 15
      <div class="uk-width-small uk-padding-remove-left">
16 16
        <input class="uk-input uk-width-small uk-margin-small-left" [(ngModel)]="width" (ngModelChange)="borderChanged()" type="number" min="0" />
17 17
      </div>
modules/uoa-admin-portal/branches/new-UI/src/app/pages/customization/customization.component.html
151 151
                     label="Dark background color"
152 152
                     (colorChange)=
153 153
                       " draftCustomizationOptions.backgrounds.dark.color = $event;"></color>
154

  
154
                      <span *ngIf="!isForLightBackground(draftCustomizationOptions.backgrounds.dark.color)">The selected color may has lower contrast.</span>
155 155
              <color [color]="draftCustomizationOptions.backgrounds.light.color"
156 156
                     label="Light background color"
157 157
                     (colorChange)=
158 158
                       " draftCustomizationOptions.backgrounds.light.color = $event;"></color>
159
              <span *ngIf="isForLightBackground(draftCustomizationOptions.backgrounds.light.color)">The selected color may has lower contrast.</span>
159 160

  
160

  
161 161
            </div>
162 162
            <div class="uk-margin-large-top uk-margin-small-bottom uk-text-bold" >Buttons
163 163
              <a *ngIf="hasChanges(publishedCustomizationOptions.buttons, draftCustomizationOptions.buttons)"
modules/uoa-admin-portal/branches/new-UI/src/app/pages/customization/customization.component.ts
6 6
import {Session} from '../../openaireLibrary/login/utils/helper.class';
7 7
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
8 8
import {DomSanitizer, Title} from '@angular/platform-browser';
9
import {CustomizationOptions} from '../../openaireLibrary/connect/community/CustomizationOptions';
9
import {CustomizationOptions, Layout} from '../../openaireLibrary/connect/community/CustomizationOptions';
10 10
import {StringUtils} from '../../openaireLibrary/utils/string-utils.class';
11 11
import {LayoutService} from '../../openaireLibrary/services/layout.service';
12 12
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
......
22 22
  menuSelected = 'identity';
23 23
  color = 'white';
24 24
  defaultCustomizationOptions:CustomizationOptions = new CustomizationOptions();
25
  publishedLayout: Layout = null;
25 26
  publishedCustomizationOptions: CustomizationOptions = null;
26 27
  draftCustomizationOptions: CustomizationOptions = null;
27 28
  appliedCustomizationOptions: CustomizationOptions = null;
......
29 30
  previewCustomization = null;
30 31
  buttonDarkBackgroundPreview;
31 32
  buttonLightBackgroundPreview;
32
  linkDarkBackgroundPreview;
33
  linkLightBackgroundPreview;
34
  hoveredText;
33

  
35 34
  public showLoading = true;
36 35
  public errorMessage = '';
37 36
  public successfulSaveMessage = '';
......
71 70
        this.errorMessage = '';
72 71
        this.successfulSaveMessage = '';
73 72
        this.layoutService.getLayout(this.properties, this.communityId).subscribe(layout => {
74
          this.publishedCustomizationOptions = (layout?layout:Object.assign({},this.defaultCustomizationOptions));
73
          this.publishedLayout = (layout?layout:new Layout(this.communityId,this.defaultCustomizationOptions));
74
          this.publishedCustomizationOptions = (layout?layout.layoutOptions:Object.assign({},this.defaultCustomizationOptions));
75 75
          this.initializeCustomizationOptions(true);
76 76
        }, error => {
77 77
          this.publishedCustomizationOptions = new CustomizationOptions();
......
92 92
        queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
93 93
      });
94 94
    }
95
    this.layoutService.saveLayout(this.properties, this.communityId, this.draftCustomizationOptions).subscribe(layout => {
96
      this.publishedCustomizationOptions = layout;
95
    this.publishedLayout.layoutOptions = this.draftCustomizationOptions;
96
    this.layoutService.saveLayout(this.properties, this.communityId, this.publishedLayout).subscribe(layout => {
97
      this.publishedLayout = layout;
98
      this.publishedCustomizationOptions = layout.layoutOptions;
97 99
      this.initializeCustomizationOptions(JSON.stringify(this.publishedCustomizationOptions) != this.previewCustomization);
98 100
      this.successfulSaveMessage = "Customization Options saved!"
99 101
    }, error => {
......
104 106
  initializeCustomizationOptions(updatePreviewUrl) {
105 107
    this.draftCustomizationOptions = this.copyObject(this.publishedCustomizationOptions);
106 108
    this.appliedCustomizationOptions = this.copyObject(this.publishedCustomizationOptions);
107

  
109
    console.log(this.draftCustomizationOptions);
108 110
    if(updatePreviewUrl){
109 111
      this.previewUrl = this.getCommunityUrlSatinized(JSON.stringify(this.appliedCustomizationOptions));
110 112
    }
111 113

  
112

  
113
    this.buttonDarkBackgroundPreview = this.changeStyle(this.draftCustomizationOptions.buttons.darkBackground);
114
    this.buttonLightBackgroundPreview = this.changeStyle(this.draftCustomizationOptions.buttons.lightBackground);
115 114
  }
116 115

  
117 116
  applyLayout() {
......
370 369
    });
371 370
  }
372 371

  
372
public isForLightBackground(color:string){
373
  return CustomizationOptions.isForLightBackground(color);
374
}
373 375

  
374 376

  
375

  
376 377
}

Also available in: Unified diff