Skip to content

Commit

Permalink
DD-525 add short description (#101)
Browse files Browse the repository at this point in the history
* added license shortDescription, and UI shortDescription to publish dialog

* fixed issue, shortdescription was not saving when updating license

* compilation check fix

* added short description tooltip for license url & image
  • Loading branch information
mderuijter authored Jul 14, 2021
1 parent fd21968 commit 4518fd6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public License save(License license) throws RequestBodyException, ConflictExcept
return license;
}

public void setById(long id, String name, URI uri, URI iconUrl, boolean active) throws UpdateException {
public void setById(long id, String name, String shortDescription, URI uri, URI iconUrl, boolean active) throws UpdateException {
List<License> licenses = em.createNamedQuery("License.findById", License.class)
.setParameter("id", id )
.getResultList();

if(licenses.size() > 0) {
License license = licenses.get(0);
license.setName(name);
license.setShortDescription(shortDescription);
license.setUri(uri);
license.setIconUrl(iconUrl);
license.setActive(active);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/harvard/iq/dataverse/api/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ public Response setDefault(long id) {
@Path("/licenses/{id}")
public Response putLicenseById(@PathParam("id") long id, License license) {
try {
licenseService.setById(id, license.getName(), license.getUri(), license.getIconUrl(), license.isActive());
licenseService.setById(id, license.getName(), license.getShortDescription(), license.getUri(), license.getIconUrl(), license.isActive());
} catch (UpdateException e) {
return error(Response.Status.BAD_REQUEST, e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ public static JsonObjectBuilder json(License license) {
return jsonObjectBuilder()
.add("id", license.getId())
.add("name", license.getName())
.add("shortDescription", license.getShortDescription())
.add("uri", license.getUri().toString())
.add("iconUrl", license.getIconUrl().toString())
.add("active", license.isActive());
Expand Down
11 changes: 6 additions & 5 deletions src/main/webapp/dataset-license-terms.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@
</ui:fragment>
<ui:fragment rendered="#{!empty termsOfUseAndAccess.license and empty DatasetPage.licenseId and empty editMode}">
<p>
<img src="#{termsOfUseAndAccess.license.iconUrl}" alt="#{bundle['file.icon.alttxt']}" />
<a href="#{termsOfUseAndAccess.license.uri}" target="_blank">#{termsOfUseAndAccess.license.name}</a>
<img src="#{termsOfUseAndAccess.license.iconUrl}" title="#{termsOfUseAndAccess.license.shortDescription}" alt="#{bundle['file.icon.alttxt']}" style="max-width:90px;width:100%;max-height:30px;height:100%" />
<a href="#{termsOfUseAndAccess.license.uri}" title="#{termsOfUseAndAccess.license.shortDescription}" target="_blank">#{termsOfUseAndAccess.license.name}</a>
</p>

</ui:fragment>
<ui:fragment rendered="#{!empty DatasetPage.licenseId}">
<p >
<img src="#{DatasetPage.getSelectedLicenseById().iconUrl}" alt="#{bundle['file.icon.alttxt']}"/>
<a href="#{DatasetPage.getSelectedLicenseById().uri}" target="_blank">#{DatasetPage.getSelectedLicenseById().name}</a>
<p>
<img src="#{DatasetPage.getSelectedLicenseById().iconUrl}" title="#{DatasetPage.getSelectedLicenseById().shortDescription}" alt="#{bundle['file.icon.alttxt']}" style="max-width:90px;width:100%;max-height:30px;height:100%" />
<a href="#{DatasetPage.getSelectedLicenseById().uri}" title="#{DatasetPage.getSelectedLicenseById().shortDescription}" target="_blank">#{DatasetPage.getSelectedLicenseById().name}</a>
</p>
</ui:fragment>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@
<td>
<ui:fragment rendered="#{!empty DatasetPage.workingVersion.termsOfUseAndAccess.license}">
<p>
<img src="#{DatasetPage.workingVersion.termsOfUseAndAccess.license.iconUrl}" alt="#{bundle['file.icon.alttxt']}" />
<a href="#{DatasetPage.workingVersion.termsOfUseAndAccess.license.uri}" target="_blank">#{DatasetPage.workingVersion.termsOfUseAndAccess.license.name}</a>
<img src="#{DatasetPage.workingVersion.termsOfUseAndAccess.license.iconUrl}" title="#{DatasetPage.workingVersion.termsOfUseAndAccess.license.shortDescription}" alt="#{bundle['file.icon.alttxt']}" style="max-width:90px;width:100%;max-height:30px;height:100%" />
<a href="#{DatasetPage.workingVersion.termsOfUseAndAccess.license.uri}" title="#{DatasetPage.workingVersion.termsOfUseAndAccess.license.shortDescription}" target="_blank">#{DatasetPage.workingVersion.termsOfUseAndAccess.license.name}</a>
</p>
</ui:fragment>
<ui:fragment rendered="#{empty DatasetPage.workingVersion.termsOfUseAndAccess.license}">
Expand Down

0 comments on commit 4518fd6

Please sign in to comment.