From: Loic Baron <loic.baron@lip6.fr>
Date: Mon, 4 May 2015 09:28:10 +0000 (+0200)
Subject: Footer with version number
X-Git-Tag: myslice-1.4~30
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a602b50342633d82a2e451759cf6f91867a1c503;p=unfold.git

Footer with version number
---

diff --git a/myslice/settings.py b/myslice/settings.py
index 5fe21697..371296bb 100644
--- a/myslice/settings.py
+++ b/myslice/settings.py
@@ -1,5 +1,6 @@
 import os.path
 import logging
+import subprocess
 
 logger = logging.getLogger('myslice')
 
@@ -17,8 +18,6 @@ config = ConfigEngine()
 
 import myslice.components as components
 
-
-
 # import djcelery
 # djcelery.setup_loader()
 
@@ -29,7 +28,16 @@ try:
 except:
     building=True
 
+if not config.myslice.portal_version:
+    try:
+        PORTAL_VERSION = subprocess.check_output(["git", "describe"])
+    except:
+        PORTAL_VERSION = 'not using git' 
 
+print 'x'*100
+print PORTAL_VERSION
+print 'x'*100
+logger.debug('PORTAL_VERSION = ',PORTAL_VERSION)
 
 # DEBUG
 if config.myslice.debug :
diff --git a/myslice/urls.py b/myslice/urls.py
index 236e5ca5..237c0ab1 100644
--- a/myslice/urls.py
+++ b/myslice/urls.py
@@ -89,6 +89,7 @@ urls = [
     (r'^cache/(?P<action>[^/]+)/?$', 'rest.cache.dispatch'),
     (r'^initscript/(?P<action>[^/]+)/?$', 'rest.initscript.dispatch'),
     (r'^authority/(?P<action>[^/]+)/?$', 'rest.authority.dispatch'),
+    (r'^portal_version/?$', 'rest.portal_version.dispatch'),
     #
     # REST monitoring
     (r'^monitor/services/?$', 'rest.monitor.servicesStatus'),
diff --git a/portal/templates/_footer.html b/portal/templates/_footer.html
index ad231763..17f0a38f 100644
--- a/portal/templates/_footer.html
+++ b/portal/templates/_footer.html
@@ -8,9 +8,19 @@
         </div>
     </div>
     <div class="row">
-        <div class="col-md-12 copy">
+        <div class="col-md-10 copy">
             Copyright © UPMC Sorbonne Universités, on behalf of the OneLab consortium
         </div>
+        <div id="portal_version" class="col-md-2 copy">
+        </div>
     </div>
 </div>
-</div>
\ No newline at end of file
+</div>
+<script type="text/javascript">
+    $(document).ready(function() {
+        $.post("/portal_version/", function( data ) {
+            console.log(data);
+            $("#portal_version").html(data);
+        });
+    });
+</script>
diff --git a/portal/templates/fed4fire/fed4fire_footer.html b/portal/templates/fed4fire/fed4fire_footer.html
index d4db4be5..6c05c873 100644
--- a/portal/templates/fed4fire/fed4fire_footer.html
+++ b/portal/templates/fed4fire/fed4fire_footer.html
@@ -1 +1,11 @@
 <!--No foorter added for the moment -->
+<div id="portal_version" class="col-md-2 copy"></div>
+
+<script type="text/javascript">
+    $(document).ready(function() {
+        $.post("/portal_version/", function( data ) {
+            console.log(data);
+            $("#portal_version").html(data);
+        });
+    });
+</script>
diff --git a/portal/templates/smartfire/smartfire_footer.html b/portal/templates/smartfire/smartfire_footer.html
index 307f7d3c..7dd4a221 100644
--- a/portal/templates/smartfire/smartfire_footer.html
+++ b/portal/templates/smartfire/smartfire_footer.html
@@ -8,9 +8,16 @@
         </div>
     </div>
     <div class="row">
-        <div class="col-md-12 copy">
-            
-        </div>
+        <div class="col-md-10 copy"></div>
+        <div id="portal_version" class="col-md-2 copy"></div>
     </div>
 </div>
-</div>
\ No newline at end of file
+</div>
+<script type="text/javascript">
+    $(document).ready(function() {
+        $.post("/portal_version/", function( data ) {
+            console.log(data);
+            $("#portal_version").html(data);
+        });
+    });
+</script>