Skip to content

Commit

Permalink
Index page
Browse files Browse the repository at this point in the history
  • Loading branch information
piumosso committed Jul 31, 2011
1 parent c4683bd commit f1fcfdf
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 35 deletions.
26 changes: 15 additions & 11 deletions djangodocs/livedocs/static/css/dashboard.css
Expand Up @@ -12,18 +12,22 @@
* @section Dashboard * @section Dashboard
*/ */


.b-dashboard {} .b-dashboard {
.b-dashboard__section { }
display: inline-block; .b-dashboard__panel {
width: 24%; float: left;
vertical-align: top; width: 39%;
padding: 5%
} }
.b-dashboard__section-link { .b-dashboard .b-dashboard__panel:first-child {
font-size: 160%; margin-top: 2em;
} }
.b-dashboard__item { .b-dashboard__section {
padding-left: 2em; margin-bottom: 2em;
line-height: 1.4;
font-size: 140%;
} }
.b-dashboard__item-link { .b-dashboard__section-header {
font-size: 120%; font-size: 142%;
padding-bottom: 1em;
} }
50 changes: 50 additions & 0 deletions djangodocs/livedocs/static/css/typo.css
Expand Up @@ -63,6 +63,12 @@
font-size: 140%; font-size: 140%;
background: #e2eef6; background: #e2eef6;
} }


/**
* @subsection Lists
*/

.b-content ul { .b-content ul {
list-style: disc; list-style: disc;
} }
Expand All @@ -78,6 +84,12 @@
.b-content li * { .b-content li * {
font-size: 100%!important; font-size: 100%!important;
} }


/**
* @subsection Heghlight
*/

.b-content .highlight-python, .b-content .highlight-python,
.b-content .highlight-html, .b-content .highlight-html,
.b-content .highlight { .b-content .highlight {
Expand Down Expand Up @@ -107,6 +119,12 @@
.m-search-focus .b-content .highlight { .m-search-focus .b-content .highlight {
background: #fffff0; background: #fffff0;
} }


/**
* @subsection Defenition lists
*/

.b-content dl { .b-content dl {
line-height: 1.4; line-height: 1.4;
} }
Expand All @@ -124,6 +142,12 @@
.b-content dd:last-child :last-child { .b-content dd:last-child :last-child {
margin-bottom: 0px; margin-bottom: 0px;
} }


/**
* @subsection Version added
*/

.b-content .versionadded { .b-content .versionadded {
font-size: 120%; font-size: 120%;
font-style: italic; font-style: italic;
Expand All @@ -132,6 +156,12 @@
.b-content .versionadded a { .b-content .versionadded a {
color: #11721a!important; color: #11721a!important;
} }


/**
* @subsection Warnings
*/

.b-content .admonition { .b-content .admonition {
padding-left: 60px; padding-left: 60px;
background: url(../images/warning.png) 0px 0px no-repeat; background: url(../images/warning.png) 0px 0px no-repeat;
Expand All @@ -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 * @subsection Pygments
*/ */
Expand Down
13 changes: 13 additions & 0 deletions djangodocs/livedocs/templates/livedocs/_dashboard.html
@@ -0,0 +1,13 @@

<section class="b-dashboard">
{% for panel in panels %}
<div class="b-dashboard__panel">
{% for item in panel %}
<article class="b-dashboard__section">
<h1 class="b-dashboard__section-header">{{ item.title }}</h1>
{{ item.content|safe }}
</article>
{% endfor %}
</div>
{% endfor %}
</section>
29 changes: 8 additions & 21 deletions djangodocs/livedocs/templates/livedocs/search.html
@@ -1,8 +1,13 @@
{% extends 'livedocs/layout/layout.html' %} {% extends 'livedocs/layout/layout.html' %}


{% load mptt_tags %} {% load mptt_tags %}
{% load dashboard %}



{% block title %} {{ title|striptags }} {% endblock %} {% block title %} {{ title|striptags }} {% endblock %}



{% block content %} {% block content %}
<section class="l-content b-content"> <section class="l-content b-content">
{% if document_items %} {% if document_items %}
Expand All @@ -17,25 +22,7 @@ <h1 id="{{ node.slug }}">{{ node.title }}</h1>
</section> </section>
{% endblock %} {% endblock %}



{% block dashboard %} {% block dashboard %}
{% comment %} {% dashboard %}
<section class="b-dashboard"> {% endblock %}
{% for root_item in root_items %}
<div class="b-dashboard__section">
<a href="{{ root_item.get_absolute_url }}"
class="b-dashboard__section-link">
{{ root_item.title }}
</a>
{% for secondary_item in root_item.get_children %}
<div class="b-dashboard__item">
<a href="{{ secondary_item.get_absolute_url }}"
class="b-dashboard__item-link">
{{ secondary_item.title }}
</a>
</div>
{% endfor %}
</div>
{% endfor %}
</section>
{% endcomment %}
{% endblock %}
30 changes: 30 additions & 0 deletions 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}
3 changes: 0 additions & 3 deletions djangodocs/livedocs/views.py
Expand Up @@ -116,9 +116,6 @@ def get(self, request, *args, **kwargs):
context['title'] = 'No results' context['title'] = 'No results'
#raise Exception(context['document_items']) #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 return context




Expand Down

0 comments on commit f1fcfdf

Please sign in to comment.