Commit dbdcbb0f authored by Kostas Papadimitriou's avatar Kostas Papadimitriou

cloudbar: Include url invalidation parameter based on synnefo version

make cloudbar.{js,css} unique per version to enforce client reload
between previously cached versions after synnefo upgrades.
parent a3549d25
......@@ -19,12 +19,13 @@ $(document).ready(function(){
var USER_DATA = window.CLOUDBAR_USER_DATA || {'user': 'Not logged in', 'logged_in': false};
var COOKIE_NAME = window.CLOUDBAR_COOKIE_NAME || '_pithos2_a';
var VERSION = window.CLOUDBAR_VERSION || '';
var cssloc = window.CLOUDBAR_LOCATION || "http://127.0.0.1:8989/";
// load css
var css = $("<link />");
css.attr({rel:'stylesheet', type:'text/css', href:cssloc + 'cloudbar.css'});
css.attr({rel:'stylesheet', type:'text/css', href:cssloc + 'cloudbar.css?'+VERSION});
$("head").append(css);
// load extra css
......
......@@ -3,6 +3,7 @@ import json
from django.utils.safestring import mark_safe
from django.conf import settings
from synnefo.util import version
from synnefo_branding import settings as branding_settings
......@@ -38,6 +39,8 @@ def cloudbar(request):
CB_ACTIVE = getattr(settings, 'CLOUDBAR_ACTIVE', True)
CB_LOCATION = getattr(settings, 'CLOUDBAR_LOCATION')
CB_VERSION = version.get_component_version("webproject")
CB_COOKIE_NAME = getattr(settings, 'CLOUDBAR_COOKIE_NAME',
'okeanos_account')
CB_SERVICES_URL = getattr(settings, 'CLOUDBAR_SERVICES_URL')
......@@ -49,6 +52,7 @@ def cloudbar(request):
CB_CODE = """
<script type="text/javascript">
var CLOUDBAR_VERSION = '%(version)s';
var CLOUDBAR_LOCATION = "%(location)s";
var CLOUDBAR_COOKIE_NAME = "%(cookie_name)s";
var GET_SERVICES_URL = "%(services_url)s";
......@@ -58,7 +62,7 @@ def cloudbar(request):
var CLOUDBAR_EXTRA_CSS = %(branding_css)s;
$(document).ready(function(){
$.getScript(CLOUDBAR_LOCATION + 'cloudbar.js');
$.getScript(CLOUDBAR_LOCATION + 'cloudbar.js?' + CLOUDBAR_VERSION);
});
</script>
......@@ -76,6 +80,7 @@ def cloudbar(request):
'menu_url': CB_MENU_URL,
'height': str(CB_HEIGHT),
'bg_color': CB_BGCOLOR,
'version': CB_VERSION,
'branding_css': json.dumps(BRANDING_CSS)}
CB_CODE = mark_safe(CB_CODE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment