Fix centering last item on newsletter

This commit is contained in:
JonnyWong16 2018-04-04 20:45:34 -07:00
parent 45c646c062
commit 366e8514b6
6 changed files with 554 additions and 450 deletions

View file

@ -952,7 +952,7 @@
<label> <label>
<input type="checkbox" id="newsletter_self_hosted" name="newsletter_self_hosted" value="1" ${config['newsletter_self_hosted']}> Self-Hosted Newsletters <input type="checkbox" id="newsletter_self_hosted" name="newsletter_self_hosted" value="1" ${config['newsletter_self_hosted']}> Self-Hosted Newsletters
</label> </label>
<p class="help-block">Enable to host newsletters on your own domain. </p> <p class="help-block">Enable to host newsletters on your own domain. This will generate a link to an HTML page where you can view the newsletter.</p>
</div> </div>
<div id="self_host_newsletter_options" style="overlfow: hidden; display: ${'block' if config['newsletter_self_hosted'] == 'checked' else 'none'}"> <div id="self_host_newsletter_options" style="overlfow: hidden; display: ${'block' if config['newsletter_self_hosted'] == 'checked' else 'none'}">
<p class="help-block" id="self_host_newsletter_message">Note: The <span class="inline-pre">${http_root}newsletter</span> endpoint on your domain must be publicly accessible from the internet.</p> <p class="help-block" id="self_host_newsletter_message">Note: The <span class="inline-pre">${http_root}newsletter</span> endpoint on your domain must be publicly accessible from the internet.</p>

View file

@ -374,6 +374,12 @@
min-width: 502px; min-width: 502px;
max-width: 502px; max-width: 502px;
} }
.card-instance.pad {
padding: 0 !important;
width: 251px !important;
min-width: 251px !important;
max-width: 251px !important;
}
.card-instance.movie, .card-instance.movie,
.card-instance.show { .card-instance.show {
height: 233px; height: 233px;
@ -382,6 +388,7 @@
height: 158px; height: 158px;
} }
.card-background { .card-background {
background-color: #282828;
background-position: center; background-position: center;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -652,11 +659,18 @@
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tbody> <tbody>
% for movie_a, movie_b in grouper(recently_added['movie'], 2): % for movie_a, movie_b in grouper(recently_added['movie'], 2):
<tr>
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tbody>
<tr> <tr>
% for movie in (movie_a, movie_b): % for movie in (movie_a, movie_b):
% if movie: % if movie:
% if not movie_b:
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
<td align="center" valign="top" class="card-instance movie" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 233px;"> <td align="center" valign="top" class="card-instance movie" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 233px;">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + movie['art_hash']) if base_url_image else movie['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);"> <table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + movie['art_hash']) if base_url_image else movie['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #282828;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
<tbody> <tbody>
<tr> <tr>
<td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 227px;"> <td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 227px;">
@ -734,11 +748,16 @@
</tbody> </tbody>
</table> </table>
</td> </td>
% else: % if not movie_b:
<td align="center" valign="top" class="card-instance" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;"></td> <td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
% endif % endif
% endfor % endfor
</tr> </tr>
</tbody>
</table>
</td>
</tr>
% endfor % endfor
</tbody> </tbody>
</table> </table>
@ -764,9 +783,16 @@
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tbody> <tbody>
% for show_a, show_b in grouper(recently_added['show'], 2): % for show_a, show_b in grouper(recently_added['show'], 2):
<tr>
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tbody>
<tr> <tr>
% for show in (show_a, show_b): % for show in (show_a, show_b):
% if show: % if show:
% if not show_b:
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
<% <%
if show['season_count'] == 1: if show['season_count'] == 1:
if show['season'][0]['episode_count'] == 1: if show['season'][0]['episode_count'] == 1:
@ -777,7 +803,7 @@
link_rating_key = show['rating_key'] link_rating_key = show['rating_key']
%> %>
<td align="center" valign="top" class="card-instance show" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 233px;"> <td align="center" valign="top" class="card-instance show" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 233px;">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + show['art_hash']) if base_url_image else show['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);"> <table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + show['art_hash']) if base_url_image else show['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #282828;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
<tbody> <tbody>
<tr> <tr>
<td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 227px;"> <td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 227px;">
@ -879,11 +905,16 @@
</tbody> </tbody>
</table> </table>
</td> </td>
% else: % if not show_b:
<td align="center" valign="top" class="card-instance" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;"></td> <td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
% endif % endif
% endfor % endfor
</tr> </tr>
</tbody>
</table>
</td>
</tr>
% endfor % endfor
</tbody> </tbody>
</table> </table>
@ -909,11 +940,18 @@
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tbody> <tbody>
% for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2): % for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2):
<tr>
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tbody>
<tr> <tr>
% for album in (album_a, album_b): % for album in (album_a, album_b):
% if album: % if album:
% if not album_b:
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
<td align="center" valign="top" class="card-instance album" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 158px;"> <td align="center" valign="top" class="card-instance album" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 158px;">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + album['art_hash']) if base_url_image else album['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);"> <table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + album['art_hash']) if base_url_image else album['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #282828;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
<tbody> <tbody>
<tr> <tr>
<td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 152px;"> <td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 152px;">
@ -987,11 +1025,16 @@
</tbody> </tbody>
</table> </table>
</td> </td>
% else: % if not album_b:
<td align="center" valign="top" class="card-instance" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;"></td> <td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
% endif % endif
% endfor % endfor
</tr> </tr>
</tbody>
</table>
</td>
</tr>
% endfor % endfor
</tbody> </tbody>
</table> </table>

View file

@ -374,6 +374,12 @@
min-width: 502px; min-width: 502px;
max-width: 502px; max-width: 502px;
} }
.card-instance.pad {
padding: 0 !important;
width: 251px !important;
min-width: 251px !important;
max-width: 251px !important;
}
.card-instance.movie, .card-instance.movie,
.card-instance.show { .card-instance.show {
height: 233px; height: 233px;
@ -382,6 +388,7 @@
height: 158px; height: 158px;
} }
.card-background { .card-background {
background-color: #282828;
background-position: center; background-position: center;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -652,9 +659,16 @@
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
<tbody> <tbody>
% for movie_a, movie_b in grouper(recently_added['movie'], 2): % for movie_a, movie_b in grouper(recently_added['movie'], 2):
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr> <tr>
% for movie in (movie_a, movie_b): % for movie in (movie_a, movie_b):
% if movie: % if movie:
% if not movie_b:
<td align="center" valign="top" class="card-instance pad"></td>
% endif
<td align="center" valign="top" class="card-instance movie"> <td align="center" valign="top" class="card-instance movie">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + movie['art_hash']) if base_url_image else movie['art_url']});"> <table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + movie['art_hash']) if base_url_image else movie['art_url']});">
<tbody> <tbody>
@ -734,11 +748,16 @@
</tbody> </tbody>
</table> </table>
</td> </td>
% else: % if not movie_b:
<td align="center" valign="top" class="card-instance"></td> <td align="center" valign="top" class="card-instance pad"></td>
% endif
% endif % endif
% endfor % endfor
</tr> </tr>
</tbody>
</table>
</td>
</tr>
% endfor % endfor
</tbody> </tbody>
</table> </table>
@ -764,9 +783,16 @@
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
<tbody> <tbody>
% for show_a, show_b in grouper(recently_added['show'], 2): % for show_a, show_b in grouper(recently_added['show'], 2):
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr> <tr>
% for show in (show_a, show_b): % for show in (show_a, show_b):
% if show: % if show:
% if not show_b:
<td align="center" valign="top" class="card-instance pad"></td>
% endif
<% <%
if show['season_count'] == 1: if show['season_count'] == 1:
if show['season'][0]['episode_count'] == 1: if show['season'][0]['episode_count'] == 1:
@ -879,11 +905,16 @@
</tbody> </tbody>
</table> </table>
</td> </td>
% else: % if not show_b:
<td align="center" valign="top" class="card-instance"></td> <td align="center" valign="top" class="card-instance pad"></td>
% endif
% endif % endif
% endfor % endfor
</tr> </tr>
</tbody>
</table>
</td>
</tr>
% endfor % endfor
</tbody> </tbody>
</table> </table>
@ -909,9 +940,16 @@
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
<tbody> <tbody>
% for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2): % for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2):
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr> <tr>
% for album in (album_a, album_b): % for album in (album_a, album_b):
% if album: % if album:
% if not album_b:
<td align="center" valign="top" class="card-instance pad"></td>
% endif
<td align="center" valign="top" class="card-instance album"> <td align="center" valign="top" class="card-instance album">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + album['art_hash']) if base_url_image else album['art_url']});"> <table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + album['art_hash']) if base_url_image else album['art_url']});">
<tbody> <tbody>
@ -987,11 +1025,16 @@
</tbody> </tbody>
</table> </table>
</td> </td>
% else: % if not album_b:
<td align="center" valign="top" class="card-instance"></td> <td align="center" valign="top" class="card-instance pad"></td>
% endif
% endif % endif
% endfor % endfor
</tr> </tr>
</tbody>
</table>
</td>
</tr>
% endfor % endfor
</tbody> </tbody>
</table> </table>

