aboutsummaryrefslogtreecommitdiff
path: root/extension/popup
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-01-06 15:39:22 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-01-06 15:39:22 +0100
commitabf15268acafe588191fffb7ca6ddb963244bb0f (patch)
tree0f582386d09eccd550c414e62337a7f630b2ddb1 /extension/popup
parent2f8aa00595ab40292019ca739041296c84703899 (diff)
downloadwallet-core-abf15268acafe588191fffb7ca6ddb963244bb0f.tar.xz
Refactor wallet into logic and extension interface.
Diffstat (limited to 'extension/popup')
-rw-r--r--extension/popup/balance-overview.html2
-rw-r--r--extension/popup/balance-overview.js17
-rw-r--r--extension/popup/balance-overview.tsx26
-rw-r--r--extension/popup/history.html32
-rw-r--r--extension/popup/history.tsx22
-rw-r--r--extension/popup/reserve-create-sepa.html2
-rw-r--r--extension/popup/reserve-create.html2
-rw-r--r--extension/popup/reserves.html2
-rw-r--r--extension/popup/transactions.html62
-rw-r--r--extension/popup/transactions.js39
10 files changed, 95 insertions, 111 deletions
diff --git a/extension/popup/balance-overview.html b/extension/popup/balance-overview.html
index 1bc80d97e..f6adc521d 100644
--- a/extension/popup/balance-overview.html
+++ b/extension/popup/balance-overview.html
@@ -22,7 +22,7 @@
<body>
<div id="header" class="nav">
<a href="balance-overview.html" class="active">Wallet</a>
- <a href="transactions.html">Transactions</a>
+ <a href="history.html">History</a>
<a href="reserves.html">Reserves</a>
<button id="debug">Debug!</button>
<button id="reset">Reset!</button>
diff --git a/extension/popup/balance-overview.js b/extension/popup/balance-overview.js
index 6b6aaf794..08ad465f4 100644
--- a/extension/popup/balance-overview.js
+++ b/extension/popup/balance-overview.js
@@ -1,5 +1,20 @@
+/*
+ This file is part of TALER
+ (C) 2016 GNUnet e.V.
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+ */
"use strict";
-document.addEventListener('DOMContentLoaded', (e) => {
+document.addEventListener("DOMContentLoaded", (e) => {
console.log("content loaded");
chrome.runtime.sendMessage({ type: "balances" }, function (wallet) {
let context = document.getElementById("balance-template").innerHTML;
diff --git a/extension/popup/balance-overview.tsx b/extension/popup/balance-overview.tsx
index a78111bb1..8a278d6a1 100644
--- a/extension/popup/balance-overview.tsx
+++ b/extension/popup/balance-overview.tsx
@@ -1,6 +1,22 @@
+/*
+ This file is part of TALER
+ (C) 2016 GNUnet e.V.
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+ */
+
"use strict";
-document.addEventListener('DOMContentLoaded', (e) => {
+document.addEventListener("DOMContentLoaded", (e) => {
console.log("content loaded");
chrome.runtime.sendMessage({type: "balances"}, function(wallet) {
let context = document.getElementById("balance-template").innerHTML;
@@ -12,16 +28,16 @@ document.addEventListener('DOMContentLoaded', (e) => {
el.onclick = (e) => {
let target: any = e.target;
chrome.tabs.create({
- "url": target.href
- });
+ "url": target.href
+ });
};
}
});
document.getElementById("debug").addEventListener("click", (e) => {
chrome.tabs.create({
- "url": chrome.extension.getURL("pages/debug.html")
- });
+ "url": chrome.extension.getURL("pages/debug.html")
+ });
});
document.getElementById("reset").addEventListener("click", (e) => {
chrome.runtime.sendMessage({type: "reset"});
diff --git a/extension/popup/history.html b/extension/popup/history.html
new file mode 100644
index 000000000..dccc84605
--- /dev/null
+++ b/extension/popup/history.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta charset="utf-8">
+ <link rel="stylesheet" href="popup.css" type="text/css">
+ <script src="../lib/util.js" type="text/javascript"></script>
+ <script src="history.js" type="text/javascript"></script>
+
+ <script id="balance-template" type="text/x-handlebars-template">
+ {{#each transactions}}
+ <p>bla</p>
+ {{else}}
+ There's nothing here. Go to
+ our <a href="http://demo.taler.net">demo site</a> to try GNU Taler.
+ {{/each}}
+ </script>
+</head>
+
+<body>
+<div id="header" class="nav">
+ <a href="balance-overview.html">Wallet</a>
+ <a href="history.html" class="active">Transactions</a>
+ <a href="reserves.html">Reserves</a>
+</div>
+
+<div id="content">
+ (Loading...)
+</div>
+
+</body>
+</html>
diff --git a/extension/popup/history.tsx b/extension/popup/history.tsx
new file mode 100644
index 000000000..387f19c80
--- /dev/null
+++ b/extension/popup/history.tsx
@@ -0,0 +1,22 @@
+/*
+ This file is part of TALER
+ (C) 2016 GNUnet e.V.
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+ */
+
+
+"use strict";
+
+document.addEventListener("DOMContentLoaded", (e) => {
+
+});
diff --git a/extension/popup/reserve-create-sepa.html b/extension/popup/reserve-create-sepa.html
index d360f05ed..12d02b832 100644
--- a/extension/popup/reserve-create-sepa.html
+++ b/extension/popup/reserve-create-sepa.html
@@ -9,7 +9,7 @@
<body>
<div id="header" class="nav">
<a href="balance-overview.html">Wallet</a>
- <a href="transactions.html">Transactions</a>
+ <a href="history.html">Transactions</a>
<a href="reserves.html" class="active">Reserves</a>
</div>
diff --git a/extension/popup/reserve-create.html b/extension/popup/reserve-create.html
index 423e519c1..165496ab6 100644
--- a/extension/popup/reserve-create.html
+++ b/extension/popup/reserve-create.html
@@ -9,7 +9,7 @@
<body>
<div id="header" class="nav">
<a href="balance-overview.html">Wallet</a>
- <a href="transactions.html">Transactions</a>
+ <a href="history.html">Transactions</a>
<a href="reserves.html" class="active">Reserves</a>
</div>
diff --git a/extension/popup/reserves.html b/extension/popup/reserves.html
index 0785cb5ca..424f59d3c 100644
--- a/extension/popup/reserves.html
+++ b/extension/popup/reserves.html
@@ -9,7 +9,7 @@
<body>
<div id="header" class="nav">
<a href="balance-overview.html">Wallet</a>
- <a href="transactions.html">Transactions</a>
+ <a href="history.html">Transactions</a>
<a href="reserves.html" class="active">Reserves</a>
</div>
diff --git a/extension/popup/transactions.html b/extension/popup/transactions.html
deleted file mode 100644
index e575f0227..000000000
--- a/extension/popup/transactions.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
- <meta charset="utf-8">
- <link rel="stylesheet" href="popup.css" type="text/css">
- <script src="../lib/util.js" type="text/javascript"></script>
- <script src="transactions.js" type="text/javascript"></script>
-
- <script id="balance-template" type="text/x-handlebars-template">
- {{#each transactions}}
- bla
- {{else}}
- Looks like you didn't make any transactions. Get some
- coins and <a>donate</a> something.
- {{/each}}
- </script>
-
-</head>
-
-<body>
-<div id="header" class="nav">
- <a href="balance-overview.html">Wallet</a>
- <a href="transactions.html" class="active">Transactions</a>
- <a href="reserves.html">Reserves</a>
-</div>
-
-<div id="content">
- <table id="transactions-table" class="hidden">
- <thead>
- <tr>
- <th>Date</th>
- <th>Amount</th>
- <th>Status</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <!--
- <tr>
- <td class="date">2015-12-21 13:37</td>
- <td class="amount">42 EUR</td>
- <td class="status">Completed</td>
- <td class="contract"><button>Contract</button></td>
- </tr>
- <tr>
- <td class="date">2015-12-22 10:01</td>
- <td class="amount">23 USD</td>
- <td class="status">Pending</td>
- <td class="contract"><button>Contract</button></td>
- </tr>
- -->
- </tbody>
- </table>
-
- <p id="no-transactions">
- There are no transactions to show.
- </p>
-</div>
-
-</body>
-</html>
diff --git a/extension/popup/transactions.js b/extension/popup/transactions.js
deleted file mode 100644
index fbd578114..000000000
--- a/extension/popup/transactions.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-
-function add_transaction (date, currency, amount, status, contract)
-{
- let table = document.getElementById('transactions-table');
- table.className = table.className.replace(/\bhidden\b/, '');
- let tr = document.createElement('tr');
- table.appendChild(tr);
-
- let td_date = document.createElement('td');
- td_date.className = 'date';
- let text_date = document.createTextNode(date_format (date));
- tr.appendChild(td_date).appendChild(text_date);
-
- let td_amount = document.createElement('td');
- td_amount.className = 'amount';
- let text_amount = document.createTextNode(amount +' '+ currency);
- tr.appendChild(td_amount).appendChild(text_amount);
-
- let td_status = document.createElement('td');
- td_status.className = 'status';
- let text_status = document.createTextNode(status);
- tr.appendChild(td_status).appendChild(text_status);
-
- let td_contract = document.createElement('td');
- td_contract.className = 'contract';
- let btn_contract = document.createElement('button');
- btn_contract.appendChild(document.createTextNode('Contract'));
- tr.appendChild(td_contract).appendChild(btn_contract);
-}
-
-document.addEventListener('DOMContentLoaded', function () {
- let no = document.getElementById('no-transactions');
-
- // FIXME
- no.className += ' hidden';
- add_transaction (new Date('2015-12-21 13:37'), 'EUR', 42, 'Completed', {});
- add_transaction (new Date('2015-12-22 10:01'), 'USD', 23, 'Pending', {});
-});