adapted getEventViewAction to new attribute 'sailorsInfoWebsiteURL'...

adding the locale to the link requires still a special solution
This commit is contained in:
fmittag committed 2015-07-10 17:48:32 +02:00
1 parent 5ffe2a4eca
commit f84b7e8773
3 files changed
+15 -9

No files matched your search

@@ -58,7 +58,7 @@ public class TabletAndDesktopEventView extends Composite implements EventMultire
initBreadCrumbs(); initBreadCrumbs();
String sailorsInfoURL = currentPresenter.getCtx().getEventDTO().getSailorsInfoURL(); String sailorsInfoURL = currentPresenter.getCtx().getEventDTO().getSailorsInfoWebsiteURL();
if(sailorsInfoURL != null && ! sailorsInfoURL.isEmpty()) { if(sailorsInfoURL != null && ! sailorsInfoURL.isEmpty()) {
Label label = new Label(); Label label = new Label();
label.getElement().setInnerHTML(i18n.sailorInfoLongText().replace("\n", "<br />")); label.getElement().setInnerHTML(i18n.sailorInfoLongText().replace("\n", "<br />"));
@@ -52,6 +52,7 @@ public class GetEventViewAction implements Action<EventViewDTO> {
ImageDescriptor logoImage = event.findImageWithTag(MediaTagConstants.LOGO); ImageDescriptor logoImage = event.findImageWithTag(MediaTagConstants.LOGO);
dto.setLogoImage(logoImage != null ? HomeServiceUtil.convertToImageDTO(logoImage) : null); dto.setLogoImage(logoImage != null ? HomeServiceUtil.convertToImageDTO(logoImage) : null);
dto.setOfficialWebsiteURL(event.getOfficialWebsiteURL() == null ? null : event.getOfficialWebsiteURL().toString()); dto.setOfficialWebsiteURL(event.getOfficialWebsiteURL() == null ? null : event.getOfficialWebsiteURL().toString());
dto.setSailorsInfoWebsiteURL(event.getSailorsInfoWebsiteURL() == null ? null : event.getSailorsInfoWebsiteURL().toString());
dto.setHasMedia(HomeServiceUtil.hasMedia(event)); dto.setHasMedia(HomeServiceUtil.hasMedia(event));
dto.setState(HomeServiceUtil.calculateEventState(event)); dto.setState(HomeServiceUtil.calculateEventState(event));
@@ -118,9 +119,14 @@ public class GetEventViewAction implements Action<EventViewDTO> {
dto.setType(dto.getRegattas().size() == 1 ? EventType.SINGLE_REGATTA: EventType.MULTI_REGATTA); dto.setType(dto.getRegattas().size() == 1 ? EventType.SINGLE_REGATTA: EventType.MULTI_REGATTA);
} }
// Special solution for Kieler Woche 2015 // Special solution for localization of SailorsInfo URL
if("a9d6c5d5-cac3-47f2-9b5c-506e441819a1".equals(event.getId().toString())) { if(dto.getSailorsInfoWebsiteURL() != null && !Locale.GERMAN.equals(context.getClientLocale())) {
dto.setSailorsInfoURL(Locale.GERMAN.equals(context.getClientLocale()) ? "http://sailorsinfo.kieler-woche.de/" : "http://sailorsinfo.kieler-woche.de/en"); String localizedURL = dto.getSailorsInfoWebsiteURL();
if(!localizedURL.endsWith("/")) {
localizedURL += "/";
}
localizedURL += "en";
dto.setSailorsInfoWebsiteURL(localizedURL);
} }
return dto; return dto;
@@ -23,7 +23,7 @@ public class EventViewDTO extends EventMetadataDTO implements Result {
private String seriesName; private String seriesName;
private ImageDTO logoImage; private ImageDTO logoImage;
private String officialWebsiteURL; private String officialWebsiteURL;
private String sailorsInfoURL; private String sailorsInfoWebsiteURL;
public EventViewDTO() { public EventViewDTO() {
} }
@@ -105,11 +105,11 @@ public class EventViewDTO extends EventMetadataDTO implements Result {
return officialWebsiteURL; return officialWebsiteURL;
} }
public String getSailorsInfoURL() { public String getSailorsInfoWebsiteURL() {
return sailorsInfoURL; return sailorsInfoWebsiteURL;
} }
public void setSailorsInfoURL(String sailorsInfoURL) { public void setSailorsInfoWebsiteURL(String sailorsInfoWebsiteURL) {
this.sailorsInfoURL = sailorsInfoURL; this.sailorsInfoWebsiteURL = sailorsInfoWebsiteURL;
} }
} }