From 00332d8aac33f5499ca339115d2077dd0fc13374 Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 4 May 2019 22:01:07 +0200 Subject: [PATCH] default css for talks plugins --- plugins/talks/style.css | 129 ++++++++++++++++++++++++++++++++++++++++ plugins/talks/talks.py | 18 +++++- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 plugins/talks/style.css diff --git a/plugins/talks/style.css b/plugins/talks/style.css new file mode 100644 index 0000000..9fed177 --- /dev/null +++ b/plugins/talks/style.css @@ -0,0 +1,129 @@ + +.talk-resources { + word-break: break-all; +} + +.talk-grid { + table-layout: auto; + min-width: 100%; + border-collapse: separate; + text-align: center; +} + +.talk-grid > thead th:first-child { + max-width: 5em; +} + +.talk-grid > thead th { + text-align: center; +} + +.talk-grid tr { + height: 1.5em; +} + + +.rooms-4 .talk { + width: 25%; +} + +.rooms-3 .talk { + width: 33%; +} + +.rooms-2 .talk { + width: 50%; +} + +.rooms-1 .talk { + width: 100%; +} + +td.talk { + border: 1px solid #444; + padding: 4px; +} + +td.talk > a { + text-decoration: none; + border: none; +} + +.talk-grid tr { + line-height: 1em; +} + +.talk-grid tr:hover td:first-child { + background-color: rgb(152, 14, 14); + background-color: rgba(152, 14, 14, 0.79); +} + +.talk-grid tr:hover td { + background-color: rgb(60, 22, 22) +} + +.talk-title a, +.talk-title a:hover, +.talk-title a:focus { + color: #9c2f2f; + border-bottom: none; +} + +.talk-description strong { + background: inherit; + color: inherit; +} + +/* tag speciali nei talk {{{ */ +/* generati guardando i tag di glypicon come glyphicon-pushpin e copiandone il campo content */ +td.talk::before { + font-family: 'Glyphicons Halflings'; + float: right; +} +td.tag-presentazione_libro::before { + content: "\e043"; +} +td.tag-percorso_base::before { + content: "\e146"; +} + +.talk.allrooms { + background-color: rgba(200,200,200,0.4); +} +/* tag speciali nei talk }}} */ + +/* END TALK }}} */ + +/* Pagine speciali */ +.body-info .entry-content > ul { + list-style: none; +} + +/*media query min dal piccolo, max dal grande*/ + +@media all and (min-width: 770px) { + .navbar, + .navbar .navbar-brand, + .navbar .navbar-nav > li > a { + background-color: #9c2f2f; + } +} +@media all and (max-width: 770px) { + .talk-grid { + font-size: 0.8em; + } + .talk-grid td { + hyphens: auto; + } +} +@media all and (max-width: 1200px), (hover: none), (hover: on-demand), (pointer: coarse) { /* any mobile */ + div.container { + width: 100% !important; + } +} +@media all and (max-width: 450px) { + .talk-grid { + font-size: 0.5em; + } +} + diff --git a/plugins/talks/talks.py b/plugins/talks/talks.py index 27e01de..7bcb85d 100644 --- a/plugins/talks/talks.py +++ b/plugins/talks/talks.py @@ -15,8 +15,9 @@ import shutil from copy import copy import locale from contextlib import contextmanager -from babel.dates import format_date, format_datetime, format_time +import inspect +from babel.dates import format_date, format_datetime, format_time from markdown import markdown from docutils import nodes from docutils.parsers.rst import directives, Directive @@ -260,6 +261,15 @@ def jinja_env(): return env +@memoize +def get_css(): + plugindir = os.path.dirname( + os.path.abspath(inspect.getfile(inspect.currentframe())) + ) + with open(os.path.join(plugindir, "style.css")) as buf: + return buf.read() + + class TalkListDirective(Directive): final_argument_whitespace = True has_content = True @@ -431,6 +441,12 @@ class TalkGridDirective(Directive): traceback.print_exc() return [] + css = get_css() + if css: + output.insert( + 0, + nodes.raw("", '' % css, format="html"), + ) return output