Redo newsletter CSS

This commit is contained in:
JonnyWong16 2018-01-11 00:38:36 -08:00
parent a13d93f239
commit 4577704f19
11 changed files with 1561 additions and 728 deletions

View file

@ -443,6 +443,7 @@
}
function sendTestNewsletter() {
showMsg('<i class="fa fa-refresh fa-spin"></i>&nbsp; Generating Newsletter', false);
$.ajax({
url: 'send_newsletter',
data: {

View file

@ -750,6 +750,7 @@
});
function sendTestNotification() {
showMsg('<i class="fa fa-refresh fa-spin"></i>&nbsp; Sending Notification', false);
if ('${notifier["agent_name"]}' !== 'browser') {
$.ajax({
url: 'send_notification',

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,883 @@
<% from notification_handler import PILLOW %>
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Tautulli ${title} Newsletter</title>
<style>
/* -------------------------------------
GLOBAL RESETS
------------------------------------- */
img {
border: none;
-ms-interpolation-mode: bicubic;
max-width: 100%;
}
body {
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-collapse: separate;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
width: 100%;
}
table td {
font-family: sans-serif;
font-size: 14px;
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
.body {
width: 100%;
}
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display: block;
margin: 0 auto !important;
/* makes it centered */
max-width: 1046px;
padding: 10px;
width: 1046px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
margin: 0 auto;
max-width: 1046px;
padding: 10px;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #282A2D;
border-radius: 3px;
width: 100%;
color: #ffffff;
}
.wrapper {
box-sizing: border-box;
padding: 5px;
overflow: auto;
}
.content-block {
padding-bottom: 10px;
padding-top: 10px;
}
.footer {
clear: both;
margin-top: 10px;
text-align: center;
width: 100%;
font-size: 12px;
}
.footer-bar {
margin-left: auto;
margin-right: auto;
width: 200px;
border-top: 1px solid #E5A00D;
}
.footer td,
.footer p,
.footer span,
.footer a {
color: #fff;
font-size: 12px;
text-align: center;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,
h2,
h3,
h4 {
color: #ffffff;
font-family: sans-serif;
font-weight: 400;
margin: 0;
}
p,
ul,
ol {
font-family: sans-serif;
font-size: 14px;
font-weight: 400;
margin: 0;
margin-bottom: 15px;
}
p li,
ul li,
ol li {
list-style-position: inside;
margin-left: 5px;
}
a {
color: #3498db;
text-decoration: underline;
}
/* -------------------------------------
BUTTONS
------------------------------------- */
.btn {
box-sizing: border-box;
width: 100%;
}
.btn > tbody > tr > td {
padding-bottom: 15px;
}
.btn table {
width: auto;
}
.btn table td {
background-color: #ffffff;
border-radius: 5px;
text-align: center;
}
.btn a {
background-color: #ffffff;
border: solid 1px #3498db;
border-radius: 5px;
box-sizing: border-box;
color: #3498db;
cursor: pointer;
display: inline-block;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 12px 25px;
text-decoration: none;
text-transform: capitalize;
}
.btn-primary table td {
background-color: #3498db;
}
.btn-primary a {
background-color: #3498db;
border-color: #3498db;
color: #ffffff;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.clear {
clear: both;
}
.mt0 {
margin-top: 0;
}
.mb0 {
margin-bottom: 0;
}
.mb5 {
margin-bottom: 5px;
}
.nowrap {
white-space: nowrap;
}
.preheader {
color: transparent;
display: none;
height: 0;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
mso-hide: all;
visibility: hidden;
width: 0;
}
.powered-by a {
text-decoration: underline;
}
/* -------------------------------------
HEADER
------------------------------------- */
.header {
background: url(https://i.imgur.com/oqMQJxp.png) no-repeat;
background-position: calc(50% - 20px) 50%;
background-size: contain;
width: 100%;
height: 100px;
}
.dates {
font-size: 20px;
text-align: center;
}
/* -------------------------------------
MEDIA SECTIONS
------------------------------------- */
h2 {
font-size: 30px;
font-weight: 300;
margin: 20px 10px 0 10px;
text-align: center;
}
h3 {
font-size: 25px;
font-weight: 300;
margin: 0 0 10px 0;
}
img.sub-header-icon {
height: 30px;
vertical-align: middle;
margin-right: 5px;
margin-bottom: 5px;
}
.sub-header > div {
margin-left: auto;
margin-right: auto;
font-size: 30px;
text-align: center;
}
.sub-header-bar {
width: 200px;
border-top: 1px solid #E5A00D;
margin-bottom: 15px;
}
.sub-header-title {
font-weight: lighter;
}
.sub-header-count .count {
color: #E9A049;
}
.sub-header-count .count-units {
color: #aaaaaa;
font-size: 20px;
text-transform: uppercase;
}
/* -------------------------------------
MEDIA CARDS
------------------------------------- */
.card-instance {
float: left;
width: 500px;
margin: 3px;
border: 1px solid rgba(255,255,255,.1);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
font-size: 12px;
overflow: hidden;
position: relative;
}
.card-instance.movie,
.card-instance.show {
height: 235px;
}
.card-instance.album {
height: 160px;
}
.card-instance.odd {
float: none !important;
margin: 3px auto !important;
}
.card-background {
background-color: #3F4245;
background-position: center;
background-size: cover;
width: 100%;
height: 100%;
}
.card-background-preview {
background-color: #3F4245;
background-position: center;
background-size: cover;
opacity: 0.40;
-webkit-filter: blur(3px);
filter: blur(3px);
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
}
.card-poster-container {
width: 150px;
margin: 3px;
border: 1px solid rgba(255,255,255,.1);
float: left;
position: relative;
z-index: 1;
}
.card-instance.movie .card-poster-container,
.card-instance.show .card-poster-container{
height: 225px;
}
.card-instance.album .card-poster-container {
height: 150px;
}
.card-poster {
background-color: #3F4245;
background-position: center;
background-size: cover;
height: 100%;
width: 100%;
}
.card-poster-overlay {
background: rgba(0, 0, 0, 0.75) url(http://tautulli.com/images/plex-logo-reversed-flat-transparent.png) center no-repeat;
background-size: 80px;
width: 100%;
height: 100%;
border: 3px solid #E9A049;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: none;
}
.card-info-container {
margin: 4px;
width: 332px;
float: left;
position: relative;
z-index: 1;
}
.card-instance.movie .card-info-container,
.card-instance.show .card-info-container{
height: 225px;
}
.card-instance.album .card-info-container {
height: 150px;
}
.card-info-container > div {
padding: 5px;
text-overflow: ellipsis;
overflow: hidden;
}
.card-info-title {
border-bottom: 1px solid rgba(255, 255, 255, .1);
line-height: 20px;
font-size: 15px;
}
.card-info-title a {
text-decoration: none;
color: #ffffff;
}
.card-info-body > div {
color: #ffffff;
font-size: 12px;
text-overflow: ellipsis;
overflow: hidden;
}
.card-instance.movie .card-info-body,
.card-instance.show .card-info-body {
min-height: 157px;
}
.card-instance.album .card-info-body {
min-height: 82px;
}
.card-info-footer {
font-size: 10px;
}
.card-info-footer .star-rating {
width: 60px;
font-size: 14px;
line-height: 17px;
float: right;
}
.star-rating-full {
color: #E9A049;
direction: ltr;
padding: 0;
overflow: hidden;
float: left;
}
.star-rating-empty {
color: #aaaaaa;
direction: rtl;
padding: 0;
overflow: hidden;
float: left;
}
.star-rating span {
display: inline-block;
text-align: center;
width: 12px;
}
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 11px;
font-style: normal;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: middle;
background-color: rgba(0, 0, 0, .25);
border-radius: 2px;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 620px) {
table[class=body] .header {
background-position: center !important;
}
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] .dates {
font-size: 16px !important;
}
table[class=body] .sub-header > div {
font-size: 20px !important;
}
table[class=body] .sub-header-title {
font-size: 20px !important;
}
table[class=body] img.sub-header-icon {
height: 20px !important;
}
table[class=body] .count {
font-size: 20px !important;
}
table[class=body] .count-units {
font-size: 14px !important;
}
table[class=body] .card-instance {
margin: 3px auto;
float: none;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
}
/* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */
@media all {
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.apple-link a {
color: inherit !important;
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
text-decoration: none !important;
}
.btn-primary table td:hover {
background-color: #34495e !important;
}
.btn-primary a:hover {
background-color: #34495e !important;
border-color: #34495e !important;
}
}
</style>
</head>
<body class="">
<table border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td class="container">
<div class="content">
<!-- START CENTERED WHITE CONTAINER -->
<span class="preheader">Tautulli ${title} Newsletter (${parameters['start_date']} - ${parameters['end_date']})</span>
<table border="0" cellpadding="0" cellspacing="0" class="main">
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper newsletter-header">
<div class="header"></div>
<div class="dates">${parameters['start_date']} - ${parameters['end_date']}</div>
</td>
</tr>
<tr>
<td>
% if recently_added.get('movie'):
<div class="wrapper">
<div class="sub-header">
<div class="sub-header-bar"></div>
<div class="sub-header-title">
<img src="http://tautulli.com/images/libraries/movie.png" class="sub-header-icon"/> Recently Added Movies
</div>
<div class="sub-header-count">
<span class="count">${len(recently_added['movie'])}</span> <span class="count-units">movie${'s' if len(recently_added['movie']) > 1 else ''}</span>
</div>
</div>
</div>
<div class="wrapper">
% for movie in recently_added['movie']:
% if loop.index == len(recently_added['movie'])-1 and loop.index % 2 == 0:
<div class="card-instance movie odd">
% else:
<div class="card-instance movie">
% endif
% if PILLOW:
% if preview:
<div class="card-background">
<div class="card-background-preview" style="background-image: url(${'pms_image_proxy?img=' + movie['art'] + '&width=500&height=280&fallback=art&refresh=true'});"></div>
% else:
<div class="card-background" style="background-image: url(${movie['art_url']});">
% endif
% else:
<div class="card-background">
% endif
<div class="card-poster-container">
<a href="${plexpy_config['pms_web_url']}#!/server/${plexpy_config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank">
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + movie['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else movie['poster_url']})">
<div class="card-poster-overlay"></div>
</div>
</a>
</div>
<div class="card-info-container">
<div class="card-info-title nowrap">
<a href="${plexpy_config['pms_web_url']}#!/server/${plexpy_config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank">${movie['title']}</a>
</div>
<div class="card-info-body">
% if movie['tagline']:
<div class="nowrap mb5">
<em>${movie['tagline']}</em>
</div>
% endif
<div>
${movie['summary'][:450] + (movie['summary'][450:] and '...')}
</div>
</div>
<div class="card-info-footer nowrap">
% if movie['year']:
<span class="badge">${movie['year']}</span>
% endif
% if movie['content_rating']:
<span class="badge">${movie['content_rating']}</span>
% endif
% if movie['duration']:
<span class="badge">${int(int(movie['duration'])/60000)} mins</span>
% endif
% if movie['rating']:
<span class="star-rating">
<div class="star-rating-full nowrap" style="width: ${float(movie['rating'])/0.1}%">
<span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span>
</div>
<div class="star-rating-empty" style="width: ${100-float(movie['rating'])/0.1}%">
<span>&#9734;</span><span>&#9734;</span><span>&#9734;</span><span>&#9734;</span><span>&#9734;</span>
</div>
</span>
% endif
</div>
</div>
</div>
</div>
% endfor
</div>
% endif
% if recently_added.get('show'):
<div class="wrapper">
<div class="sub-header">
<div class="sub-header-bar"></div>
<div class="sub-header-title">
<img src="http://tautulli.com/images/libraries/show.png" class="sub-header-icon"/> Recently Added TV Shows
</div>
<div class="sub-header-count">
<span class="count">${len(recently_added['show'])}</span> <span class="count-units">show${'s' if len(recently_added['show']) > 1 else ''}</span> /
<% total_episodes = sum(season['episode_count'] for show in recently_added['show'] for season in show['season']) %>
<span class="count">${total_episodes}</span> <span class="count-units">episode${'s' if total > 1 else ''}</span>
</div>
</div>
</div>
<div class="wrapper">
% for show in recently_added['show']:
<%
if show['season_count'] == 1 and show['season'][0]['episode_count'] == 1:
link_rating_key = show['season'][0]['episode'][0]['rating_key']
link_title = show['title'] + " - " + show['season'][0]['episode'][0]['title']
else:
link_rating_key = show['rating_key']
link_title = show['title']
%>
% if loop.index == len(recently_added['show'])-1 and loop.index % 2 == 0:
<div class="card-instance show odd">
% else:
<div class="card-instance show">
% endif
% if PILLOW:
% if preview:
<div class="card-background">
<div class="card-background-preview" style="background-image: url(${'pms_image_proxy?img=' + show['art'] + '&width=500&height=280&fallback=art&refresh=true'});"></div>
% else:
<div class="card-background" style="background-image: url(${show['art_url']});">
% endif
% else:
<div class="card-background">
% endif
<div class="card-poster-container">
<a href="${plexpy_config['pms_web_url']}#!/server/${plexpy_config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${link_rating_key}" title="${link_title}" target="_blank">
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + show['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else show['poster_url']});">
<div class="card-poster-overlay"></div>
</div>
</a>
</div>
<div class="card-info-container">
<div class="card-info-title nowrap">
<a href="${plexpy_config['pms_web_url']}#!/server/${plexpy_config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${link_rating_key}" title="${link_title}" target="_blank">${show['title']}</a>
</div>
<div class="card-info-body">
<div class="nowrap mb5">
% if show['season_count'] > 1:
<em>${show['season_count']} seasons /</em>
% endif
<% total_show_episodes = sum(s['episode_count'] for s in show['season']) %>
<em>${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}</em>
</div>
<div class="nowrap mb5">
% for i, season in enumerate(show['season'][:8]):
Season ${season['media_index']} &middot;
% if season['episode_count'] == 1:
Episode ${season['episode'][0]['media_index']} - ${season['episode'][0]['title']}
% else:
Episodes ${season['episode_range']}
% endif
% if i < min(show['season_count'], 7):
<br>
% elif i == 7 and show['season_count'] > 8:
...plus ${show['season_count'] - 8} more seasons!
% endif
% endfor
</div>
<div>
% if show['season_count'] == 1 and show['season'][0]['episode_count'] == 1:
${show['season'][0]['episode'][0]['summary'][:350] + (show['season'][0]['episode'][0]['summary'][350:] and '...')}
% else:
<% length = max(0, 350 - 50 * (show['season_count'] - 1)) %>
% if length:
${show['summary'][:length] + (show['summary'][length:] and '...')}
% endif
% endif
</div>
</div>
<div class="card-info-footer nowrap">
% if show['studio']:
<span class="badge">${show['studio']}</span>
% endif
% if show['year']:
<span class="badge">${show['year']}</span>
% endif
% if show['content_rating']:
<span class="badge">${show['content_rating']}</span>
% endif
% if show['duration']:
<span class="badge">${int(int(show['duration'])/60000)} mins</span>
% endif
% if show['rating']:
<span class="star-rating">
<div class="star-rating-full nowrap" style="width: ${float(show['rating'])/0.1}%">
<span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span>
</div>
<div class="star-rating-empty" style="width: ${100-float(show['rating'])/0.1}%">
<span>&#9734;</span><span>&#9734;</span><span>&#9734;</span><span>&#9734;</span><span>&#9734;</span>
</div>
</span>
% endif
</div>
</div>
</div>
</div>
% endfor
</div>
% endif
% if recently_added.get('artist'):
<div class="wrapper">
<div class="sub-header">
<div class="sub-header-bar"></div>
<div class="sub-header-title">
<img src="http://tautulli.com/images/libraries/artist.png" class="sub-header-icon"/> Recently Added Music
</div>
<div class="sub-header-count">
<span class="count">${len(recently_added['artist'])}</span> <span class="count-units">artist${'s' if len(recently_added['artist']) > 1 else ''}</span> /
<% total_albums = sum(artist['album_count'] for artist in recently_added['artist']) %>
<span class="count">${total_albums}</span> <span class="count-units">album${'s' if total > 1 else ''}</span>
</div>
</div>
</div>
<div class="wrapper">
<% album_count = 0 %>
% for artist in recently_added['artist']:
% for album in artist['album']:
<% album_count += 1 %>
% if album_count == total_albums and album_count % 2 == 1:
<div class="card-instance album odd">
% else:
<div class="card-instance album">
% endif
% if PILLOW:
% if preview:
<div class="card-background">
<div class="card-background-preview" style="background-image: url(${'pms_image_proxy?img=' + album['art'] + '&width=500&height=280&fallback=art&refresh=true'});"></div>
% else:
<div class="card-background" style="background-image: url(${album['art_url']});">
% endif
% else:
<div class="card-background">
% endif
<div class="card-poster-container">
<a href="${plexpy_config['pms_web_url']}#!/server/${plexpy_config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${album['rating_key']}" title="${album['title']}" target="_blank">
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + album['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else album['poster_url']});">
<div class="card-poster-overlay"></div>
</div>
</a>
</div>
<div class="card-info-container">
<div class="card-info-title nowrap">
<a href="${plexpy_config['pms_web_url']}#!/server/${plexpy_config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${album['rating_key']}" title="${album['title']}" target="_blank">${album['title']}</a>
</div>
<div class="card-info-body">
<div class="nowrap mb5">
<em>${artist['title']} &middot; ${album['track_count']} track${'s' if album['track_count'] > 1 else ''}</em>
</div>
% if artist['title'].lower() != 'various artists':
<div>
${album['summary'][:200] + (album['summary'][200:] and '...')}
</div>
% endif
</div>
<div class="card-info-footer nowrap">
% if album['year']:
<span class="badge">${album['year']}</span>
% endif
% if album['genres']:
% for genre in album['genres'][:2]:
<span class="badge">${genre}</span>
% endfor
% endif
% if album['rating']:
<span class="star-rating">
<div class="star-rating-full nowrap" style="width: ${float(album['rating'])/0.1}%">
<span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span>
</div>
<div class="star-rating-empty" style="width: ${100-float(album['rating'])/0.1}%">
<span>&#9734;</span><span>&#9734;</span><span>&#9734;</span><span>&#9734;</span><span>&#9734;</span>
</div>
</span>
% endif
</div>
</div>
</div>
</div>
% endfor
% endfor
</div>
% endif
<!-- START FOOTER -->
<div class="footer">
<div class="footer-bar"></div>
<div class="content-block powered-by">
Newsletter generated by <a href="http://tautulli.com" target="_blank">Tautulli</a>.
</div>
</div>
<!-- END FOOTER -->
</td>
</tr>
<!-- END MAIN CONTENT AREA -->
</table>
<!-- END CENTERED WHITE CONTAINER -->
</div>
</td>
</tr>
</table>
</body>
</html>