From 7cb384aaf39ced6f3752b50308b10b246507b120 Mon Sep 17 00:00:00 2001 From: Imran Sobir Date: Tue, 21 Feb 2017 15:42:38 +0500 Subject: [PATCH 1/3] Update qute:bookmarks design. --- qutebrowser/browser/qutescheme.py | 5 ++ qutebrowser/html/bookmarks.html | 101 ++++++++++++++++++++++++------ 2 files changed, 86 insertions(+), 20 deletions(-) diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index 018582abf..f976cd836 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -156,6 +156,11 @@ def qute_bookmarks(_url): quickmarks = sorted(objreg.get('quickmark-manager').marks.items(), key=lambda x: x[0]) # Sort by name + # bookmark title is url if bookmark has no title + for i, item in enumerate(bookmarks): + if not item[1]: + bookmarks[i] = (item[0], item[0]) + html = jinja.render('bookmarks.html', title='Bookmarks', bookmarks=bookmarks, diff --git a/qutebrowser/html/bookmarks.html b/qutebrowser/html/bookmarks.html index 2f82453ab..e6448094a 100644 --- a/qutebrowser/html/bookmarks.html +++ b/qutebrowser/html/bookmarks.html @@ -1,34 +1,95 @@ {% extends "base.html" %} {% block style %} -table { border: 1px solid grey; border-collapse: collapse; width: 100%;} -th, td { border: 1px solid grey; padding: 0px 5px; } -th { background: lightgrey; } +body { + background: #fefefe; + font-family: sans-serif; + margin: 0 auto; + max-width: 1280px; + padding-left: 20px; + padding-right: 20px; +} + +h1 { + color: #444; + font-weight: normal; + margin-bottom: 10px; +} + +a { + text-decoration: none; + color: #2562dc +} + +a:hover { + text-decoration: underline; +} + +.url a { + color: #444; +} + +table { + border-collapse: collapse; + width: 100%; +} + +th { + text-align: left; +} + +tbody tr:nth-child(odd) { + background-color: #f8f8f8; +} + +.qmarks .name { + padding-left: 5px; +} + +.empty { + background-color: #f8f8f8; + color: #444; + display: inline-block; + text-align: center; + width: 100%; +} + {% endblock %} {% block content %} - - - - - - {% for url, title in bookmarks %} - - - - - {% endfor %} - - - - +

Quickmarks

+ +{% if quickmarks|length %} +

Bookmark

URL

{{title}}{{url}}

Quickmark

URL

+ {% for name, url in quickmarks %} - - + + {% endfor %} +
{{name}}{{url}}{{name}}{{url}}
+{% else %} +You have no quickmarks +{% endif %} + +

Bookmarks

