From 318d65bf3ad277a180524269931a9d73ec2d6f85 Mon Sep 17 00:00:00 2001 From: Jan Broer Date: Sun, 3 Apr 2016 23:33:29 +0200 Subject: [PATCH] Small UI fixes * Smart truncate long titles in overview pages * Fix responsive grid in overview * Update favicon --- cps/static/css/style.css | 6 +++--- cps/static/favicon.ico | Bin 519 -> 1150 bytes cps/templates/detail.html | 2 +- cps/templates/discover.html | 2 +- cps/templates/index.html | 4 ++-- cps/templates/search.html | 2 +- cps/templates/shelf.html | 2 +- cps/web.py | 9 +++++++++ 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cps/static/css/style.css b/cps/static/css/style.css index 52e2f1e4..8a16b3f0 100644 --- a/cps/static/css/style.css +++ b/cps/static/css/style.css @@ -8,7 +8,7 @@ a{color: #45b29d}a:hover{color: #444;} .container-fluid img{display:block;max-width:100%;height:auto} .container-fluid .discover{margin-bottom:50px} .container-fluid .new-books{border-top:1px solid #ccc}.container-fluid .new-books h2{margin:50px 0 0 0} -.container-fluid .book{margin-top:20px}.container-fluid .book .cover{height:225px;position:relative}.container-fluid .book .cover img{border:3px solid #fff;border-radius:5px;box-sizeing:border-box;height:100%;bottom:0;position:absolute;-webkit-box-shadow: 0 5px 8px -6px #777;-moz-box-shadow: 0 5px 8px -6px #777;box-shadow: 0 5px 8px -6px #777;} +.container-fluid .book{margin-top:20px}.container-fluid .book .cover{height:225px;position:relative}.container-fluid .book .cover img{border:1px solid #fff;/*border-radius:7px;*/box-sizeing:border-box;height:100%;bottom:0;position:absolute;-webkit-box-shadow: 0 5px 8px -6px #777;-moz-box-shadow: 0 5px 8px -6px #777;box-shadow: 0 5px 8px -6px #777;} .container-fluid .book .meta{margin-top:10px}.container-fluid .book .meta p{margin:0} .container-fluid .book .meta .title{font-weight:bold;font-size:15px;color:#444} .container-fluid .book .meta .author{font-size:12px;color:#999} @@ -21,8 +21,8 @@ span.glyphicon.glyphicon-tags {padding-right: 5px;color: #999;vertical-align: te .book-meta {padding-bottom: 20px;} .book-meta .tags a {display: inline;} .container-fluid .single .cover img { - border: 3px solid #fff; - border-radius: 5px; + border: 1px solid #fff; + /*border-radius: 7px;*/ box-sizeing: border-box; -webkit-box-shadow: 0 5px 8px -6px #777; -moz-box-shadow: 0 5px 8px -6px #777; diff --git a/cps/static/favicon.ico b/cps/static/favicon.ico index 75e6ecc39b4fda06ffe4e24ad60378142a72c005..4633936532a7a14771be94e26e47e8dad3a66921 100644 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYJy!Tygs` zdr!Cizj1#T&i3`N_`i62 z5S)+CElYQV{oit=m?*W_%$dL0^Z(iFi^nYQJXCvAALGC|!W$yot2Xp@~ z-WKqG|Cvsb%v!N48XSK6PPhHvcC-u}7mK$A5^V-3{y=U30(iPyxYh6firq0NV#xC7 z?D<=~{_i|d3s-;X)>^PTuHD-P7em*B%-?&e6|DZqg-LMrp!9h9>H;_)Sv@v3C=G%1 zEZXM(f8kc&|MNC`{J-<~5YhTUW`f)e%0r;IxNvhNNqVul3A-2r!ykJFh9B|_3?Jt+ lFns=xia*pdFnq8FiUH+*_5;zCQs>F*mKC%briLr&&TuvS@Rtyny01I?!6 z(5{qGf1EQX3^afchet@_kT8z8^Y#VpdW$d)=}&FKG@`Xs=lV*MG>r+AP%7r`{L919I(VDSTgo)x(&a6)6V3OKF;A zBqOR;fv!Ddy>e0zZ6-o5TzPhudeb zaO>Pf_WT()mYY2M_L=r_10ki -
+

{{entry.title}}

{{entry.authors[0].name}}

diff --git a/cps/templates/discover.html b/cps/templates/discover.html index 792bd2a2..5480cedd 100644 --- a/cps/templates/discover.html +++ b/cps/templates/discover.html @@ -14,7 +14,7 @@ {% endif %}
-

{{entry.title}}

+

{{entry.title|shortentitle}}

{{entry.authors[0].name}}

{% if entry.ratings.__len__() > 0 %}
diff --git a/cps/templates/index.html b/cps/templates/index.html index 5b061133..d7b0a022 100755 --- a/cps/templates/index.html +++ b/cps/templates/index.html @@ -15,7 +15,7 @@ {% endif %}
-

{{entry.title}}

+

{{entry.title|shortentitle}}

{{entry.authors[0].name}}

{% if entry.ratings.__len__() > 0 %}
@@ -50,7 +50,7 @@ {% endif %}
-

{{entry.title}}

+

{{entry.title|shortentitle}}

{{entry.authors[0].name}}

{% if entry.ratings.__len__() > 0 %}
diff --git a/cps/templates/search.html b/cps/templates/search.html index fa9f5a23..dd32ab7e 100644 --- a/cps/templates/search.html +++ b/cps/templates/search.html @@ -21,7 +21,7 @@ {% endif %}
-

{{entry.title}}

+

{{entry.title|shortentitle}}

{{entry.authors[0].name}}

{% if entry.ratings.__len__() > 0 %}
diff --git a/cps/templates/shelf.html b/cps/templates/shelf.html index 4d89c472..9a06dddc 100644 --- a/cps/templates/shelf.html +++ b/cps/templates/shelf.html @@ -14,7 +14,7 @@ {% endif %}
-

{{entry.title}}

+

{{entry.title|shortentitle}}

{{entry.authors[0].name}}

{% if entry.ratings.__len__() > 0 %}
diff --git a/cps/web.py b/cps/web.py index dc28f2b8..1b75f13c 100755 --- a/cps/web.py +++ b/cps/web.py @@ -4,6 +4,7 @@ import mimetypes import logging import sys +import textwrap mimetypes.add_type('application/xhtml+xml','.xhtml') from flask import Flask, render_template, session, request, Response, redirect, url_for, send_from_directory, make_response, g, flash, abort from cps import db, config, ub, helper @@ -122,6 +123,14 @@ def url_for_other_page(page): app.jinja_env.globals['url_for_other_page'] = url_for_other_page +## custom jinja filters +@app.template_filter('shortentitle') +def shortentitle_filter(s): + if len(s) > 60: + s = s.split(':', 1)[0] + if len(s) > 60: + s = textwrap.wrap(s, 60, break_long_words=False)[0]+' [...]' + return s def admin_required(f): """