Skip to content

Commit

Permalink
Fix checksum flashing and rebinding issues on download, search [ref #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mheppler committed Jan 29, 2021
1 parent 814c005 commit 89023ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/main/webapp/file-info-fragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@
</div>
<!-- CHECKSUM -->
<div class="checksum-block" jsf:rendered="#{!fileMetadata.dataFile.tabularData and !(empty fileMetadata.dataFile.checksumValue)}">
#{fileMetadata.dataFile.checksumType}: <span class="#{!editDatafilesPage ? 'checksum-truncate' : ''}"
#{fileMetadata.dataFile.checksumType}:
<span class="sr-only #{!editDatafilesPage ? 'checksum-truncate' : ''}"
data-clipboard-action="copy"
data-clipboard-text="#{fileMetadata.dataFile.checksumValue}"
title="#{bundle['file.metaData.checksum.copy']} #{fileMetadata.dataFile.checksumValue}">#{fileMetadata.dataFile.checksumValue}</span>
<span class="glyphicon glyphicon-copy btn-copy" data-clipboard-action="copy"
data-clipboard-text="#{fileMetadata.dataFile.checksumValue}" title="#{bundle['file.metaData.checksum.copy']} #{fileMetadata.dataFile.checksumValue}"></span>
</div>
<!-- TABULAR VARIABLES, OBSERVATIONS + UNF -->
<div class="unf-block" jsf:rendered="#{fileMetadata.dataFile.tabularData}">
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/filesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@
<f:passThroughAttribute name="aria-labelledby" value="searchLabel"/>
</p:inputText>
<p:watermark for="searchFiles" value="#{bundle['file.search.placeholder']}"/>
<p:remoteCommand name="submitsearch" action="#{DatasetPage.updateFileSearch()}" process="@this @widgetVar(inputSearchTerm)" update="@form" partialSubmit="true"/>
<p:remoteCommand name="submitsearch" action="#{DatasetPage.updateFileSearch()}" process="@this @widgetVar(inputSearchTerm)" update="@form" oncomplete="bind_bsui_components();" partialSubmit="true"/>

<span class="input-group-btn">
<p:commandLink styleClass="btn btn-default" action="#{DatasetPage.updateFileSearch()}" process="@this @widgetVar(inputSearchTerm)" update="@form" partialSubmit="true">
<p:commandLink styleClass="btn btn-default" action="#{DatasetPage.updateFileSearch()}" process="@this @widgetVar(inputSearchTerm)" update="@form" oncomplete="bind_bsui_components();" partialSubmit="true">
<span class="glyphicon glyphicon-search"></span> #{bundle['dataverse.search.btn.find']}
</p:commandLink>
</span>
Expand Down Expand Up @@ -320,14 +320,14 @@
</h:outputFormat>
<ui:fragment rendered="#{DatasetPage.selectedFiles.size() lt DatasetPage.workingVersion.fileMetadatas.size()}">
&#160;
<p:commandLink action="#{DatasetPage.selectAllFiles}" update="@form">
<p:commandLink action="#{DatasetPage.selectAllFiles}" update="@form" oncomplete="bind_bsui_components();">
<h:outputFormat value="#{bundle['file.selectAllFiles']}">
<f:param value="#{DatasetPage.fileMetadatasSearch.size()}"/>
</h:outputFormat>
</p:commandLink>
</ui:fragment>
&#160;
<p:commandLink value="#{bundle['file.clearSelection']}" action="#{DatasetPage.clearSelection}" update="@form"/>
<p:commandLink value="#{bundle['file.clearSelection']}" action="#{DatasetPage.clearSelection}" update="@form" oncomplete="bind_bsui_components();"/>
</p>
</div>
</div>
Expand Down
7 changes: 2 additions & 5 deletions src/main/webapp/resources/js/dv_rebind_bootstrap_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function bind_bsui_components(){
}

// clipboard.js copy btn
var clipboard = new ClipboardJS('button.btn-copy, span.checksum-truncate');
var clipboard = new ClipboardJS('button.btn-copy, span.btn-copy, span.checksum-truncate');

clipboard.on('success', function (e) {
// DEV TOOL DEBUG
Expand Down Expand Up @@ -171,6 +171,7 @@ function sharrre(){
*/
function checksumTruncate(){
$('span.checksum-truncate').each(function () {
$(this).toggleClass('sr-only').toggleClass('visisble');
var checksumText = $(this).text();
if (checksumText.length > 25) {
// COUNT ":" IN UNF VERSION LABEL
Expand All @@ -187,10 +188,6 @@ function checksumTruncate(){
$(this).text(checksumText.substr(0, 3) + '...' + checksumText.substr((checksumText.length - 3), checksumText.length));
}
}
// ADD CLIPBOARD ICON
$(this).append(' <span class="glyphicon glyphicon-copy"></span>');

// COPY TO CLIPBOARD MOVE TO bind_bsui_components() ABOVE
});
}

Expand Down

0 comments on commit 89023ba

Please sign in to comment.