Quellcode durchsuchen

default css for talks plugins

boyska vor 5 Jahren
Ursprung
Commit
00332d8aac
2 geänderte Dateien mit 146 neuen und 1 gelöschten Zeilen
  1. 129 0
      plugins/talks/style.css
  2. 17 1
      plugins/talks/talks.py

+ 129 - 0
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;
+    }
+}
+

+ 17 - 1
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("", '<style type="text/css">%s</style>' % css, format="html"),
+            )
         return output