View file

@ -698,9 +698,12 @@ class RecentlyAdded(Newsletter):
item['thumb_hash'] = set_hash_image_info( item['thumb_hash'] = set_hash_image_info(
img=item['thumb'], width=150, height=225, fallback='poster') img=item['thumb'], width=150, height=225, fallback='poster')
if item['art']:
item['art_hash'] = set_hash_image_info( item['art_hash'] = set_hash_image_info(
img=item['art'], width=500, height=280, img=item['art'], width=500, height=280,
opacity=25, background='282828', blur=3, fallback='art') opacity=25, background='282828', blur=3, fallback='art')
else:
item['art_hash'] = ''
item['poster_url'] = '' item['poster_url'] = ''
item['art_url'] = '' item['art_url'] = ''

View file

@ -1119,6 +1119,9 @@ def get_imgur_info(img=None, rating_key=None, title='', width=600, height=1000,
def set_hash_image_info(img=None, rating_key=None, width=600, height=1000, def set_hash_image_info(img=None, rating_key=None, width=600, height=1000,
opacity=100, background='000000', blur=0, fallback=None): opacity=100, background='000000', blur=0, fallback=None):
if not rating_key and not img:
return fallback
if rating_key and not img: if rating_key and not img:
if fallback == 'art': if fallback == 'art':
img = '/library/metadata/{}/art'.format(rating_key) img = '/library/metadata/{}/art'.format(rating_key)

View file

@ -4021,6 +4021,18 @@ class WebInterface(object):
def image(self, *args, **kwargs): def image(self, *args, **kwargs):
if args: if args:
img_hash = args[0] img_hash = args[0]
if img_hash in ('poster', 'cover', 'art'):
if img_hash == 'poster':
fbi = common.DEFAULT_POSTER_THUMB
elif img_hash == 'cover':
fbi = common.DEFAULT_COVER_THUMB
elif img_hash == 'art':
fbi = common.DEFAULT_ART
fp = os.path.join(plexpy.PROG_DIR, 'data', fbi)
return serve_file(path=fp, content_type='image/png')
img_info = notification_handler.get_hash_image_info(img_hash=img_hash) img_info = notification_handler.get_hash_image_info(img_hash=img_hash)
if img_info: if img_info: