From 02a1dfa2a1639fe1513c5655690467832d0c43e0 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 3 Apr 2020 12:59:29 -0600 Subject: [PATCH] Add Items: Put add and history tabs side by side on wide screens (#36) --- www/assets/css/tablet.css | 52 +++++++++++++++++++++++++++++++++++++++ www/assets/js/add.js | 18 +++++++++++++- www/index.html | 1 + www/pages/add.html | 36 ++++++++++++++++++++++++--- www/routes.js | 17 ++++++++----- 5 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 www/assets/css/tablet.css diff --git a/www/assets/css/tablet.css b/www/assets/css/tablet.css new file mode 100644 index 0000000..f209c5b --- /dev/null +++ b/www/assets/css/tablet.css @@ -0,0 +1,52 @@ +/* +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/. +*/ +/* + Created on : Apr 3, 2020, 11:55:50 AM + Author : Skylar Ittner +*/ + +.only-tablet { + display: none; +} + +@media all and (min-width: 768px) { + .only-tablet { + display: inherit; + } + .no-tablet { + display: none; + } + .page[data-name="add"] .tabbar { + /* Remove tab switcher at bottom of page */ + display: none; + height: 0; + } + .page[data-name="add"] .tabs { + /* Put tabs next to each other */ + display: flex; + } + .page[data-name="add"] .tabs .tab { + /* un-hide "non-active" tabs */ + display: block; + } + .page[data-name="add"] .tabs #add-tab { + width: 66.67% !important; + } + .page[data-name="add"] .tabs #history-tab { + width: 33.33% !important; + } + .page[data-name="add"] #history-empty-swipe-prompt { + display: none; + } + .page[data-name="add"] .page-content { + padding-top: 0; + padding-bottom: 0; + } + + .page[data-name="add"] .fab { + margin-bottom: 0; + } +} \ No newline at end of file diff --git a/www/assets/js/add.js b/www/assets/js/add.js index aa22cf2..644d2c3 100644 --- a/www/assets/js/add.js +++ b/www/assets/js/add.js @@ -78,6 +78,7 @@ $("#addpackagebtn").click(function () { + ' ' + ' ' + ''); + $("#tap-to-remove-history-prompt").removeClass("display-none"); }); }); @@ -93,6 +94,7 @@ $(".view-main").on("click", "#historylist .history-list-item", function () { $('#historylist .history-list-item[data-package="' + id + '"]').remove(); if ($('#historylist .history-list-item').length == 0) { $("#no-history").removeClass("display-none"); + $("#tap-to-remove-history-prompt").addClass("display-none"); } }); }); @@ -129,4 +131,18 @@ function toggleLettersInAddressNumber() { $("#housenumberinput").attr("type", "text"); $("#housenumberinput").attr("placeholder", "1A2B3"); } -} \ No newline at end of file +} + + +function setTabSwipable() { + var page = $(".page[data-name=add]"); + + // If the page has grown larger, refresh to disable swiping tabs + if (page.width() >= 768 && $(".tabs-swipeable-wrap")[0]) { + router.refreshPage(); + } +} + +$(window).on('resize', setTabSwipable); + +setTabSwipable(); \ No newline at end of file diff --git a/www/index.html b/www/index.html index 38e3d54..bacdf9e 100644 --- a/www/index.html +++ b/www/index.html @@ -20,6 +20,7 @@ + diff --git a/www/pages/add.html b/www/pages/add.html index 2c53270..a8920ed 100644 --- a/www/pages/add.html +++ b/www/pages/add.html @@ -4,7 +4,7 @@
-