Skip to content

Commit

Permalink
added url + print instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
aholachek committed Feb 10, 2016
1 parent 504661c commit 2146433
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/js/widgets/metrics/templates/metrics_container.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

<div class="metrics-container">
<div class="print-visible"><h2 style="font-weight: 800;text-align:center;">NASA/ADS Metrics Report </h2> </div>
<div class="print-visible" style="text-align:center">{{url}}</div>

<span class="s-large-close close-widget">x</span>

<div class="metrics-metadata s-metrics-metadata">
Expand Down
5 changes: 5 additions & 0 deletions src/js/widgets/metrics/templates/metrics_metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ <h4>Currently viewing metrics for {{current}}
<button class="submit-rows btn btn-sm btn-info"> Submit </button>

{{/if}}
<br>
<p>
This metrics report is optimized for printing: just find the print command in your browser's toolbar.
</p>

2 changes: 2 additions & 0 deletions src/js/widgets/metrics/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ define([
renderWidgetForCurrentQuery : function(){
this.resetWidget();
this.containerModel.set("requestRowsAllowed", true);
//for printing
this.containerModel.set("url", window.location.href);
this.dispatchRequest(this.getCurrentQuery());
},

Expand Down
4 changes: 2 additions & 2 deletions test/mocha/js/widgets/metrics_widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ define([
minsub.publish(minsub.START_SEARCH, new ApiQuery({q : "star"}));

metricsWidget.renderWidgetForCurrentQuery();
expect($("#test").find(".metrics-metadata").text().trim()).to.eql('Currently viewing metrics for 2\n \n papers.\n \n\n\n\n\n Change to first paper(s) (max is 2).\n Submit');
expect($("#test").find(".metrics-metadata").text().trim()).to.eql('Currently viewing metrics for 2\n \n papers.\n \n\n\n\n\n Change to first paper(s) (max is 2).\n Submit \n\n\n\n\n This metrics report is optimized for printing: just find the print command in your browser\'s toolbar.');

sinon.spy(metricsWidget.getPubSub(), "publish");

Expand Down Expand Up @@ -1412,7 +1412,7 @@ define([
minsub.publish(minsub.START_SEARCH, new ApiQuery({q : "star"}));

metricsWidget.renderWidgetForCurrentQuery();
expect($("#test").find(".metrics-metadata").text().trim()).to.eql('Currently viewing metrics for 1\n \n paper.');
expect($("#test").find(".metrics-metadata").text().trim()).to.eql('Currently viewing metrics for 1\n \n paper.\n \n\n\n\n\n\n This metrics report is optimized for printing: just find the print command in your browser\'s toolbar.');

expect($("#test").find("h3:visible").text()).to.eql("CitationsReads");

Expand Down

0 comments on commit 2146433

Please sign in to comment.