Selaa lähdekoodia

Add version number to the home page

Gaël Métais 10 vuotta sitten
vanhempi
commit
13787708e9

+ 2 - 1
app/node_controllers/indexController.js

@@ -6,7 +6,7 @@ var async           = require('async');
 var fs              = require ('fs');
 var strReplace      = require('../lib/strReplace');
 
-var indexController = function(req, res, googleAnalyticsId) {
+var indexController = function(req, res, googleAnalyticsId, version) {
     'use strict';
 
     async.parallel({
@@ -18,6 +18,7 @@ var indexController = function(req, res, googleAnalyticsId) {
     }, function(err, results) {
         var html = results.htmlTemplate;
         html = strReplace(html, '%%GA_ID%%', googleAnalyticsId);
+        html = strReplace(html, '%%VERSION%%', version);
 
         res.setHeader('Content-Type', 'text/html');
         res.send(html);

+ 2 - 1
app/node_views/index.html

@@ -19,11 +19,12 @@
         <h3>If you want to learn more...</h3>
         <a target="_blank" href="http://gmetais.github.io/yellowlabtools/2014/11/20/what_is_yellow_lab_tools.html">What is Yellow Lab Tools?</a>
         <br>
-        <a target="_blank" href="http://gmetais.github.io/yellowlabtools/2014/11/18/untangle_the_js_spaghetti_code.html">How to deeply analyze your JavaScript?</a>
+        <a target="_blank" href="http://gmetais.github.io/yellowlabtools/2014/11/18/untangle_the_js_spaghetti_code.html">Learn how to deeply analyze your JavaScript</a>
     </div>
 
     <div class="footer">
         <p><b>Yellow Lab Tools</b> is an open source project by <a href="http://www.gaelmetais.com" target="_blank">Gaël Métais</a>, based on <a href="https://github.com/macbre/phantomas" target="_blank">Phantomas</a>.<br>If you like it, <a href="https://github.com/gmetais/YellowLabTools" target="_blank" class="star">give it a <span>&#9733;</span> on GitHub</a>!</p>
+        <p class="version">v%%VERSION%%</p>
     </div>
 
     <script>

+ 3 - 0
app/public/styles/index.css

@@ -18,6 +18,9 @@
   color: inherit;
   line-height: 1.7em;
 }
+.version {
+  font-size: 0.7em;
+}
 input[type=submit],
 input.url {
   padding: 0 0.5em;

+ 4 - 0
app/public/styles/less/index.less

@@ -22,6 +22,10 @@
     }
 }
 
+.version {
+    font-size: 0.7em;
+}
+
 input[type=submit], input.url {
     padding: 0 0.5em;
     margin: 0.5em;

+ 2 - 1
server.js

@@ -1,5 +1,6 @@
 // Config file
 var settings                = require('./server_config/settings.json');
+var pkg                     = require('./package.json');
 
 // Libraries
 var fs                      = require('fs');
@@ -32,7 +33,7 @@ app.all('*', function(req, res, next) {
 });
 
 // Routes definition
-app.get('/',                    function(req, res) { indexController(req, res, settings.googleAnalyticsId); });
+app.get('/',                    function(req, res) { indexController(req, res, settings.googleAnalyticsId, pkg.version); });
 app.post('/launchTest',         function(req, res) { launchTestController(req, res, testQueue, settings.googleAnalyticsId); });
 app.get('/results/:testId',     function(req, res) { resultsController(req, res, settings.googleAnalyticsId); });