Skip to content

Commit

Permalink
Dataset and file pg action btn render logic, accessibility improvemen…
Browse files Browse the repository at this point in the history
…ts [ref #6684]
  • Loading branch information
mheppler committed Apr 9, 2020
1 parent 25a44b8 commit b3e5952
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 35 deletions.
37 changes: 23 additions & 14 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<div id="title-block" class="col-xs-12 margin-bottom-half" jsf:rendered="#{!empty DatasetPage.datasetVersionUI.title.value}">
<span id="title" style="font-size:36px !important;line-height:1.1;">#{DatasetPage.datasetVersionUI.title.value}</span>
<div id="title-label-block" class="margin-top-half">
<!-- DATASET Publication Status -->
<h:outputText value="#{bundle['dataset.versionUI.draft']}" styleClass="label label-default" rendered="#{DatasetPage.workingVersion.draft}"/>
<h:outputText value="#{bundle['dataset.versionUI.inReview']}" styleClass="label label-default" rendered="#{DatasetPage.workingVersion.inReview}"/>
<h:outputText value="#{bundle['dataset.versionUI.unpublished']}" styleClass="label label-default" rendered="#{!DatasetPage.dataset.released}"/>
Expand Down Expand Up @@ -126,16 +127,24 @@


<!-- DOWNLOAD/ACCESS DATASET -->
<div class="btn-group btn-group-justified">
<div class="btn-group btn-group-justified" jsf:rendered="#{!DatasetPage.dataset.deaccessioned}">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
ACCESS DATASET <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right text-left">

<!-- DOWNLOAD -->
<ui:fragment rendered="#{true}">
<li class="disabled">
<span class="ui-commandlink ui-widget ui-state-disabled btn-download-placeholder">Download (Placeholder)</span>
</li>
</ui:fragment>
<!-- END: DOWNLOAD -->

<!-- EXPLORE -->
<!-- TO-DO, FIX RENDER LOGIC, ANALYTICS EVENT TRACKING -->
<ui:fragment rendered="#{!DatasetPage.dataset.deaccessioned}">
<ui:fragment rendered="#{true}">
<li class="#{DatasetPage.datasetExploreTools.size()>1 ? 'dropdown-submenu pull-left' : ''}">
<ui:fragment rendered="#{DatasetPage.datasetExploreTools.size()==1}">
<a tabindex="-1" href="#" class="btn-explore" onclick="$(this).parent().find( 'li > a' ).trigger( 'click' );">#{bundle.explore}</a>
Expand All @@ -160,7 +169,6 @@
<!-- COMPUTE -->
<!-- TO-DO, FIX RENDER LOGIC, ANALYTICS EVENT TRACKING -->
<ui:fragment rendered="#{DatasetPage.sessionUserAuthenticated
and !DatasetPage.dataset.deaccessioned
and DatasetPage.showComputeButton()}">
<li>
<a tabindex="-1" href="#" id="computeBatch" class="btn-compute">#{bundle['dataset.compute.computeBtn']}</a>
Expand Down Expand Up @@ -219,13 +227,14 @@
<!-- END: DOWNLOAD/ACCESS DATASET -->

<!-- PUBLISH DATASET -->
<div class="btn-group btn-group-justified" jsf:rendered="#{DatasetPage.workingVersion == DatasetPage.dataset.latestVersion
and permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset)
or (DatasetPage.dataset.latestVersion.versionState=='DRAFT'
and DatasetPage.canUpdateDataset()
and !permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset))}">
<div class="btn-group btn-group-justified"
jsf:rendered="#{DatasetPage.workingVersion == DatasetPage.dataset.latestVersion
and permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset)
or (DatasetPage.dataset.latestVersion.versionState=='DRAFT'
and DatasetPage.canUpdateDataset()
and !permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset))}">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
PUBLISH DATASET <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right text-left">
Expand Down Expand Up @@ -307,7 +316,7 @@
and !DatasetPage.dataset.deaccessioned}">

