7a58d15aec
Adds a common detail page and a breadcrumb templatetag. The breadcrumb templatetag defaults to displaying the panel name and the existing page title, which is usually name_or_id. The templatetag can also access the context, and accepts a "custom_breadcrumb", for complex nested pages or customised layouts. This type of navigation is also useful for small devices (mobile/ tablet), providing logical direction that isn't dependant on the sidebar being displayed. Currently implemented in Images, Volumes (simple breadcrumb), Ports and Subnets (more complex nesting). This approach has been chosen as manipulation of the URLs was seen as undesirable, making request.path too unreliable. Furthermore, the templatetag seperation means this could easily be used in other views. NOTE: The network details page itself will be updated following the resolution of https://bugs.launchpad.net/horizon/+bug/1416838 Change-Id: I7443b2ffa61560e5d1fd4d6d91b11201f1db6fac Partial-Bug: 1413823
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
# Copyright 2015 Cisco Systems, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from django import template
|
|
|
|
register = template.Library()
|
|
|
|
|
|
@register.inclusion_tag('horizon/common/_breadcrumb_nav.html',
|
|
takes_context=True)
|
|
def breadcrumb_nav(context):
|
|
return {'actions': context.get('actions'),
|
|
'breadcrumb': context.get('custom_breadcrumb'),
|
|
'url': context.get('url'),
|
|
'page_title': context['page_title'],
|
|
'panel': context.request.horizon['panel'], }
|