+ +{% if bookmarks|length %} + + + {% for url, title in bookmarks %} + + + + + {% endfor %} + +
{{title}}{{url}}
+{% else %} +You have no bookmarks +{% endif %} {% endblock %} From 4b643f0b743f10ed958564c40229c9004c36f6e7 Mon Sep 17 00:00:00 2001 From: Imran Sobir Date: Thu, 23 Feb 2017 19:23:18 +0500 Subject: [PATCH 2/3] Extract common styling from bookmarks, history. --- qutebrowser/html/bookmarks.html | 39 ++++--------------------------- qutebrowser/html/history.html | 38 ++---------------------------- qutebrowser/html/styled.html | 41 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 70 deletions(-) create mode 100644 qutebrowser/html/styled.html diff --git a/qutebrowser/html/bookmarks.html b/qutebrowser/html/bookmarks.html index e6448094a..91301679e 100644 --- a/qutebrowser/html/bookmarks.html +++ b/qutebrowser/html/bookmarks.html @@ -1,59 +1,30 @@ -{% extends "base.html" %} +{% extends "styled.html" %} {% block style %} -body { - background: #fefefe; - font-family: sans-serif; - margin: 0 auto; - max-width: 1280px; - padding-left: 20px; - padding-right: 20px; -} - +{{super()}} h1 { - color: #444; - font-weight: normal; margin-bottom: 10px; } -a { - text-decoration: none; - color: #2562dc -} - -a:hover { - text-decoration: underline; -} - .url a { color: #444; } -table { - border-collapse: collapse; - width: 100%; -} - th { text-align: left; } -tbody tr:nth-child(odd) { - background-color: #f8f8f8; -} - .qmarks .name { padding-left: 5px; } -.empty { +.empty-msg { background-color: #f8f8f8; color: #444; display: inline-block; text-align: center; width: 100%; } - {% endblock %} {% block content %} @@ -72,7 +43,7 @@ tbody tr:nth-child(odd) { {% else %} -You have no quickmarks +You have no quickmarks {% endif %}

Bookmarks

@@ -89,7 +60,7 @@ tbody tr:nth-child(odd) { {% else %} -You have no bookmarks +You have no bookmarks {% endif %} {% endblock %} diff --git a/qutebrowser/html/history.html b/qutebrowser/html/history.html index 4135fc627..94f82182f 100644 --- a/qutebrowser/html/history.html +++ b/qutebrowser/html/history.html @@ -1,29 +1,9 @@ -{% extends "base.html" %} +{% extends "styled.html" %} {% block style %} +{{super()}} body { - background: #fefefe; - font-family: sans-serif; - margin: 0 auto; max-width: 1440px; - padding-left: 20px; - padding-right: 20px; -} - -h1 { - color: #444; - font-weight: normal; -} - -table { - border-collapse: collapse; - width: 100%; -} - -td { - max-width: 50%; - padding: 2px 5px; - text-align: left; } td.title { @@ -36,19 +16,6 @@ td.time { white-space: nowrap; } -a { - text-decoration: none; - color: #2562dc -} - -a:hover { - text-decoration: underline; -} - -tr:nth-child(odd) { - background-color: #f8f8f8; -} - .date { color: #888; font-size: 14pt; @@ -66,7 +33,6 @@ tr:nth-child(odd) { color: #333; font-weight: bold; } - {% endblock %} {% block content %} diff --git a/qutebrowser/html/styled.html b/qutebrowser/html/styled.html new file mode 100644 index 000000000..e2a608538 --- /dev/null +++ b/qutebrowser/html/styled.html @@ -0,0 +1,41 @@ +{% extends "base.html" %} + +{% block style %} +a { + text-decoration: none; + color: #2562dc +} + +a:hover { + text-decoration: underline; +} + +body { + background: #fefefe; + font-family: sans-serif; + margin: 0 auto; + max-width: 1280px; + padding-left: 20px; + padding-right: 20px; +} + +h1 { + color: #444; + font-weight: normal; +} + +table { + border-collapse: collapse; + width: 100%; +} + +tbody tr:nth-child(odd) { + background-color: #f8f8f8; +} + +td { + max-width: 50%; + padding: 2px 5px; + text-align: left; +} +{% endblock %} From 34abad27c4c26851348852bb1eacdbcd65452f4c Mon Sep 17 00:00:00 2001 From: Imran Sobir Date: Thu, 23 Feb 2017 19:29:49 +0500 Subject: [PATCH 3/3] Use jinja filter to set default title. --- qutebrowser/browser/qutescheme.py | 5 ----- qutebrowser/html/bookmarks.html | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index f976cd836..018582abf 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -156,11 +156,6 @@ def qute_bookmarks(_url): quickmarks = sorted(objreg.get('quickmark-manager').marks.items(), key=lambda x: x[0]) # Sort by name - # bookmark title is url if bookmark has no title - for i, item in enumerate(bookmarks): - if not item[1]: - bookmarks[i] = (item[0], item[0]) - html = jinja.render('bookmarks.html', title='Bookmarks', bookmarks=bookmarks, diff --git a/qutebrowser/html/bookmarks.html b/qutebrowser/html/bookmarks.html index 91301679e..7e6f46ea9 100644 --- a/qutebrowser/html/bookmarks.html +++ b/qutebrowser/html/bookmarks.html @@ -53,7 +53,7 @@ th { {% for url, title in bookmarks %} - {{title}} + {{title | default(url, true)}} {{url}} {% endfor %}