Skip to content

Commit

Permalink
Addition of the twitter card for each sponsor/speaker.
Browse files Browse the repository at this point in the history
Adjustement of the Sponsor image in the good sizes.
  • Loading branch information
bastaille committed Jun 27, 2024
1 parent 4d66b8a commit 27c92f5
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 69 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<renarde.version>3.0.16</renarde.version>
<web-bundler.version>1.6.0</web-bundler.version>
<ngrok.version>1.5.1</ngrok.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -45,6 +46,11 @@
<artifactId>quarkus-renarde-backoffice</artifactId>
<version>${renarde.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.renarde</groupId>
<artifactId>quarkus-renarde-pdf</artifactId>
<version>${renarde.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.renarde</groupId>
<artifactId>quarkus-renarde-transporter</artifactId>
Expand All @@ -55,6 +61,11 @@
<artifactId>quarkus-web-bundler</artifactId>
<version>${web-bundler.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.ngrok</groupId>
<artifactId>quarkus-ngrok</artifactId>
<version>${ngrok.version}</version>
</dependency>
<!-- For Java2D image processing -->
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
25 changes: 23 additions & 2 deletions src/main/java/rest/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.jboss.resteasy.reactive.RestQuery;
import org.jboss.resteasy.reactive.common.jaxrs.AbstractResponseBuilder;

import io.quarkiverse.renarde.pdf.Pdf;
import io.quarkiverse.renarde.security.ControllerWithUser;
import io.quarkiverse.renarde.util.FileUtils;
import io.quarkus.qute.CheckedTemplate;
Expand All @@ -24,6 +25,7 @@
import jakarta.transaction.Transactional;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Request;
import jakarta.ws.rs.core.Response;
Expand Down Expand Up @@ -504,17 +506,36 @@ public TemplateInstance schools() {
}

@Path("/speaker-banner")
public TemplateInstance speakerBanner(@RestPath Long id) {
public TemplateInstance speakerBanner(@RestPath Long id, @RestPath String language) {
Speaker speaker = Speaker.findById(id);
notFoundIfNull(speaker);
i18n.setForCurrentRequest(language);
return Templates.speakerBanner(speaker);
}

@Produces(Pdf.IMAGE_PNG)
@Path("/speaker-banner/{id}/{language}.png")
public TemplateInstance speakerBannerImage(@RestPath Long id, @RestPath String language) {
Speaker speaker = Speaker.findById(id);
notFoundIfNull(speaker);
i18n.setForCurrentRequest(language);
return Templates.speakerBanner(speaker);
}

@Path("/sponsor-banner")
public TemplateInstance sponsorBanner(@RestPath Long id) {
public TemplateInstance sponsorBanner(@RestPath Long id, @RestPath String language) {
Sponsor sponsor = Sponsor.findById(id);
notFoundIfNull(sponsor);
i18n.setForCurrentRequest(language);
return Templates.sponsorBanner(sponsor);
}

@Produces(Pdf.IMAGE_PNG)
@Path("/sponsor-banner/{id}/{language}.png")
public TemplateInstance sponsorBannerImage(@RestPath Long id, @RestPath String language) {
Sponsor sponsor = Sponsor.findById(id);
notFoundIfNull(sponsor);
i18n.setForCurrentRequest(language);
return Templates.sponsorBanner(sponsor);
}

Expand Down
14 changes: 14 additions & 0 deletions src/main/resources/templates/Application/speaker.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{#include main.html}
{#title}{speaker} - {m:views.application.speaker.title}{/title}
{#twitterCard}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@RivieraDEV" />
<meta name="twitter:title" content="Riviera DEV" />
<meta
name="twitter:description"
content="{speaker.firstName} {speaker.lastName}"
/>
<meta
name="twitter:image"
content="{uriabs:Application.speakerBannerImage(speaker.id, 'en')}"
/>
<meta name="twitter:image:alt" content="Riviera DEV" />
{/twitterCard}

<div class="page__header speakers__header">
<h1 class="page__mainTitle">{m:views.application.speaker.title}</h1>
Expand Down
84 changes: 47 additions & 37 deletions src/main/resources/templates/Application/speakerBanner.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<!DOCTYPE html PUBLIC
"-//OPENHTMLTOPDF//DOC XHTML Character Entities Only 1.0//EN" "">
<html>
<head>
<style>
@font-face {
font-family: 'Interstate Regular';
font-style: normal;
font-weight: normal;
src: local('Interstate Regular'), url('/static/fonts/InterstateRegular.woff') format('woff');
src: local('Interstate Regular'), url('/static/fonts/InterstateRegular.ttf') format('truetype');
}
@font-face {
font-family: 'Interstate Light';
font-style: normal;
font-weight: normal;
src: local('Interstate Light'), url('/static/fonts/InterstateLight.woff') format('woff');
src: local('Interstate Light'), url('/static/fonts/InterstateLight.ttf') format('truetype');
}
@font-face {
font-family: 'Interstate Bold';
font-style: normal;
font-weight: normal;
src: local('Interstate Bold'), url('/static/fonts/InterstateBold.woff') format('woff');
src: local('Interstate Bold'), url('/static/fonts/InterstateBold.ttf') format('truetype');
}

#name, #compagny {
Expand All @@ -26,41 +28,41 @@
}
#name {
color: #474743;
top: 322px;
left: 250px;
top: 316px;
left: 242px;
font-family: "Interstate Regular";
font-size: 21;
font-size: 21px;
text-align: center;
width: 400px;
}
#compagny {
color: #474743;
top: 345px;
left: 250px;
font-family: "Interstate bold";
top: 337px;
left: 242px;
font-family: "Interstate Bold";
text-align: center;
font-size: 16;
font-size: 16px;
width: 400px;
}
#permanent_text_1 {
position: absolute;
z-index: 1;
color: white;
top: 123px;
left: 55px;
font-size: 23;
font-family: "Interstate light";
width: 400;
top: 115px;
left: 47px;
font-size: 23px;
font-family: "Interstate Light";
width: 400px;
text-align: center;
}
#permanent_text_2 {
position: absolute;
z-index: 1;
color: white;
top: 183px;
left: 721px;
font-size: 20;
font-family: "Interstate bold";
top: 175px;
left: 713px;
font-size: 20px;
font-family: "Interstate Bold";
}
#orange {
color: #fdc43f;
Expand All @@ -69,50 +71,58 @@
position: absolute;
z-index: 1;
color: white;
top: 229px;
left: 721px;
font-size: 21;
font-family: "Interstate light";
top: 221px;
left: 713px;
font-size: 21px;
font-family: "Interstate Light";
}
#site_name {
position: absolute;
z-index: 1;
color: white;
top: 322px;
left: 721px;
font-size: 23;
font-family: "Interstate bold";
top: 314px;
left: 705px;
font-size: 23px;
font-family: "Interstate Bold";
}
.personSummary__photo {
width: 130;
height: 133;
width: 130px;
height: 133px;
border-radius: 150px;
background-size: cover;
position: absolute;
top: 179px;
left: 387px;
top: 171px;
left: 379px;
}
.talks_type {
z-index: 1;
font-family: 'Interstate bold';
font-family: 'Interstate Bold';
color: #fdc43f;
text-align: center;
width: 400px;
}
#program {
position: absolute;
z-index: 1;
font-family: 'Interstate light';
font-family: 'Interstate Light';
color: #474743;
top: 366px;
left: 250;
top: 358px;
left: 242px;
text-align: center;
width: 400px;
}
#citation_1,#citation_2 {
color:#fdc43f;
z-index: 1;
font-family: 'Interstate bold';
font-family: 'Interstate Bold';
}
@page {
size: 1032px 516px;
margin: 0px;
padding: 0px;
}
body {
margin: 0px;
}
</style>
</head>
Expand All @@ -131,7 +141,7 @@
<div id="program">
{#for talk in speaker.talks}
<div class="talks_type">{talk.type}: </div>
<div><span id="citation_1">« </span> {talk.title} <span id="citation_2">»</span></div>
<div><span id="citation_1">«</span>&nbsp;{talk.title}&nbsp;<span id="citation_2">»</span></div>
{/for}
</div>
<img src="/static/images/Speakers-banner-notext.png"/>
Expand Down
14 changes: 14 additions & 0 deletions src/main/resources/templates/Application/sponsor.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{#include main.html}
{#title}{sponsor.company} - {m:views.application.sponsor.title}{/title}
{#twitterCard}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@RivieraDEV" />
<meta name="twitter:title" content="Riviera DEV" />
<meta
name="twitter:description"
content="{sponsor.company}"
/>
<meta
name="twitter:image"
content="{uriabs:Application.sponsorBannerImage(sponsor.id, 'en')}"
/>
<meta name="twitter:image:alt" content="Riviera DEV" />
{/twitterCard}

<div class="page__header partenaireDetails__headerPage">
<h1 class="page__mainTitle">{m:views.application.sponsor.title}</h1>
Expand Down
Loading

0 comments on commit 27c92f5

Please sign in to comment.