Skip to content

Commit

Permalink
Merge pull request #3568 from IQSS/3538-metrics-block-link
Browse files Browse the repository at this point in the history
3538 metrics block link
  • Loading branch information
kcondon authored Jan 13, 2017
2 parents 4f1a073 + e22ff9b commit feb4e2c
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 115 deletions.
7 changes: 7 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ Set ``:GuidesVersion`` to override the version number in the URL of guides. For

``curl -X PUT -d 1234-new-feature http://localhost:8080/api/admin/settings/:GuidesVersion``

:MetricsUrl
+++++++++++

Make the metrics component on the root dataverse a clickable link to a website where you present metrics on your Dataverse installation. This could perhaps be an installation of https://github.com/IQSS/miniverse or any site.

``curl -X PUT -d http://metrics.dataverse.example.edu http://localhost:8080/api/admin/settings/:MetricsUrl``

:StatusMessageHeader
++++++++++++++++++++

Expand Down
1 change: 1 addition & 0 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ dataset.exportBtn.itemLabel.ddi=DDI
dataset.exportBtn.itemLabel.dublinCore=Dublin Core
dataset.exportBtn.itemLabel.json=JSON
metrics.title=Metrics
metrics.title.tip=View more metrics information
metrics.comingsoon=Coming soon...
metrics.views=Views
metrics.downloads={0, choice, 0#Downloads|1#Download|2#Downloads}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public enum Key {
TwoRavensUrl,
/** Optionally override http://guides.dataverse.org . */
GuidesBaseUrl,
/**
* A link to an installation of https://github.com/IQSS/miniverse or
* some other metrics app.
*/
MetricsUrl,
/* zip download size limit */
/** Optionally override version number in guides. */
GuidesVersion,
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ public String getGuidesVersion() {
return saneDefault;
}

public String getMetricsUrl() {
String saneDefault = null;
String metricsUrl = settingsService.getValueForKey(SettingsServiceBean.Key.MetricsUrl, saneDefault);
return metricsUrl;
}

/**
* Download-as-zip size limit.
* returns 0 if not specified;
Expand Down
44 changes: 7 additions & 37 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,44 +40,14 @@
<div id="topDatasetBlock" class="row" jsf:rendered="#{empty DatasetPage.editMode}">
<div id="actionButtonBlock" class="col-xs-12" jsf:rendered="#{!widgetWrapper.widgetView}">
<!-- Metrics -->
<div id="metrics-block" class="pull-left" jsf:rendered="#{!DatasetPage.workingVersion.deaccessioned}">
<div class="pull-left text-center" id="metrics-label">
<span class="metrics-label-text small"><span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}</span>
<div id="metrics-block" class="col-xs-3" jsf:rendered="#{!DatasetPage.workingVersion.deaccessioned}">
<div id="metrics-label" class="col-xs-4 small text-center">
<span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}
</div>
<div class="pull-left">
<div id="metrics-content" class="tab-content">
<div id="metrics-views" class="metrics-views tab-pane fade small text-center">
#{bundle['metrics.views']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
<div id="metrics-downloads" class="metrics-downloads tab-pane small text-center active in">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDatasetId(DatasetPage.dataset.id)}"/>
</h:outputFormat>
</div>
<div id="metrics-citations" class="metrics-citations tab-pane fade small text-center">
#{bundle['metrics.citations']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
<div id="metrics-shares" class="metrics-shares tab-pane fade small text-center">
#{bundle['metrics.shares']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
</div>
<div id="metrics-tabs">
<!-- DISABLED TOGGLE UNTIL FURTHER DEVELOPMENT ON METRICS IS COMPLETED
ADDED style="pointer-events:none;" ATTRIBUTE TO A-HREF ELEMENTS BELOW
REMOVED fade CLASS FROM metrics-downloads DIV ABOVE AND ADDED active in -->
<div class="metrics-hover pull-left">
<a href="#metrics-views" style="pointer-events:none;" class="metrics-views" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-downloads" style="pointer-events:none;" class="metrics-downloads first" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-citations" style="pointer-events:none;" class="metrics-citations" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-shares" style="pointer-events:none;" class="metrics-shares" data-toggle="tab">&#160;</a>
</div>
</div>
<div id="metrics-content" class="col-xs-8 small text-center">
<h:outputFormat styleClass="metrics-downloads" value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDatasetId(DatasetPage.dataset.id)}"/>
</h:outputFormat>
</div>
</div>
<!-- END: Metrics -->
Expand Down
49 changes: 12 additions & 37 deletions src/main/webapp/dataverse.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -496,44 +496,19 @@
</p:dialog>
<!-- END: Email/Link/Share Button Group -->
<!-- Metrics for Root Dataverse -->
<div id="metrics-block" class="pull-left" jsf:rendered="#{ DataversePage.isRootDataverse() }">
<div class="pull-left text-center" id="metrics-label">
<span class="metrics-label-text small"><span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}</span>
<div id="metrics-block" class="col-xs-3" jsf:rendered="#{DataversePage.isRootDataverse()}">
<div id="metrics-label" class="col-xs-4 small text-center">
<h:outputLink value="#{systemConfig.metricsUrl}" target="_blank" title="#{bundle['metrics.title.tip']}" rendered="#{systemConfig.metricsUrl != null}">
<span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}
</h:outputLink>
<ui:fragment rendered="#{systemConfig.metricsUrl == null}">
<span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}
</ui:fragment>
</div>
<div class="pull-left">
<div id="metrics-content" class="tab-content">
<div id="metrics-views" class="metrics-views tab-pane fade small text-center">
#{bundle['metrics.views']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
<div id="metrics-downloads" class="metrics-downloads tab-pane small text-center active in">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountOfAllGuestbookResponses()}"/>
</h:outputFormat>
</div>
<div id="metrics-citations" class="metrics-citations tab-pane fade small text-center">
#{bundle['metrics.citations']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
<div id="metrics-shares" class="metrics-shares tab-pane fade small text-center">
#{bundle['metrics.shares']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
</div>
<div id="metrics-tabs">
<!-- DISABLED TOGGLE UNTIL FURTHER DEVELOPMENT ON METRICS IS COMPLETED
ADDED style="pointer-events:none;" ATTRIBUTE TO A-HREF ELEMENTS BELOW
REMOVED fade CLASS FROM metrics-downloads DIV ABOVE AND ADDED active in -->
<div class="metrics-hover pull-left">
<a href="#metrics-views" style="pointer-events:none;" class="metrics-views" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-downloads" style="pointer-events:none;" class="metrics-downloads first" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-citations" style="pointer-events:none;" class="metrics-citations" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-shares" style="pointer-events:none;" class="metrics-shares" data-toggle="tab">&#160;</a>
</div>
</div>
<div id="metrics-content" class="col-xs-8 small text-center">
<h:outputFormat styleClass="metrics-downloads" value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountOfAllGuestbookResponses()}"/>
</h:outputFormat>
</div>
</div>
<!-- END: Metrics for Root Dataverse-->
Expand Down
44 changes: 7 additions & 37 deletions src/main/webapp/file.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,14 @@
<div id="topDatasetBlock" class="row">
<div id="actionButtonBlock" class="col-xs-12">
<!-- Metrics -->
<div id="metrics-block" class="pull-left" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
<div class="pull-left text-center" id="metrics-label">
<span class="metrics-label-text small"><span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}</span>
<div id="metrics-block" class="col-xs-3" jsf:rendered="#{!FilePage.fileMetadata.datasetVersion.deaccessioned}">
<div id="metrics-label" class="col-xs-4 small text-center">
<span class="glyphicon glyphicon-stats"/> #{bundle['metrics.title']}
</div>
<div class="pull-left">
<div id="metrics-content" class="tab-content">
<div id="metrics-views" class="metrics-views tab-pane fade small text-center">
#{bundle['metrics.views']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
<div id="metrics-downloads" class="metrics-downloads tab-pane small text-center active in">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDataFileId(FilePage.fileId)}"/>
</h:outputFormat>
</div>
<div id="metrics-citations" class="metrics-citations tab-pane fade small text-center">
#{bundle['metrics.citations']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
<div id="metrics-shares" class="metrics-shares tab-pane fade small text-center">
#{bundle['metrics.shares']} <em>#{bundle['metrics.comingsoon']}</em>
</div>
</div>
<div id="metrics-tabs">
<!-- DISABLED TOGGLE UNTIL FURTHER DEVELOPMENT ON METRICS IS COMPLETED
ADDED style="pointer-events:none;" ATTRIBUTE TO A-HREF ELEMENTS BELOW
REMOVED fade CLASS FROM metrics-downloads DIV ABOVE AND ADDED active in -->
<div class="metrics-hover pull-left">
<a href="#metrics-views" style="pointer-events:none;" class="metrics-views" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-downloads" style="pointer-events:none;" class="metrics-downloads first" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-citations" style="pointer-events:none;" class="metrics-citations" data-toggle="tab">&#160;</a>
</div>
<div class="metrics-hover pull-left">
<a href="#metrics-shares" style="pointer-events:none;" class="metrics-shares" data-toggle="tab">&#160;</a>
</div>
</div>
<div id="metrics-content" class="col-xs-8 small text-center">
<h:outputFormat styleClass="metrics-downloads" value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDataFileId(FilePage.fileId)}"/>
</h:outputFormat>
</div>
</div>
<!-- END: Metrics -->
Expand Down
13 changes: 9 additions & 4 deletions src/main/webapp/resources/css/structure.css
Original file line number Diff line number Diff line change
Expand Up @@ -540,16 +540,21 @@ div.ui-tabs-panels .ui-tabs.ui-tabs-top .ui-tabs-nav.ui-widget-header {border-bo
div[id$='roleDisplay'] span.label, div[id$='roleDetails'] span.label {display:inline-block; margin-bottom:4px;}

/* -------- METRICS -------- */
#metrics-block {width:238px;}
#metrics-label {background:#6f5499;color:#fff;padding: 7px 10px;}
#metrics-content {background:#6f5499;position:relative;min-height:21px;}
#metrics-content div.tab-pane {color:#fff;padding: 2px 0;width:152px;position:absolute;top:0;left:0;}
#metrics-block.col-xs-3 {border:1px solid #eee;padding:0;}
#metrics-label {color:#333;background:#eee;padding:8px 10px;}
#metrics-label a {color:#333;display:block;}
#metrics-label a:hover {text-decoration:none;}
#metrics-label span.metrics-label-text {}
#metrics-content {color:#333;background:#fff;padding:8px 10px;}
/* --
#metrics-tabs a {background:#428bca;display:block;width:38px;line-height:13px;}
#metrics-tabs a:hover {text-decoration:none;}
#metrics-block .metrics-views {background:#428bca;}
#metrics-block .metrics-downloads {background:#5cb85c;}
#metrics-block .metrics-citations {background:#c55b28;}
#metrics-block .metrics-shares {background:#f0ad4e;}
-- */

/* -------- SHARRRE -------- */
#sharrre-block a {display:block; float:left; padding:6px 12px; margin-right:1em; background:#6f5499;}
Expand Down

0 comments on commit feb4e2c

Please sign in to comment.