linking home added to linking procedure

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@42946 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-06-17 16:08:50 +00:00
parent f60745b68d
commit 100fe2c1b4
6 changed files with 116 additions and 86 deletions

View File

@ -12,11 +12,10 @@ import {ContextsService} from '../../services/contexts.service';
<div class="input-field col s12">
</div>
<h3>Select Community and Category:</h3>
<div class="dropdown">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="communityDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedCommunityLabel}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="communityDropDown">
<li (click)="communityChanged('0','Community:')"><a >Community:</a></li>
@ -27,7 +26,7 @@ import {ContextsService} from '../../services/contexts.service';
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="categoryDropDown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedCategoryLabel}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="categoryDropDown">
<li (click)="categoryChanged('0','Category:')"><a >Category:</a></li>

View File

@ -18,8 +18,7 @@ import {OpenaireProjectsService} from '../../services/openaireProjects.service';
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{selectedFunderName}}
<span class="caret"></span>
</button>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li (click)="funderChanged('0','Select funder:')"><a >Select funder:</a></li>
<li *ngFor="let funder of funders" (click)="funderChanged(funder.field.field[1]['@value_original'],funder.field.field[1]['@value'])" ><a >{{funder.field.field[1]['@value']}}</a></li>

View File

@ -30,7 +30,7 @@
<paging-no-load [currentPage]="page" [totalResults]="crossrefResultsNum" [navigateTo]="navigateTo" [term]="keyword" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load>
</div>
<div >
<p *ngFor=" let item of crossrefResults "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> <button (click)="add(item,'crossref', 'publication', item.URL, item.title)" type="button" class="btn btn-default">Select</button> </p>
<p *ngFor=" let item of crossrefResults " [class]=" item.selected?'panel-heading':'panel-body' "> <publication-title [title]="item.title" [url]="item.URL" > </publication-title> <button (click)="add(item,'crossref', 'publication', item.URL, item.title)" type="button" class="btn btn-default">Select</button> </p>
</div>
</div>
</div>
@ -46,7 +46,7 @@
<p> Not the right author? Choose one of these: </p>
<div class="dropdown">
<button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" role="button" aria-haspopup="true" aria-expanded="true">Selected: {{authorGivenName}} {{authorFamilyName}}<span class="caret"></span></button>
<button class=" btn btn-default dropdown-toggle" type= "button" data-toggle="dropdown" id="orcidDropDown" role="button" aria-haspopup="true" aria-expanded="true">Selected: {{authorGivenName}} {{authorFamilyName}}</button>
<ul class="dropdown-menu" aria-labelledby="orcidDropDown">
<li *ngFor=" let item of authorIds let i = index" (click)="getOrcidResultsById(i)" role="button">
{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}}

View File

