diff --git a/djangodocs/livedocs/static/css/dashboard.css b/djangodocs/livedocs/static/css/dashboard.css index 56867a6..e82fdce 100644 --- a/djangodocs/livedocs/static/css/dashboard.css +++ b/djangodocs/livedocs/static/css/dashboard.css @@ -12,18 +12,22 @@ * @section Dashboard */ -.b-dashboard {} -.b-dashboard__section { - display: inline-block; - width: 24%; - vertical-align: top; +.b-dashboard { +} +.b-dashboard__panel { + float: left; + width: 39%; + padding: 5% } -.b-dashboard__section-link { - font-size: 160%; +.b-dashboard .b-dashboard__panel:first-child { + margin-top: 2em; } -.b-dashboard__item { - padding-left: 2em; +.b-dashboard__section { + margin-bottom: 2em; + line-height: 1.4; + font-size: 140%; } -.b-dashboard__item-link { - font-size: 120%; +.b-dashboard__section-header { + font-size: 142%; + padding-bottom: 1em; } diff --git a/djangodocs/livedocs/static/css/typo.css b/djangodocs/livedocs/static/css/typo.css index 920d4ea..ec9bf60 100644 --- a/djangodocs/livedocs/static/css/typo.css +++ b/djangodocs/livedocs/static/css/typo.css @@ -63,6 +63,12 @@ font-size: 140%; background: #e2eef6; } + + +/** + * @subsection Lists + */ + .b-content ul { list-style: disc; } @@ -78,6 +84,12 @@ .b-content li * { font-size: 100%!important; } + + +/** + * @subsection Heghlight + */ + .b-content .highlight-python, .b-content .highlight-html, .b-content .highlight { @@ -107,6 +119,12 @@ .m-search-focus .b-content .highlight { background: #fffff0; } + + +/** + * @subsection Defenition lists + */ + .b-content dl { line-height: 1.4; } @@ -124,6 +142,12 @@ .b-content dd:last-child :last-child { margin-bottom: 0px; } + + +/** + * @subsection Version added + */ + .b-content .versionadded { font-size: 120%; font-style: italic; @@ -132,6 +156,12 @@ .b-content .versionadded a { color: #11721a!important; } + + +/** + * @subsection Warnings + */ + .b-content .admonition { padding-left: 60px; background: url(../images/warning.png) 0px 0px no-repeat; @@ -143,6 +173,26 @@ } +/** + * @subsection Tables + */ + +.b-content table { + width: 100%; + margin: 1.54em 0px; + line-height: 1.4; + font-size: 140%; +} +.b-content td, +.b-content th { + text-align: left; + padding: 0.6em 1em; +} +.b-content th { + background: #e2eef6; +} + + /** * @subsection Pygments */ diff --git a/djangodocs/livedocs/templates/livedocs/_dashboard.html b/djangodocs/livedocs/templates/livedocs/_dashboard.html new file mode 100644 index 0000000..ec0fcaa --- /dev/null +++ b/djangodocs/livedocs/templates/livedocs/_dashboard.html @@ -0,0 +1,13 @@ + + + {% for panel in panels %} + + {% for item in panel %} + + {{ item.title }} + {{ item.content|safe }} + + {% endfor %} + + {% endfor %} + diff --git a/djangodocs/livedocs/templates/livedocs/search.html b/djangodocs/livedocs/templates/livedocs/search.html index b181ba2..2833a15 100644 --- a/djangodocs/livedocs/templates/livedocs/search.html +++ b/djangodocs/livedocs/templates/livedocs/search.html @@ -1,8 +1,13 @@ {% extends 'livedocs/layout/layout.html' %} + + {% load mptt_tags %} +{% load dashboard %} + {% block title %} {{ title|striptags }} {% endblock %} + {% block content %} {% if document_items %} @@ -17,25 +22,7 @@ {{ node.title }} {% endblock %} + {% block dashboard %} - {% comment %} - - {% for root_item in root_items %} - - - {{ root_item.title }} - - {% for secondary_item in root_item.get_children %} - - - {{ secondary_item.title }} - - - {% endfor %} - - {% endfor %} - - {% endcomment %} -{% endblock %} \ No newline at end of file + {% dashboard %} +{% endblock %} diff --git a/djangodocs/livedocs/templatetags/dashboard.py b/djangodocs/livedocs/templatetags/dashboard.py new file mode 100644 index 0000000..8d7409b --- /dev/null +++ b/djangodocs/livedocs/templatetags/dashboard.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -* +from django import template +from livedocs.models import Item + + +register = template.Library() + + +@register.inclusion_tag('livedocs/_dashboard.html', takes_context=True) +def dashboard(context): + panels_data = [ + ['index/s-the-model-layer', 'index/s-the-template-layer', 'index/s-the-view-layer', 'index/forms', ], + ['index/s-other-batteries-included'], + ] + + panels = [] + for panel in panels_data: + items = [] + for path in panel: + try: + item = Item.objects.get(path=path, + version__name=context['current_version'], + level=3) + items.append(item) + except Item.DoesNotExist, Item.MultipleObjectsReturned: + pass + + panels.append(items) + + return {'panels': panels} diff --git a/djangodocs/livedocs/views.py b/djangodocs/livedocs/views.py index 82f331b..3d7a1be 100644 --- a/djangodocs/livedocs/views.py +++ b/djangodocs/livedocs/views.py @@ -116,9 +116,6 @@ def get(self, request, *args, **kwargs): context['title'] = 'No results' #raise Exception(context['document_items']) - dashboard_root_item = Item.objects.get(path='index', version__name=context['current_version']) - context['root_items'] = dashboard_root_item.get_descendants() - return context