Project

General

Profile

« Previous | Next » 

Revision 51565

move Connect helper in the library| change help service to get communityId by parameter/domain (for connect or properties for explore) | add helper before/after option in search/advanced/table pages

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchPage.component.html
107 107
            </div>
108 108

  
109 109
            <div *ngIf="tableViewLink || searchUtils.totalResults <= csvLimit" class="helper-left-right uk-visible@m">
110
              <helper position="right" before="true"></helper>
110 111
              <span *ngIf="tableViewLink" class="uk-margin-medium-right">
111 112
                <a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
112 113
                  <span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
......
115 116
                <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
116 117
              </span>
117 118
              <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
118
              <helper position="right"></helper>
119
              <helper position="right" before="false"></helper>
119 120
            </div>
120 121
            <helper *ngIf="!tableViewLink && searchUtils.totalResults > csvLimit" class="helper-left-right uk-visible@m" position="right"></helper>
121 122
          </div>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchPageTableView.component.html
49 49

  
50 50
        <div  class="uk-grid uk-width-1-1">
51 51
          <div *ngIf="filters.length > 0" class="helper-left-right search-filters uk-width-1-6@m  uk-visible@m">
52
            <helper position="left"></helper>
52
            <helper position="left" before="true"></helper>
53 53
            <search-filter  *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter"  [showResultCount]=showResultCount (change)="filterChanged($event)" (toggleModal)="toggleModal($event)"></search-filter>
54
            <helper position="left" before="false"></helper>
54 55
          </div>
55 56

  
56 57
          <div class="uk-width-expand@m uk-width-1-1@s uk-first-column custom-dataTable-content" >
......
196 197
            <helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
197 198
          </div>
198 199

  
199
          <div *ngIf="searchViewLink" class="helper-left-right uk-width-1-6@m uk-visible@m">
200
            <p>
200
          <div  class="helper-left-right uk-width-1-6@m uk-visible@m">
201
            <p  *ngIf="searchViewLink">
202
              <helper position="right" before="true"></helper>
201 203
              <span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
202 204

  
203 205
              <a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=searchViewLink >
204 206
                <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
205 207
              </a>
208
              <helper position="right" before="false"></helper>
206 209
            </p>
207 210

  
208
            <helper position="right"></helper>
211
            <helper *ngIf="!searchViewLink" position="right"></helper>
209 212
          </div>
210 213
        </div>
211 214

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchPage.component.html
50 50
              <helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
51 51
            </div>
52 52
            <div *ngIf="searchUtils.totalResults <= csvLimit" class="uk-visible@m helper-left-right">
53
              <helper position="right" before="true"></helper>
53 54
              <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
54
              <helper position="right"></helper>
55
              <helper position="right" before="false"></helper>
55 56
            </div>
56 57
            <helper *ngIf="searchUtils.totalResults > csvLimit" class="helper-left-right uk-visible@m" position="right"></helper>
57 58
          </div>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/connect/connectHelper.ts
1
export class ConnectHelper{
2

  
3
  public static  getCommunityFromDomain(domain:string):string{
4
    // domain = "beta.egi.openaire.eu"; for testing
5
    if(domain.indexOf("di.uoa.gr")!=-1){
6
      return null;
7
    }
8
    if(domain.indexOf("beta")!=-1){
9
      domain = domain.substr(domain.indexOf(".")+1,domain.length);
10
      domain = domain.substr(0,domain.indexOf("."));
11
    }else{
12
      domain = domain.substr(0,domain.indexOf("."));
13
    }
14
    if(domain == "connect"){
15
      return null;
16
    }
17
    return domain;
18
  }
19
  public static  isProduction(domain:string):boolean{
20
    console.log("Domain:"+domain);
21
    if(domain.indexOf(".di.uoa.gr")!=-1){
22
      return false;
23
    }else if(domain.indexOf(".openaire.eu")!=-1){
24
      return true;
25
    }
26
  }
27
  public static  getProductionPrefix(domain:string):string{
28
    if(domain.indexOf("beta.")!=-1){
29
      return "beta.";
30
    }else{
31
      return "";
32
    }
33
  }
34
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/helper/helper.service.ts
10 10
export class HelperService {
11 11
    constructor(private http: Http) {}
12 12

  
13
    getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties):any {
13
    getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties,communityId:string ):any {
14 14
        console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
15 15

  
16 16
        let url = properties.adminToolsAPIURL;
17 17
        if(div) {
18
          url += '/divhelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&div=' + div;
18
          url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
19 19
        } else {
20
          url += '/pagehelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&position=' + position;
20
          url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
21 21
          if(before) {
22 22
            url += '&before='+before;
23 23
          }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/helper/helper.component.ts
3 3
import 'rxjs/Rx';
4 4
import {HelperService} from './helper.service';
5 5
import{EnvProperties} from '../properties/env-properties';
6

  
6
import {ConnectHelper} from '../../connect/connectHelper';
7 7
@Component({
8 8
  selector: 'helper',
9 9
  template: `
......
22 22
  @Input() styleName:string = '';
23 23
  sub:any;
24 24
  properties:EnvProperties;
25

  
25
  communityId = null;
26 26
  constructor (private _service: HelperService, private route: ActivatedRoute,) {}
27 27

  
28 28
  ngOnInit() {
29 29
    this.route.data
30 30
      .subscribe((data: { envSpecific: EnvProperties }) => {
31 31
         this.properties = data.envSpecific;
32
         this.route.queryParams.subscribe(
33
           params => {
34
                 this.communityId = params['communityId'];
35
                  if(!this.communityId){
36
                   this.communityId  = ConnectHelper.getCommunityFromDomain(document.location.hostname);
37
                  }
38
                  if(!this.communityId){
39
                  this.communityId = this.properties.adminToolsCommunity;
40
                  }
41
                  if(this.properties.enableHelper && location){
42
                    //this.sub = this._service.getHelper(location.pathname, this.properties).subscribe(
43
                    this.sub = this._service.getHelper(location.pathname, this.position, this.before, this.div, this.properties, this.communityId).subscribe(
44
                      data => {
45
                        //this.texts =(data && data.content && data.content[this.position] )? data.content[this.position]:[];
46
                        this.texts = data;
47
                      },
48
                      err => {
49
                        console.log(err);
32 50

  
33
         if(this.properties.enableHelper && location){
34
           //this.sub = this._service.getHelper(location.pathname, this.properties).subscribe(
35
           this.sub = this._service.getHelper(location.pathname, this.position, this.before, this.div, this.properties).subscribe(
36
             data => {
37
               //this.texts =(data && data.content && data.content[this.position] )? data.content[this.position]:[];
38
               this.texts = data;
39
             },
40
             err => {
41
               console.log(err);
42

  
43
             }
44
           );
45
         }
51
                      }
52
                    );
53
                  }
54
               });
46 55
      });
47 56
  }
48 57

  

Also available in: Unified diff