@ -173,7 +173,12 @@ search(term: string, size : number, page : number){
add(item, itemSource, itemType, itemUrl, itemTitle){
var result ={id: item.DOI, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate:''};
console.info("Add result:"+result.id+" "+result.source+" "+item);
this.selectedPublications.push(result);
var index:number =this.selectedPublications.indexOf(result);
item.selected=true;
if (index== -1) {
this.selectedPublications.push(result);
}
//do not remove it from the list
// var index:number =this.crossrefResults.indexOf(item);
// if (index > -1) {
@ -185,6 +190,7 @@ search(term: string, size : number, page : number){
}
remove(item){
var index:number =this.selectedPublications.indexOf(item);
item.selected=false;
if (index > -1) {
this.selectedPublications.splice(index, 1);
this.publicationsChange.emit({

View File

@ -8,6 +8,7 @@ import {ClaimDatasetComponent} from './claimDataset/claimDataset.component';
import {ClaimSelectedComponent} from './selected/selected.component';
import {ClaimInsertComponent} from './insertClaim/insertClaim.component';
import {ClaimProjectsComponent} from './claimProject/claimProject.component';
import {LinkingHomeComponent} from './linkingHome.component';
// import { MD_RADIO_DIRECTIVES, MdRadioDispatcher } from '@angular2-material/radio';
// import { MD_INPUT_DIRECTIVES } from '@angular2-material/input';
@ -16,71 +17,79 @@ import {ClaimProjectsComponent} from './claimProject/claimProject.component';
@Component({
selector: 'linking',
//providers: [MdRadioDispatcher],
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimPublicationComponent, ClaimSelectedComponent, ClaimInsertComponent,ClaimDatasetComponent, ClaimProjectsComponent],
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimPublicationComponent, ClaimSelectedComponent, ClaimInsertComponent,ClaimDatasetComponent, ClaimProjectsComponent, LinkingHomeComponent],
template: `
<h1>Linking Research Results</h1>
<div *ngIf=" show != 'claim'" class="row" >
<div class="col-sm-6">
<div *ngIf=" show=='result' " >
<form>
<div class="container">
<div class="page-header">
<h1>Link research resutls</h1>
</div>
<linking-home *ngIf=" show == 'home' " (chosenTypeChange)="chosenTypeChange($event)" ></linking-home>
<div *ngIf=" show != 'home' " >
<div *ngIf=" show != 'claim'" class="row" >
<div class="col-sm-6">
<div *ngIf=" show=='result' " >
<form>
<!--<md-input class="demo-full-width default" placeholder="Search for Research Results" [(ngModel)]="keyword"></md-input>
<!--<md-input class="demo-full-width default" placeholder="Search for Research Results" [(ngModel)]="keyword"></md-input>
<md-radio-group class="default" [(value)]="searchType">
<md-radio-button [value]="publication" [checked]="searchType === 'publication'" >Publication</md-radio-button>
<md-radio-button [value]="dataset" [checked]="searchType != 'publication'">Dataset</md-radio-button>
</md-radio-group> -->
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{(searchType === 'publication')?"Publication":"Dataset"}} <span class="caret"></span></button>
<ul class="dropdown-menu">
<li (click)="typeChanged('publication')" ><a >Publication</a></li>
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
</ul>
<md-radio-group class="default" [(value)]="searchType">
<md-radio-button [value]="publication" [checked]="searchType === 'publication'" >Publication</md-radio-button>
<md-radio-button [value]="dataset" [checked]="searchType != 'publication'">Dataset</md-radio-button>
</md-radio-group> -->
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{(searchType === 'publication')?"Publication":"Dataset"}} </button>
<ul class="dropdown-menu">
<li (click)="typeChanged('publication')" ><a >Publication</a></li>
<li (click)="typeChanged('dataset')" ><a >Dataset</a></li>
</ul>
</div>
<!-- <div class="resultType">
<span class="input-group-addon">
<input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication
<input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset
</div>
</span>-->
<input class=" form-control" [(ngModel)]="keyword"/>
<span class="input-group-btn">
<button (click)="search()" type="submit" class="btn btn-default">Search</button>
</span>
</div>
<!-- <div class="resultType">
<span class="input-group-addon">
<input #publication name="searchType" type="radio" [checked]="searchType === 'publication'" value="publication" (click)="searchType = publication.value" />Publication
<input #dataset name="searchType" [checked]="searchType === 'dataset'" type="radio" value="dataset" (click)="searchType = dataset.value" />Dataset
</div>
</span>-->
<input class=" form-control" [(ngModel)]="keyword"/>
<span class="input-group-btn">
<button (click)="search()" type="submit" class="btn btn-default">Search</button>
</span>
</div>
</form>
</div>
<div *ngIf=" show=='publication' ">
<claim-publication [keyword]="keyword" [selectedPublications]="publications" (publicationsChange)="publicationsChange($event)" > </claim-publication>
</div>
<div *ngIf=" show=='dataset' " >
<claim-dataset [keyword]="keyword" [selectedDatasets]="datasets" (datasetsChange)="datasetsChange($event)" > </claim-dataset>
</div>
<div *ngIf=" show=='project' " >
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
</div>
<div *ngIf=" show == 'context'" >
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
</form>
</div>
<!-- <div *ngIf=" show == 'claim'" >
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" ></claim-insert>
</div>-->
<div *ngIf=" show=='publication' ">
<claim-publication [keyword]="keyword" [selectedPublications]="publications" (publicationsChange)="publicationsChange($event)" > </claim-publication>
</div>
<div *ngIf=" show=='dataset' " >
<claim-dataset [keyword]="keyword" [selectedDatasets]="datasets" (datasetsChange)="datasetsChange($event)" > </claim-dataset>
</div>
<div *ngIf=" show=='project' " >
<claim-projects [selectedProjects]="projects" (projectsChange)="projectsChange($event)" > </claim-projects>
</div>
<div *ngIf=" show=='software' " >
<p>TODO software</p>
</div>
<div *ngIf=" show == 'context'" >
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
</div>
<!-- <div *ngIf=" show == 'claim'" >
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" ></claim-insert>
</div>-->
</div>
<div class="col-sm-6">
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" > </claim-selected>
</div>
</div>
<div *ngIf=" show == 'claim'" >
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [showAccessRights]="'true'" > </claim-selected>
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects"></claim-insert>
</div>
<div class="col-sm-6">
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" > </claim-selected>
</div>
</div>
<div *ngIf=" show == 'claim'" >
<claim-selected [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects" [showAccessRights]="'true'" > </claim-selected>
<claim-insert [contexts]="contexts" [publications]="publications" [datasets]="datasets" [projects]="projects"></claim-insert>
</div>
<button class="btn btn-primary" *ngIf="show != 'project'" (click)="prev()">Prev</button>
<button class="btn btn-primary" *ngIf="show != 'claim'" (click)="next()">Next</button>
<button class="btn btn-primary" *ngIf="show != 'home'" (click)="prev()">Prev</button>
<button class="btn btn-primary" *ngIf="show != 'claim'" (click)="next()">Next</button>
</div>
</div>
`
@ -97,38 +106,46 @@ export class LinkingComponent {
projects=[];
publications=[];
datasets=[];
show = "project";
show = "home";
searchType="publication";
date='8-6-2016';
keyword: string = "";
chosenType:string ="project";
ngOnInit() {
}
next(){
if((this.show == 'project' )){
if((this.show == 'project' || this.show == 'context' || this.show == 'software')){
this.show='result';
}else if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
this.show='context';
this.show='claim';
}else if(this.show == 'result' ){
if(this.searchType == 'publication' ){
this.show="publication";
}else{
this.show="dataset";
}
}else if(this.show == 'context'){
this.show='claim';
}
}
prev(){
if(this.show == 'result'){
this.show='project';
}else if(this.show == 'context'){
this.show='result';
if(this.chosenType == 'project'){
this.show='project';
}else if(this.chosenType == 'context'){
this.show='context';
}else if(this.chosenType == 'software'){
this.show='software';
}else{
this.show='home';
}
}else if(this.show == 'context' || this.show == 'project' || this.show == 'software' ){
this.show='home';
}else if(this.show == 'dataset' || this.show == 'publication'){
this.show='result';
} else if(this.show == 'claim'){
this.show='context';
this.show='result';
}
}
goto(term: string) {
@ -168,4 +185,9 @@ export class LinkingComponent {
typeChanged(type:string) {
this.searchType = type;
}
chosenTypeChange($event) {
this.chosenType = this.show;
this.show=$event.value;
}
}

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, Output, EventEmitter } from '@angular/core';
import {RouteConfig, ROUTER_DIRECTIVES, Router} from '@angular/router-deprecated';
import {JSONP_PROVIDERS} from '@angular/http';
import {Observable} from 'rxjs/Observable';
@ -6,11 +6,6 @@ import {Observable} from 'rxjs/Observable';
@Component({
selector: 'linking-home',
template: `
<div class="container">
<div class="page-header">
<h1>Link research resutls</h1>
</div>
<div class="card-deck-wrapper">
<div class="card-deck">
<div class="card card-inverse card-info text-xs-center">
@ -18,7 +13,7 @@ import {Observable} from 'rxjs/Observable';
<div class="card-block">
<h4 class="card-title">Link with project</h4>
<p class="card-text">Link your research result with funded projects.</p>
<a href="#" class="btn btn-primary">Link with project</a>
<a (click)="select('project')" class="btn btn-primary">Link with project</a>
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>-->
</div>
</div>
@ -26,7 +21,7 @@ import {Observable} from 'rxjs/Observable';
<div class="card-block">
<h4 class="card-title">Link with Community</h4>
<p class="card-text">Link your research result with research communities.</p>
<a href="#" class="btn btn-primary">Link with community</a>
<a (click)="select('context')" class="btn btn-primary">Link with community</a>
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> -->
</div>
</div>
@ -34,18 +29,27 @@ import {Observable} from 'rxjs/Observable';
<div class="card-block">
<h4 class="card-title">Link with Software</h4>
<p class="card-text">....</p>
<a href="#" class="btn btn-primary">Link with software</a>
<a (click)="select('software')" class="btn btn-primary">Link with software</a>
<!--<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p> -->
</div>
</div>
</div>
</div>
</div>`,
`,
directives: [
...ROUTER_DIRECTIVES
],
})
export class LinkingHomeComponent {
@Output() chosenTypeChange = new EventEmitter();
chosenType:string = "result";
select(type:string){
console.info('Changed!'+type);
this.chosenType = type;
this.chosenTypeChange.emit({
value: this.chosenType
});
}
}