Commit 27e500f940c363d6cac3b32c0f78795b5fc06585

Authored by Adhidarma Hadiwinoto
1 parent f67b27e06e
Exists in master

expresso urls

Showing 2 changed files with 19 additions and 2 deletions Side-by-side Diff

... ... @@ -31,6 +31,10 @@ var app = express();
31 31  
32 32 var suppliers = config.globals.suppliers.split(',');
33 33  
  34 +if (!config.expresso_urls) {
  35 + config.expresso_urls = {};
  36 +}
  37 +
34 38 app.engine('.html', whiskers.__express);
35 39 app.engine('.txt', whiskers.__express);
36 40 app.engine('.json', whiskers.__express);
... ... @@ -59,9 +63,18 @@ function getBalances(suppliers, thousands, callback) {
59 63 if (thousands) {
60 64 value = numeral(res[i]).format('0,0');
61 65 }
  66 +
  67 + var url = '#';
  68 + var supplier = suppliers[i];
  69 +
  70 + if (config.expresso_urls[supplier]) {
  71 + url = config.expresso_urls[supplier];
  72 + }
  73 +
62 74 balances.push({
63   - title: suppliers[i],
  75 + title: supplier,
64 76 balance: value,
  77 + url: url,
65 78 });
66 79 }
67 80  
... ... @@ -29,7 +29,11 @@
29 29 <table class="table table-hover table-striped">
30 30 {for balance in balances}
31 31 <tr>
32   - <td>{balance.title}</td>
  32 + <td>
  33 + <a href="{balance.url}">
  34 + {balance.title}
  35 + </a>
  36 + </td>
33 37 <td>
34 38 <div class="pull-right">
35 39 {balance.balance}