Merge "Horizon Context Selection should be to the right"
This commit is contained in:
commit
a2f0157d30
|
@ -198,3 +198,9 @@ $members-list-border: 1px solid $gray-light !default;
|
|||
$members-list-item-width: 130px !default;
|
||||
$members-list-item-max-width: 327px !default;
|
||||
$members-list-roles-width: 125px !default;
|
||||
|
||||
// Mimics the padding in _dropdowns.scss
|
||||
// Not sure why this is hardcoded :-/
|
||||
// https://github.com/twbs/bootstrap/issues/13443
|
||||
$dropdown-item-padding-vertical: 3px;
|
||||
$dropdown-item-padding-horizontal: 20px;
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
.context-selection {
|
||||
& > li > ul {
|
||||
padding: 0;
|
||||
|
||||
& > li {
|
||||
|
||||
&.dropdown-header,
|
||||
& > a {
|
||||
padding: $dropdown-item-padding-vertical $dropdown-item-padding-horizontal $dropdown-item-padding-vertical $dropdown-item-padding-horizontal*1.5;
|
||||
}
|
||||
|
||||
&.dropdown-header {
|
||||
color: $brand-primary;
|
||||
}
|
||||
|
||||
&:not(.dropdown-header):hover {
|
||||
background-color: $dropdown-link-hover-bg;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
& > a {
|
||||
position: relative;
|
||||
color: $navbar-default-color;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
|
||||
& > .fa.fa-check {
|
||||
float: left;
|
||||
position: absolute;
|
||||
left: $dropdown-item-padding-horizontal/2;
|
||||
line-height: $line-height-computed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.disabled {
|
||||
cursor: not-allowed;
|
||||
color: $dropdown-link-disabled-color;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@
|
|||
@import "components/charts";
|
||||
@import "components/workflow";
|
||||
@import "components/network_topology";
|
||||
@import "components/context_selection";
|
||||
@import "/framework/framework";
|
||||
|
||||
|
||||
|
|
|
@ -20,14 +20,36 @@
|
|||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown context-selection">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" role="button" aria-expanded="false">
|
||||
{% show_overview %}
|
||||
<span class="fa fa-caret-down"></span>
|
||||
</a>
|
||||
{% show_domain_list %}
|
||||
{% show_project_list %}
|
||||
{% show_region_list %}
|
||||
<ul class="dropdown-menu context-selection">
|
||||
|
||||
{% comment %}
|
||||
is_multidomain is only available through an assignment tag pulled in through context_selection
|
||||
{% endcomment %}
|
||||
{% is_multidomain as domain_supported %}
|
||||
{% if domain_supported %}
|
||||
<li>
|
||||
{% show_domain_list %}
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
{% show_project_list %}
|
||||
</li>
|
||||
|
||||
{% comment %}
|
||||
is_multi_region is only available through an assignment tag pulled in through context_selection
|
||||
{% endcomment %}
|
||||
{% is_multi_region as multi_region %}
|
||||
{% if multi_region %}
|
||||
<li>
|
||||
{% show_region_list %}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% load i18n %}
|
||||
{% if domain_supported %}
|
||||
|
||||
<ul>
|
||||
<li class="dropdown-header">{% trans "Domains:" %}</li>
|
||||
<li>
|
||||
|
@ -9,4 +9,3 @@
|
|||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% load url from future %}
|
||||
|
||||
{% with dashboard_url=request.horizon.dashboard.get_absolute_url %}
|
||||
<ul class="dropdown-menu">
|
||||
<ul>
|
||||
<li class="dropdown-header">{% trans "Projects:" %}</li>
|
||||
{% for project in projects %}
|
||||
<li>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% if multi_region %}
|
||||
{% with panel_url=request.horizon.panel.get_absolute_url %}
|
||||
<ul>
|
||||
<li class="dropdown-header">{% trans "Regions:" %}</li>
|
||||
|
@ -17,4 +16,3 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
|
|
@ -23,6 +23,10 @@ from openstack_dashboard.api import keystone
|
|||
register = template.Library()
|
||||
|
||||
|
||||
def is_multi_region_configured(request):
|
||||
return len(request.user.available_services_regions) > 1
|
||||
|
||||
|
||||
def is_multidomain_supported():
|
||||
return (keystone.VERSIONS.active >= 3 and
|
||||
getattr(settings,
|
||||
|
@ -30,6 +34,18 @@ def is_multidomain_supported():
|
|||
False))
|
||||
|
||||
|
||||
@register.assignment_tag(takes_context=True)
|
||||
def is_multi_region(context):
|
||||
if 'request' not in context:
|
||||
return False
|
||||
return is_multi_region_configured(context['request'])
|
||||
|
||||
|
||||
@register.assignment_tag
|
||||
def is_multidomain():
|
||||
return is_multidomain_supported()
|
||||
|
||||
|
||||
@register.inclusion_tag('context_selection/_overview.html',
|
||||
takes_context=True)
|
||||
def show_overview(context):
|
||||
|
@ -39,8 +55,7 @@ def show_overview(context):
|
|||
context = {'domain_supported': is_multidomain_supported(),
|
||||
'domain_name': request.user.user_domain_name,
|
||||
'project_name': request.user.project_name,
|
||||
'multi_region':
|
||||
len(request.user.available_services_regions) > 1,
|
||||
'multi_region': is_multi_region_configured(request),
|
||||
'region_name': request.user.services_region,
|
||||
'request': request}
|
||||
|
||||
|
@ -54,8 +69,7 @@ def show_domain_list(context):
|
|||
if 'request' not in context:
|
||||
return {}
|
||||
request = context['request']
|
||||
context = {'domain_supported': is_multidomain_supported(),
|
||||
'domain_name': request.user.user_domain_name,
|
||||
context = {'domain_name': request.user.user_domain_name,
|
||||
'request': request}
|
||||
return context
|
||||
|
||||
|
@ -82,9 +96,7 @@ def show_region_list(context):
|
|||
if 'request' not in context:
|
||||
return {}
|
||||
request = context['request']
|
||||
context = {'multi_region':
|
||||
len(request.user.available_services_regions) > 1,
|
||||
'region_name': request.user.services_region,
|
||||
context = {'region_name': request.user.services_region,
|
||||
'regions': sorted(request.user.available_services_regions),
|
||||
'request': request}
|
||||
return context
|
||||
|
|
|
@ -242,7 +242,7 @@ $dropdown-link-active-bg: $component-active-bg !default;
|
|||
$dropdown-link-disabled-color: $gray-light !default;
|
||||
|
||||
//** Text color for headers within dropdown menus.
|
||||
$dropdown-header-color: $gray-light !default;
|
||||
$dropdown-header-color: $gray !default;
|
||||
|
||||
//** Deprecated `$dropdown-caret-color` as of v3.1.0
|
||||
$dropdown-caret-color: #000 !default;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@import '/bootstrap/scss/bootstrap/mixins/_vendor-prefixes.scss';
|
||||
|
||||
@import 'components/_context_selection';
|
||||
@import 'components/sidebar';
|
||||
|
||||
.navbar-brand {
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
//Keep the native bootstrap experience for smaller screens
|
||||
@media(min-width: $screen-sm) {
|
||||
|
||||
.context-selection {
|
||||
width: auto;
|
||||
padding: 0;
|
||||
|
||||
& > li {
|
||||
display: table-cell;
|
||||
padding: $padding-xs-horizontal 0;
|
||||
|
||||
& > ul > li {
|
||||
|
||||
&.dropdown-header,
|
||||
& > a {
|
||||
padding: $dropdown-item-padding-vertical $dropdown-item-padding-horizontal*2 $dropdown-item-padding-vertical $dropdown-item-padding-horizontal;
|
||||
}
|
||||
|
||||
&.dropdown-header {
|
||||
color: $dropdown-header-color;
|
||||
}
|
||||
|
||||
& > a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
|
||||
& > .fa.fa-check {
|
||||
left: unset;
|
||||
float: unset;
|
||||
padding-left: $dropdown-item-padding-horizontal/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
border-right: 1px solid $gray-light;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.open .context-selection {
|
||||
display: table;
|
||||
|
||||
// display: table pushes down our little arrow a single pixel
|
||||
&:before {
|
||||
top: -($font-size-small/2);
|
||||
}
|
||||
|
||||
&:after {
|
||||
top: -($font-size-small/2) + 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue