Container Loader Image now Themable

The Container was still using the old loading.gif, which is a static
file that cannot be made themable. Now, just like the pending table
actions, it uses the bootstrap progress bar, thus making it theme
compliant, and now we can completely remove that gif from the code
base.

Change-Id: I382078e9f07084ef723c8d3dbdc8114e1467d46c
Partially-Implements: blueprint horizon-theme-css-reorg
Partially-Implements: blueprint bootstrap-html-standards
This commit is contained in:
Diana Whitten 2016-02-05 13:02:39 -07:00
parent e6a6adda4d
commit 45f3d34e32
5 changed files with 12 additions and 11 deletions

View File

@ -13,13 +13,11 @@
# under the License. # under the License.
import logging import logging
from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django import shortcuts from django import shortcuts
from django import template from django import template
from django.template import defaultfilters as filters from django.template import defaultfilters as filters
from django.utils import http from django.utils import http
from django.utils import safestring
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy from django.utils.translation import ungettext_lazy
@ -32,8 +30,6 @@ from openstack_dashboard.api import swift
from openstack_dashboard.dashboards.project.containers import utils from openstack_dashboard.dashboards.project.containers import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
static_url = getattr(settings, 'STATIC_URL', '/static/')
LOADING_IMAGE = '<img src="%s/dashboard/img/loading.gif" />' % static_url
class ViewContainer(tables.LinkAction): class ViewContainer(tables.LinkAction):
@ -240,7 +236,9 @@ class ContainerAjaxUpdateRow(tables.Row):
def get_metadata(container): def get_metadata(container):
# If the metadata has not been loading, display a loading image # If the metadata has not been loading, display a loading image
if not hasattr(container, 'is_public'): if not hasattr(container, 'is_public'):
return safestring.mark_safe(LOADING_IMAGE) return template.loader.render_to_string(
'project/containers/_container_loader.html'
)
template_name = 'project/containers/_container_metadata.html' template_name = 'project/containers/_container_metadata.html'
context = {"container": container} context = {"container": container}
return template.loader.render_to_string(template_name, context) return template.loader.render_to_string(template_name, context)

View File

@ -0,0 +1,5 @@
<div class="horizon-pending-bar container-pending-bar">
<div class="progress progress-striped active">
<div class="progress-bar" style="width: 100%"></div>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -142,9 +142,3 @@
.dropdown_fix { .dropdown_fix {
overflow: visible; overflow: visible;
} }
/* Does something with CPU hungry spin.js with animated gif */
.loading_gif {
margin-right: 0.5em;
float: left;
}

View File

@ -11,4 +11,8 @@
left: calc(50% - .5em); left: calc(50% - .5em);
bottom: calc(50% - .5em); bottom: calc(50% - .5em);
} }
&.container-pending-bar .progress {
margin-bottom: 0;
}
} }