Minor extensibility tweaks (sidebar context and div wrapper)

* Adds the request to the sidebar templatetag template contexts.
    Fixes bug 948670.
  * Adds a wrapper div around the usage summary information at the
    top of the common usage template.

Change-Id: I1404c52c6d5e75324038683dbb3a92276b075c78
This commit is contained in:
Gabriel Hurley 2012-03-06 20:29:21 -08:00
parent 93f8382057
commit 7affd63c35
2 changed files with 20 additions and 16 deletions

View File

@ -1,17 +1,19 @@
{% load i18n sizeformat %}
<form action="" method="get" id="date_form" class="form-horizontal">
<h3>{% trans "Select a month to query its usage" %}: </h3>
<div class="form-row">
{{ form.month }}
{{ form.year }}
<input class="btn btn-small" type="submit"/>
</div>
</form>
<div class="usage_info_wrapper">
<form action="" method="get" id="date_form" class="form-horizontal">
<h3>{% trans "Select a month to query its usage" %}: </h3>
<div class="form-row">
{{ form.month }}
{{ form.year }}
<input class="btn btn-small" type="submit"/>
</div>
</form>
<p id="activity">
<span><strong>{% trans "Active Instances" %}:</strong> {{ usage.summary.instances|default:'-' }}</span>
<span><strong>{% trans "Active Memory" %}:</strong> {{ usage.summary.memory_mb|mbformat|default:'-' }}</span>
<span><strong>{% trans "This Month's VCPU-Hours" %}:</strong> {{ usage.summary.vcpu_hours|floatformat:2|default:'-' }}</span>
<span><strong>{% trans "This Month's GB-Hours" %}:</strong> {{ usage.summary.disk_gb_hours|floatformat:2|default:'-' }}</span>
</p>
<p id="activity">
<span><strong>{% trans "Active Instances" %}:</strong> {{ usage.summary.instances|default:'-' }}</span>
<span><strong>{% trans "Active Memory" %}:</strong> {{ usage.summary.memory_mb|mbformat|default:'-' }}</span>
<span><strong>{% trans "This Month's VCPU-Hours" %}:</strong> {{ usage.summary.vcpu_hours|floatformat:2|default:'-' }}</span>
<span><strong>{% trans "This Month's GB-Hours" %}:</strong> {{ usage.summary.disk_gb_hours|floatformat:2|default:'-' }}</span>
</p>
</div>

View File

@ -68,7 +68,8 @@ def horizon_main_nav(context):
dashboards.append(dash)
return {'components': dashboards,
'user': context['request'].user,
'current': getattr(current_dashboard, 'slug', None)}
'current': getattr(current_dashboard, 'slug', None),
'request': context['request']}
@register.inclusion_tag('horizon/_subnav_list.html', takes_context=True)
@ -93,7 +94,8 @@ def horizon_dashboard_nav(context):
non_empty_panels = dict([(k, v) for k, v in panels.items() if len(v) > 0])
return {'components': non_empty_panels,
'user': context['request'].user,
'current': context['request'].horizon['panel'].slug}
'current': context['request'].horizon['panel'].slug,
'request': context['request']}
@register.inclusion_tag('horizon/common/_progress_bar.html')