Project

General

Profile

« Previous | Next » 

Revision 56644

[Trunk|Library]: Add Helper on search Page, landings and deposit first page.

View differences:

depositFirstPage.component.ts
1 1
import {Component, Input}           from '@angular/core';
2 2
import {ZenodoInformationClass} from './utils/zenodoInformation.class';
3 3
import {EnvProperties} from "../utils/properties/env-properties";
4
import {ActivatedRoute} from "@angular/router";
4
import {ActivatedRoute, Router} from "@angular/router";
5 5
import {PiwikService} from "../utils/piwik/piwik.service";
6
import {HelperService} from "../utils/helper/helper.service";
6 7

  
7 8
@Component({
8 9
  selector: 'deposit-first-page',
......
134 135
<!–      grey-background–>
135 136
      <div class="uk-margin-top uk-padding-small">
136 137
        <div class="uk-align-center uk-container uk-container-large uk-margin-top uk-margin-bottom">
137
          <helper *ngIf="pageContents && pageContents['bottom']" [texts]="pageContents['bottom']"></helper>
138
          <helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" [texts]="pageContents['bottom']"></helper>
138 139
        </div>
139 140
      </div>
140 141
    </div>-->
141
    <helper *ngIf="pageContents && pageContents['bottom']" [texts]="pageContents['bottom']"></helper>
142
    <helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" [texts]="pageContents['bottom']"></helper>
142 143
  `
143 144
})
144 145

  
......
147 148
  @Input() piwikSiteId = null;
148 149
  piwiksub:any;
149 150

  
150
  @Input() pageContents = null;
151
  @Input() divContents = null;
151
  @Input() communityId = null;
152 152

  
153
  public pageContents = null;
154
  public divContents = null;
155

  
153 156
  public keyword: string;
154 157
  public depositRoute = "/search-deposit";
155 158
  public searchPlaceHolder = "Search for repositories by title, country, organization, subject...";
156 159
  properties:EnvProperties;
157 160

  
158
  constructor (private  route: ActivatedRoute, private _piwikService:PiwikService) {}
161
  constructor (private  route: ActivatedRoute, private _piwikService:PiwikService,
162
               private helper: HelperService,
163
               private _router: Router) {}
164

  
165

  
159 166
  ngOnInit() {
160 167
    this.route.data
161 168
      .subscribe((data: { envSpecific: EnvProperties }) => {
162 169
        this.properties = data.envSpecific;
163

  
170
        //this.getDivContents();
171
        this.getPageContents();
164 172
        if (!this.zenodoInformation) {
165 173
          this.zenodoInformation = new ZenodoInformationClass();
166 174
        }
......
177 185
      });
178 186
  }
179 187

  
188
  public getPageContents() {
189
    this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
190
      this.pageContents = contents;
191
    })
192
  }
193

  
194
  public getDivContents() {
195
    this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
196
      this.divContents = contents;
197
    })
198
  }
199

  
180 200
  ngOnDestroy() {
181 201
    if(this.piwiksub){
182 202
      this.piwiksub.unsubscribe();

Also available in: Unified diff