<div class="btn-group">
<button type="button" id="editDataSet" class="btn btn-default btn-access dropdown-toggle #{DatasetPage.lockedFromEdits ? 'disabled' : ''}" data-toggle="dropdown">
<button type="button" id="editDataSet" class="btn btn-default btn-access dropdown-toggle #{DatasetPage.lockedFromEdits ? 'disabled' : ''}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
#{bundle['dataset.editBtn']} DATASET <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right text-left">
Expand Down Expand Up @@ -365,23 +374,23 @@
</h:outputLink>
</li>
<ui:fragment rendered="#{!DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and permissionsWrapper.canIssueDeleteDatasetCommand(DatasetPage.dataset)}">
<li class="divider"></li>
<li role="separator" class="divider"></li>
<li>
<p:commandLink id="deleteDataset" onclick="PF('deleteConfirmation').show()">
<h:outputText value="#{bundle['dataset.editBtn.itemLabel.deleteDataset']}" />
</p:commandLink>
</li>
</ui:fragment>
<ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.dataset.latestVersion.versionState=='DRAFT' and permissionsWrapper.canIssueDeleteDatasetCommand(DatasetPage.dataset)}">
<li class="divider"></li>
<li role="separator" class="divider"></li>
<li>
<p:commandLink id="deleteVersion" onclick="PF('deleteVersionConfirmation').show()">
<h:outputText value="#{bundle['dataset.editBtn.itemLabel.deleteDraft']}" />
</p:commandLink>
</li>
</ui:fragment>
<ui:fragment rendered="#{DatasetPage.dataset.released and DatasetPage.existReleasedVersion and permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset)}">
<li class="divider"></li>
<li role="separator" class="divider"></li>
<li>
<p:commandLink id="deaccessionDatasetLink"
action="#{DatasetPage.clickDeaccessionDataset}"
Expand Down
23 changes: 15 additions & 8 deletions src/main/webapp/file-download-button-fragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
<h:commandLink rendered="#{!downloadPopupRequired}"
styleClass="#{(fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
disabled="#{(fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
action="#{fileDownloadService.startWorldMapDownloadLink(guestbookResponse, fileMetadata )}" target="_blank">
action="#{fileDownloadService.startWorldMapDownloadLink(guestbookResponse, fileMetadata )}"
target="_blank" rel="noopener">
#{bundle['file.mapData.worldMap']}
</h:commandLink>
<p:commandLink rendered="#{downloadPopupRequired}"
Expand Down Expand Up @@ -117,7 +118,8 @@
<h:commandLink rendered="#{!downloadPopupRequired}"
styleClass="#{(fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
disabled="#{(fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
action="#{fileDownloadService.startWorldMapDownloadLink(guestbookResponse, fileMetadata )}" target="_blank">
action="#{fileDownloadService.startWorldMapDownloadLink(guestbookResponse, fileMetadata )}"
target="_blank" rel="noopener">
#{bundle['file.mapData.worldMap']}
</h:commandLink>
<p:commandLink rendered="#{downloadPopupRequired}"
Expand All @@ -139,14 +141,18 @@

<!-- Compute Button *FILE PG only*: -->
<li jsf:rendered="#{isFilePg and FilePage.showComputeButton() and fileDownloadHelper.canDownloadFile(fileMetadata)}">
<h:outputLink value="#{FilePage.computeUrl}" styleClass="btn-compute" target="_blank">
<h:outputLink value="#{FilePage.computeUrl}" styleClass="btn-compute"
target="_blank" rel="noopener">
#{bundle['file.compute']}
</h:outputLink>
</li>
<!-- END: Compute Button *FILE PG only*: -->

<!-- Compute Button *DATASET PG only*: -->
<h:outputLink style="font-size:2em !important;" value="#{DatasetPage.getComputeUrl(fileMetadata)}" styleClass="btn-compute btn btn-link bootstrap-button-tooltip" title="#{bundle['file.compute']}" target="_blank" rendered="#{!isFilePg and DatasetPage.showComputeButton(fileMetadata) and fileDownloadHelper.canDownloadFile(fileMetadata)}">
<h:outputLink style="font-size:2em !important;" styleClass="btn-compute btn btn-link bootstrap-button-tooltip"
title="#{bundle['file.compute']}" value="#{DatasetPage.getComputeUrl(fileMetadata)}"
target="_blank" rel="noopener"
rendered="#{!isFilePg and DatasetPage.showComputeButton(fileMetadata) and fileDownloadHelper.canDownloadFile(fileMetadata)}">
<span class="glyphicon glyphicon-flash"/>
</h:outputLink>
<!-- END: Compute Button *DATASET PG only*: -->
Expand Down Expand Up @@ -542,11 +548,12 @@
<ui:fragment rendered="#{!isFilePg}">
<!-- DATASET PG -->

<!-- TODO - FIX UX INDICATOR YOUR REQUEST WAS SUBMITTED SINCE BTN LABEL IS NOW HIDDEN IN TITLE TOOLTIP -->
<!-- TODO - FIX UX INDICATOR YOUR REQUEST WAS SUBMITTED SINCE BTN LABEL IS NOW HIDDEN IN TITLE TOOLTIP
FIX, WITH CSS POINTER-EVENTS VS JQUERY WORKAROUND, BUT... PRIMEFACES COMMANDLINK DIASABLED EMPTY TITLE BUG ???? -->

<p:commandLink style="font-size:2em !important;" styleClass="btn-request btn btn-link bootstrap-button-tooltip" rendered="#{fileDownloadHelper.session.user.authenticated
and !requestAccessPopupRequired}"
title="#{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
title="EMPTY1 #{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
process="@this"
actionListener="#{fileDownloadHelper.requestAccess(fileMetadata.dataFile)}"
update="@this"
Expand All @@ -555,7 +562,7 @@
</p:commandLink>
<p:commandLink style="font-size:2em !important;" styleClass="btn-request btn btn-link bootstrap-button-tooltip" rendered="#{fileDownloadHelper.session.user.authenticated
and requestAccessPopupRequired}"
title="#{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
title="EMPTY2 #{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
process="@this"
actionListener="#{fileDownloadHelper.addFileForRequestAccess(fileMetadata.dataFile)}"
onclick="PF('requestAccessPopup').show()"
Expand All @@ -564,7 +571,7 @@
<span class="glyphicon glyphicon-bullhorn"/>
</p:commandLink>
<p:commandLink style="font-size:2em !important;" styleClass="btn-request btn btn-link bootstrap-button-tooltip" rendered="#{!fileDownloadHelper.session.user.authenticated}"
title="#{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
title="EMPTY3 #{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
process="@this"
onclick="PF('accessSignUpLogIn_popup').show()">
<!-- 4.2.1 - TODO: retest this on a dataset with fileRequest enabled and with some files restricted to the user -->
Expand Down
Loading

0 comments on commit b3e5952

Please sign in to comment.