Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2323 focus is not visible over linking banner #2599

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@
import javax.inject.Named;
import java.io.IOException;
import java.util.List;
import java.util.logging.Logger;

/**
* Responsible for displaying messages and banners across the dataverse.
*/
@SuppressWarnings("serial")
@ViewScoped
@Named("MessagesAndBannersFragment")
public class MessagesAndBannersFragment implements java.io.Serializable {

private static final Logger logger = Logger.getLogger(MessagesAndBannersFragment.class.getCanonicalName());

@EJB
private DataverseTextMessageServiceBean textMessageService;

Expand All @@ -34,17 +32,19 @@ public class MessagesAndBannersFragment implements java.io.Serializable {


public List<String> textMessages(Long dataverseId) {
return textMessageService.getTextMessagesForDataverse(dataverseId, dataverseSession.getLocaleCode());
return textMessageService.getTextMessagesForDataverse(dataverseId,
dataverseSession.getLocaleCode());
}

public List<ImageWithLinkDto> banners(Long dataverseId) {
return bannerDAO.getBannersForDataverse(dataverseId, dataverseSession.getLocaleCode());
return bannerDAO.getBannersForDataverse(dataverseId,
dataverseSession.getLocaleCode());
}

public void redirect(String link) throws IOException {

if (!link.startsWith("http")) {
link = "http://" + link;
link = "http://".concat(link);
}
FacesContext.getCurrentInstance().getExternalContext().redirect(link);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public List<String> getTextMessagesForDataverse(Long dataverseId, String localeC
public List<DataverseTextMessage> fetchAllTextMessagesForDataverse(long dataverseId) {
return em.createQuery("select dtm FROM DataverseTextMessage as dtm " +
"join fetch DataverseLocalizedMessage " +
"where dtm.dataverse.id = :dataverseid")
"where dtm.dataverse.id = :dataverseid",
DataverseTextMessage.class)
.setParameter("dataverseid", dataverseId)
.getResultList();
}
Expand All @@ -136,7 +137,8 @@ public List<DataverseTextMessage> fetchAllTextMessagesForDataverse(long datavers
public List<DataverseTextMessage> fetchTextMessagesForDataverseWithPaging(long dataverseId, int firstResult, int maxResult) {
return em.createQuery("select dtm FROM DataverseTextMessage as dtm " +
"join fetch DataverseLocalizedMessage " +
"where dtm.dataverse.id = :dataverseid order by dtm.id DESC ")
"where dtm.dataverse.id = :dataverseid order by dtm.id DESC ",
DataverseTextMessage.class)
.setParameter("dataverseid", dataverseId)
.setFirstResult(firstResult)
.setMaxResults(maxResult)
Expand Down
10 changes: 7 additions & 3 deletions dataverse-webapp/src/main/webapp/text-messagesAndBanners.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">

<!--@elvariable id="dataverse" type="edu.harvard.iq.dataverse.persistence.dataverse.Dataverse"-->
<c:set var="messages" value="#{MessagesAndBannersFragment.textMessages(dataverse.id)}"/>
Expand All @@ -19,8 +20,11 @@

<ui:repeat value="#{banners}" var="banner">
<div class="p-col">
<h:commandLink target="_blank" disabled="#{banner.link == null}" action="#{MessagesAndBannersFragment.redirect(banner.link)}">
<p:graphicImage style="display: block ;margin-left: auto; margin-right: auto; padding: 2px;"
<h:commandLink style="display: block;"
target="_blank"
disabled="#{banner.link == null}"
action="#{MessagesAndBannersFragment.redirect(banner.link)}">
<p:graphicImage style="display: block ;margin-left: auto; margin-right: auto; padding: 2px;"
stream="false"
value="#{banner.image}"
alt="#{bundle['header.banner.alt']} #{banner.link != null ? bundle['opensInNewTab'] : ''}"
Expand Down
Loading