From 27e500f940c363d6cac3b32c0f78795b5fc06585 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <gua@adhisimon.org>
Date: Thu, 5 Nov 2015 19:33:33 +0700
Subject: [PATCH] expresso urls

---
 index.js         | 15 ++++++++++++++-
 views/index.html |  6 +++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index 591ff43..34407c1 100644
--- a/index.js
+++ b/index.js
@@ -31,6 +31,10 @@ var app = express();
 
 var suppliers = config.globals.suppliers.split(',');
 
+if (!config.expresso_urls) {
+    config.expresso_urls = {};
+}
+
 app.engine('.html', whiskers.__express);
 app.engine('.txt', whiskers.__express);
 app.engine('.json', whiskers.__express);
@@ -59,9 +63,18 @@ function getBalances(suppliers, thousands, callback) {
             if (thousands) {
                 value = numeral(res[i]).format('0,0');
             }
+            
+            var url = '#';
+            var supplier = suppliers[i];
+            
+            if (config.expresso_urls[supplier]) {
+                url = config.expresso_urls[supplier];
+            }
+            
             balances.push({
-                title: suppliers[i],
+                title: supplier,
                 balance: value,
+                url: url,
             });
         }
         
diff --git a/views/index.html b/views/index.html
index d4c8330..859c7fa 100644
--- a/views/index.html
+++ b/views/index.html
@@ -29,7 +29,11 @@
     <table class="table table-hover table-striped">
     {for balance in balances}
         <tr>
-            <td>{balance.title}</td>
+            <td>
+                <a href="{balance.url}">
+                    {balance.title}
+                </a>
+            </td>
             <td>
                 <div class="pull-right">
                     {balance.balance}
-- 
1.9.0