New promote banner for newsletter

- new function that returns the url for old newsletter in the user
  language
- new image used in the banner
- new style for the newsletter banner and changes on the app promote
  banner
This commit is contained in:
E213872U 2025-04-25 13:02:11 +02:00
parent ee0d29a0e9
commit 192cfa6e89
5 changed files with 149 additions and 10 deletions

View file

@ -2734,6 +2734,17 @@ function get_newsletter_subscribe_base_url($language='en_UK')
return PHPWG_URL.'/announcement/subscribe/';
}
/**
* Get url on piwigo.org for old newsletters
*
* @param string $language (unused)
* @return string
*/
function get_old_newsletters_base_url($language='en_UK')
{
return PHPWG_URL.'/newsletter';
}
/**
* Return admin menu id for accordion.
*

View file

@ -104,6 +104,7 @@ if ($conf['show_newsletter_subscription'] and userprefs_get_param('show_newslett
array(
'EMAIL' => $user['email'],
'SUBSCRIBE_BASE_URL' => get_newsletter_subscribe_base_url($user['language']),
'OLD_NEWSLETTERS_URL' => get_old_newsletters_base_url($user['language']),
)
);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View file

@ -13,6 +13,7 @@ const storage_total = {$STORAGE_TOTAL};
const storage_details = {$STORAGE_CHART_DATA|json_encode};
const translate_files = "{'%d files'|translate|escape:javascript}";
let translate_type = {};
const newsletter_base_url = "{$SUBSCRIBE_BASE_URL}";
{literal}
jQuery().ready(function(){
jQuery('.cluetip').cluetip({
@ -42,10 +43,37 @@ jQuery().ready(function(){
}
});
{/if}
{if isset($SUBSCRIBE_BASE_URL)}
jQuery(".eiw").prepend(`
<div class="promote-newsletter">
<div class="promote-content">
<img class="promote-image" src="admin/themes/default/images/promote-newsletter.png">
<div class="promote-newsletter-content">
<span class="promote-newsletter-title">{"Subscribe to our newsletter and stay updated!"|@translate|escape:javascript}</span>
<div class="promote-content subscribe-newsletter">
<input type="text" id="newsletterSubscribeInput" value="{$EMAIL}" class="left-side">
<a href="{$SUBSCRIBE_BASE_URL}{$EMAIL}" id="newsletterSubscribeLink" class="right-side go-to-porg icon-thumbs-up">{"Sign up to the newsletter"|@translate|escape:javascript}</a>
</div>
<a href="{$OLD_NEWSLETTERS_URL}" class="promote-link">{"See previous newsletters"|@translate|escape:javascript}</a>
</div>
</div>
<a href="#" class="dont-show-again icon-cancel tiptip newsletter-hide" title="{'Understood, do not show again'|translate|escape:javascript}"></a>
</div>`);
{/if}
{literal}
jQuery('.newsletter-subscription a').click(function() {
jQuery('.newsletter-subscription').hide();
jQuery("#newsletterSubscribeInput").change(function(){
jQuery("#newsletterSubscribeLink").attr("href", newsletter_base_url + jQuery("#newsletterSubscribeInput").val())
})
jQuery('.promote-newsletter a').click(function() {
jQuery('.promote-newsletter').hide();
jQuery.ajax({
type: 'GET',
@ -247,7 +275,4 @@ translate_type['{$type_to_translate}'] = "{$type_to_translate|translate}";
{/if}
{if isset($SUBSCRIBE_BASE_URL)}
<br><span class="newsletter-subscription"><a href="{$SUBSCRIBE_BASE_URL}{$EMAIL}" id="newsletterSubscribe" class="externalLink cluetip icon-mail-alt" title="{'Piwigo Announcements Newsletter'|@translate}|{'Keep in touch with Piwigo project, subscribe to Piwigo Announcement Newsletter. You will receive emails when a new release is available (sometimes including a security bug fix, it\'s important to know and upgrade) and when major events happen to the project. Only a few emails a year.'|@translate|@htmlspecialchars|@nl2br}">{'Subscribe %s to Piwigo Announcements Newsletter'|@translate:$EMAIL}</a> <a href="#" class="newsletter-hide">{'... or hide this link'|translate}</a></span>
{/if}
</p>

View file

@ -7344,7 +7344,7 @@ color:#FF7B00;
color: black !important;
}
.promote-apps {
.promote-apps{
display: flex;
flex-direction: column;
justify-content: flex-end;
@ -7359,6 +7359,71 @@ color:#FF7B00;
box-shadow: 0px 5px 10px 5px rgba(0,0,0,0.1)
}
.promote-newsletter{
display: flex;
flex-direction: column;
justify-content: flex-end;
border-radius: 5px;
margin: 0 20px 15px 20px;
background: #f5d8b0;
position: relative;
box-shadow: 0px 5px 10px 5px rgba(0,0,0,0.1)
}
.promote-newsletter-content{
display: flex;
flex-direction: column;
justify-content: center;
flex: 2;
margin-left: 8.45%;
margin-right: 16.32%;
}
.promote-link {
color: #E18C32;
font-size: 15px;
margin-block: 3.5%;
font-weight: 700;
}
.promote-newsletter-title{
font-size: 24px;
font-weight: 700;
text-align: left;
margin-top: 3.5%;
margin-bottom: 1.75%;
color: #493C21;
}
.subscribe-newsletter{
font-size: 15px;
max-height: 17.5%;
display: flex;
gap: 4.64%;
margin-block: 1.75%;
}
.promote-image{
height: auto;
width: 25%;
object-fit: contain;
}
#newsletterSubscribeInput{
font-weight: 700;
background-color: #FFFFFF;
color: #000000;
padding-inline: 4%;
padding-block: 2%;
border-radius: 2px;
border-width: 2px;
border-color: #D3D3D3;
}
.close-apps {
padding: 1px;
margin-left: auto;
@ -7414,7 +7479,7 @@ color:#FF7B00;
flex-direction: column;
font-size: 30px;
font-weight: 700;
color: #000;
color: #493C21;
justify-content: center;
flex: 2;
}
@ -7432,11 +7497,11 @@ color:#FF7B00;
.go-to-porg {
cursor: pointer;
padding: 7px 14px;
font-size: 18px;
font-size: 15px;
font-weight: bold;
background-color: #ffa744;
max-width: 41.06%;
background-color: #f4ab4f;
color: #3c3c3c;
width: 150px;
text-align: center;
white-space: nowrap;
}
@ -7444,6 +7509,9 @@ color:#FF7B00;
.go-to-porg::before {
margin-right: 10px;
}
.go-to-porg:hover {
color: #3c3c3c;
}
.promote-content .right-side .promote-text {
display: flex;
@ -7619,6 +7687,40 @@ color:#FF7B00;
}
}
@media (max-width: 393px) {
.promote-content{
display: flex;
flex-direction: column;
justify-content: center;
gap: 15%;
flex: 2;
}
.promote-newsletter-content {
display: flex;
flex-direction: column;
justify-content: center;
flex: 2;
margin-inline: 3.8%;
}
.promote-image{
height: auto;
width: 77%;
object-fit: contain;
align-self: center;
}
.go-to-porg{
max-width: 100%;
margin-top: 5%;
}
.promote-link{
margin-block: 10%;
}
}
/* Css for whats new popin */
#whats_new{
display: none;