소스 검색

Add sponsoring slots on home, dashboard and about pages

Gaël Métais 7 년 전
부모
커밋
b3399f419e

+ 8 - 8
front/src/css/dashboard.css

@@ -158,14 +158,6 @@
 .summary .fromShare {
   margin-bottom: 3em;
 }
-.summary .apiTip {
-  font-size: 0.8em;
-  margin-bottom: 4em;
-  color: #413;
-}
-.summary .apiTip a {
-  color: inherit;
-}
 .summary .tweet .tweetText {
   color: #413;
   background: #F2F2F2;
@@ -189,3 +181,11 @@
 .summary .tweet input {
   font-size: 0.9em;
 }
+.summary .sponsor {
+  font-size: 0.9em;
+  margin-bottom: 4em;
+  color: #413;
+}
+.summary .sponsor a {
+  color: inherit;
+}

+ 3 - 0
front/src/css/index.css

@@ -177,3 +177,6 @@ input[type=submit].clicked {
   top: 0.2em;
   box-shadow: none;
 }
+.homeSponsor {
+  margin-top: 3em;
+}

+ 3 - 0
front/src/css/main.css

@@ -295,6 +295,9 @@ a.linkButton {
 .footer .github {
   margin: 1em 0 0 0.5em;
 }
+.footer .sponsor {
+  font-size: 0.9em;
+}
 [class^="icon-"]:before,
 [class*=" icon-"]:before {
   vertical-align: baseline;

+ 9 - 9
front/src/less/dashboard.less

@@ -158,15 +158,6 @@
     margin-bottom: 3em;
 }
 
-.summary .apiTip {
-    font-size: 0.8em;
-    margin-bottom: 4em;
-    color: #413;
-    a {
-        color: inherit;
-    }
-}
-
 .summary .tweet {
     .tweetText {
         color: #413;
@@ -189,4 +180,13 @@
     input {
         font-size: 0.9em;
     }
+}
+
+.summary .sponsor {
+    font-size: 0.9em;
+    margin-bottom: 4em;
+    color: #413;
+    a {
+        color: inherit;
+    }
 }

+ 4 - 0
front/src/less/index.less

@@ -199,4 +199,8 @@ input[type=submit].clicked {
     left: 0.1em;
     top: 0.2em;
     box-shadow: none;
+}
+
+.homeSponsor {
+    margin-top: 3em;
 }

+ 3 - 0
front/src/less/main.less

@@ -250,6 +250,9 @@ a.linkButton {
     .github {
         margin: 1em 0 0 0.5em;
     }
+    .sponsor {
+        font-size: 0.9em;
+    }
 }
 
 [class^="icon-"]:before, [class*=" icon-"]:before {

+ 4 - 0
front/src/views/about.html

@@ -5,5 +5,9 @@
 
     <p>By the way, <b>it's free</b> because we are geeks, not businessmen. All we want is <a href="https://github.com/gmetais/YellowLabTools" target="_blank" class="star">a <span>&#9733;</span> on GitHub</a>. It will boost our motivation to add more awesome features!!!</p>
 
+    <%if (sponsoring.about) { %>
+        <div class="sponsor"><%- sponsoring.about %></div>
+    <% } %>
+
     <p><br><a href="<%= baseUrl %>">Back to index</a></p>
 </div>

+ 4 - 3
front/src/views/dashboard.html

@@ -55,9 +55,10 @@
         </div>
     </div>
 
-    <div ng-if="!error && !fromSocialShare" class="apiTip">
-        <b>Did you know?</b> You can <b>bookmark</b> this result page URL or <b>share it</b>, Yellow Lab Tools keeps test results for years!
-    </div>
+    <%if (sponsoring.dashboard) { %>
+        <div ng-if="!error && !fromSocialShare" class="sponsor"><%- sponsoring.dashboard %></div>
+    <% } %>
+    
 
     <div class="tweet" ng-if="!error && !fromSocialShare">
         <form ng-submit="sendTweet()">

+ 4 - 0
front/src/views/index.html

@@ -110,3 +110,7 @@
         <p>Untangles the JavaScript spaghetti code</p>
     </div>
 </div>
+
+<%if (sponsoring.home) { %>
+    <div class="homeSponsor"><%- sponsoring.home %></div>
+<% } %>

+ 4 - 1
lib/server/controllers/frontController.js

@@ -1,6 +1,8 @@
 var path        = require('path');
 var express     = require('express');
 
+var serverSettings = (process.env.IS_TEST) ? require('../../../test/fixtures/settings.json') : require('../../../server_config/settings.json');
+
 var FrontController = function(app) {
     'use strict';
 
@@ -23,7 +25,8 @@ var FrontController = function(app) {
     app.get('/views/:viewName', function(req, res) {
         res.setHeader('Cache-Control', 'public, max-age=' + cacheDuration);
         res.render(path.join(__dirname, assetsPath, 'views/' + req.params.viewName), {
-            baseUrl: app.locals.baseUrl || '/'
+            baseUrl: app.locals.baseUrl || '/',
+            sponsoring: serverSettings.sponsoring || {}
         });
     });
     

+ 7 - 1
server_config/settings-prod.json

@@ -9,5 +9,11 @@
     },
     "maxAnonymousRunsPerDay": 99999999,
     "maxAnonymousCallsPerDay": 99999999,
-    "blockedUrls": []
+    "blockedUrls": [],
+
+    "sponsoring" : {
+        "home": "(this is a private instance)",
+        "dashboard": null,
+        "about": "(this is a private instance)"
+    }
 }

+ 7 - 1
server_config/settings.json

@@ -9,5 +9,11 @@
     },
     "maxAnonymousRunsPerDay": 99999999,
     "maxAnonymousCallsPerDay": 99999999,
-    "blockedUrls": []
+    "blockedUrls": [],
+
+    "sponsoring" : {
+        "home": "(this is a private instance)",
+        "dashboard": null,
+        "about": "(this is a private instance)"
+    }
 }