+
{{title}}
+ {{expires}} +{{text}} +
diff --git a/www/assets/css/app.css b/www/assets/css/app.css index 9be9830..d8e4ca9 100644 --- a/www/assets/css/app.css +++ b/www/assets/css/app.css @@ -82,6 +82,10 @@ Framework7 and FontAwesome both have a .fab class font-size: var(--f7-block-font-size); } +.card-header.no-hairlines:after { + display: none; +} + .no-animation * { -webkit-transition: 10ms !important; -moz-transition: 10ms !important; diff --git a/www/assets/js/offers.js b/www/assets/js/offers.js new file mode 100644 index 0000000..ebe4ffa --- /dev/null +++ b/www/assets/js/offers.js @@ -0,0 +1,51 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +function openOffersAsync(routeTo, routeFrom, resolve, reject) { + app.dialog.preloader("Fetching latest deals..."); + + apirequest( + SETTINGS.apis.offers, + {}, + function (resp) { + app.dialog.close(); + if (resp.status == "ERROR") { + app.dialog.alert(resp.msg, "Error"); + reject(); + } else { + var context = { + offers: [] + }; + + for (var i = 0; i < resp.offers.length; i++) { + if (resp.offers[i].valid === true) { + // no expiration + resp.offers[i].expires = "Limited time offer"; + } else { + resp.offers[i].expires = "Expires " + formatTimestamp("l F j, Y", resp.offers[i].valid.to); + } + context.offers.push(resp.offers[i]); + } + + resolve({ + templateUrl: "pages/offers.html", + }, { + context: context + }); + } + }, + function (xhr) { + app.dialog.close(); + var error = $.parseJSON(xhr.responseText); + if (error && typeof error.msg != 'undefined') { + app.dialog.alert(error.msg, "Error"); + } else { + app.dialog.alert("A server or network error occurred.", "Error"); + } + reject(); + }, "GET"); +} \ No newline at end of file diff --git a/www/index.html b/www/index.html index 3bb7372..f931442 100644 --- a/www/index.html +++ b/www/index.html @@ -45,6 +45,7 @@ + \ No newline at end of file diff --git a/www/pages/offers.html b/www/pages/offers.html new file mode 100644 index 0000000..0f26ff3 --- /dev/null +++ b/www/pages/offers.html @@ -0,0 +1,46 @@ + + +
{{text}} +