Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Commit

Permalink
Merge branch 'testing' into 'master'
Browse files Browse the repository at this point in the history
Extended Document Metadata



See merge request !18
  • Loading branch information
ankoh committed Oct 22, 2015
2 parents 481a70d + 453dccb commit 3017cfc
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 18 deletions.
61 changes: 52 additions & 9 deletions app/dist/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
var MC_BASE_HOST = ':base_host';
var MC_BASE_PORT = ':base_port';

/*
Month names
*/
function convertMonthNumber(monthNumber) { //1 = January
var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December' ];
if(monthNumber < 1 || monthNumber > 12) {
return '';
} else {
return monthNames[monthNumber - 1];
}
}

/*
Documents API
*/
Expand Down Expand Up @@ -150,14 +163,16 @@ function queryDocuments() {
for (var i = 0; i < data.length; i++) {
docs += '<li>';
if(typeof data[i].title !== 'undefined') {
if(data[i].website) {
docs += '<a target="_blank" href="' + data [i].website + '"><b>' + data[i].title + '</b></a>';
if(data[i].doc_website) {
docs += '<a target="_blank" href="' + data[i].doc_website + '"><b>' + data[i].title + '</b></a>';
} else {
docs += '<b>' + data[i].title + '</b>';
}
docs += '</br>';
}

// Second line
if(typeof data[i].authors !== 'undefined') {
docs += '</br>';
// Now try to find the profile pages for the different authors
// First prepare the authors string
var authors = data[i].authors.split(',');
Expand All @@ -168,7 +183,11 @@ function queryDocuments() {
for(var j = 0; j < authors.length; j++) {
var name = authors[j];
if(j > 0) {
docs += ', ';
if(j == authors.length - 1) {
docs += ' and ';
} else {
docs += ', ';
}
}
if(name in profilePages) {
docs += '<a href="' + profilePages[name] + '">' + name + '</a>';
Expand All @@ -177,13 +196,37 @@ function queryDocuments() {
}
}
}

// Third line
if(typeof data[i].source !== "undefined" &&
typeof data[i].pub_year !== "undefined" &&
data[i].source != "" &&
data[i].pub_year != "") {
docs += '<br />' + data[i].source + ', ' + data[i].pub_year + '.</li>';
data[i].source != "") {
docs += '<br />'

// Conference website
if(typeof data[i].conf_website !== "undefined" &&
data[i].conf_website != "") {
docs += '<a target="_blank" href="' + data[i].conf_website + '">' + data[i].source + '</a>';
} else {
docs += data[i].source;
}
// Conference city
if(typeof data[i].conf_city !== "undefined" &&
data[i].conf_city != "") {
docs += ', ' + data[i].conf_city;
}
// Year
if(typeof data[i].pub_year !== "undefined" &&
data[i].pub_year != "") {
docs += ', ' + convertMonthNumber(data[i].conf_month) + ' ' + data[i].pub_year;
}
// Pages
if(typeof data[i].conf_pages !== "undefined" &&
data[i].conf_pages != "") {
docs += ', pp. ' + data[i].conf_pages;
}
docs += '.</li>';
} else {
docs += '.</li>';
docs += '</li>';
}
}
docs += '</ul>';
Expand Down
24 changes: 16 additions & 8 deletions app/partials/dialogs/document-detail.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,27 @@ <h3 class="mc-text-align-center">
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Source</strong></p>
<p flex>{{ selectedDocument.source || "None" }}</p>
<p flex>{{ selectedDocument.source || "Unknown" }}</p>
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Year</strong></p>
<p flex>{{ selectedDocument.pub_year || "None" }}</p>
<p flex>{{ selectedDocument.pub_year || "Unknown" }}</p>
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Month</strong></p>
<p flex>{{ selectedDocument.conf_month | monthName }}</p>
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Type</strong></p>
<p flex>{{ selectedDocument.doc_type || "None" }}</p>
<p flex>{{ selectedDocument.doc_type || "Unknown" }}</p>
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Document Website</strong></p>
<p flex><a ng-href="{{selectedDocument.doc_website}}">{{ selectedDocument.doc_website || "Unknown" }}</a></p>
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Website</strong></p>
<p flex><a ng-href="{{selectedDocument.website}}">{{ selectedDocument.website || "None" }}</a></p>
<p flex="25" class="mc-right-align-column"><strong>Conference Website</strong></p>
<p flex><a ng-href="{{selectedDocument.conf_website}}">{{ selectedDocument.conf_website || "Unknown" }}</a></p>
</div>
<div layout="row">
<p flex="25" class="mc-right-align-column"><strong>Keywords</strong></p>
Expand All @@ -47,7 +55,7 @@ <h3 class="mc-text-align-center">
</li>
</ul>
<p ng-if="!selectedDocument.keywords">
None
Unknown
</p>
</div>
<div layout="row">
Expand All @@ -59,7 +67,7 @@ <h3 class="mc-text-align-center">
</li>
</ul>
<p ng-if="!selectedDocument.tags">
None
Unknown
</p>
</div>
<div layout="row">
Expand All @@ -72,7 +80,7 @@ <h3 class="mc-text-align-center">
readonly="true">
</md-chips>
<p ng-if="derivedFields.length == 0">
None
Unknown
</p>
</div>
</div>
Expand Down
15 changes: 14 additions & 1 deletion app/src/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,17 @@ angular.module('mendeleyCache')
var trimmed = splitted.filter(function(x) { return x ? true : false; })
return trimmed.length;
};
});
});

angular.module('mendeleyCache')
.filter('monthName', [function() {
return function (monthNumber) { //1 = January
var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December' ];
if(monthNumber < 1 || monthNumber > 12) {
return 'Unknown';
} else {
return monthNames[monthNumber - 1];
}
}
}]);

0 comments on commit 3017cfc

Please sign in to comment.