From 5ebe952205e61a8dbf0c94075a7df58b2c373104 Mon Sep 17 00:00:00 2001 From: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com> Date: Wed, 30 Dec 2020 17:49:47 +0100 Subject: [PATCH] Format javascript and css files --- assets/css/app.scss | 49 ++++++++------- assets/css/vendor/modal-fx.scss | 59 +++++++++---------- assets/js/socket.js | 4 +- .../controllers/drive_controller.ex | 5 +- 4 files changed, 57 insertions(+), 60 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index acdb655c..f03fa071 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -4,7 +4,7 @@ @import "~leaflet-control-geocoder/dist/Control.Geocoder.css"; @import "~@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css"; -$mdi-font-path: '~@mdi/font/fonts'; +$mdi-font-path: "~@mdi/font/fonts"; @import "~@mdi/font/scss/materialdesignicons.scss"; $notification-padding: 0.75rem 1.25rem 0.75rem 0.75rem; @@ -43,11 +43,11 @@ $modal-card-foot-border-top: none; @import "~bulma/sass/layout/section"; @import "~bulma/sass/grid/_all"; -@import '~@creativebulma/bulma-tooltip'; -@import '~@creativebulma/bulma-divider'; -@import '~bulma-switch'; +@import "~@creativebulma/bulma-tooltip"; +@import "~@creativebulma/bulma-divider"; +@import "~bulma-switch"; -@import './vendor/modal-fx'; +@import "./vendor/modal-fx"; // @import "../../deps/phoenix_live_view/assets/css/live_view.css"; .phx-disconnected { @@ -117,7 +117,6 @@ nav.navbar { th:first-of-type { width: 50%; } - } @media screen and (max-width: 900px) { @@ -127,7 +126,6 @@ nav.navbar { } } - @media screen and (min-width: $tablet) { flex-direction: row; @@ -151,7 +149,7 @@ nav.navbar { } } - button[phx-click=suspend_logging]:disabled { + button[phx-click="suspend_logging"]:disabled { pointer-events: none; } } @@ -182,7 +180,6 @@ nav.navbar { .field-label { min-width: 165px; - .tooltip:before { text-align: left !important; } @@ -197,8 +194,8 @@ nav.navbar { } } -$sizes: (0,5,10,15,20,25,30,50); -$positions: ('top','left','bottom','right'); +$sizes: (0, 5, 10, 15, 20, 25, 30, 50); +$positions: ("top", "left", "bottom", "right"); @each $size in $sizes { @each $position in $positions { @@ -215,20 +212,19 @@ $positions: ('top','left','bottom','right'); font-size: 1.25em; } -@media screen and (orientation: landscape) and (max-width: $desktop - 1) { - body{ +@media screen and (orientation: landscape) and (max-width: $desktop - 1) { + body { -webkit-text-size-adjust: none; } .navbar .navbar-brand, .navbar .navbar-end, - main.section .container{ + main.section .container { max-width: 95%; } .navbar .navbar-brand, - .navbar .navbar-end - { + .navbar .navbar-end { margin: 0 auto; } } @@ -272,17 +268,17 @@ $positions: ('top','left','bottom','right'); .spinner { display: inline-flex; justify-content: center; - height: 1.0rem; - width: 1.0rem; + height: 1rem; + width: 1rem; .is-loading { - position: relative; - pointer-events: none; - &:after { - @extend %loader; - @include center(1em); - position: absolute !important; - } + position: relative; + pointer-events: none; + &:after { + @extend %loader; + @include center(1em); + position: absolute !important; + } } } @@ -307,7 +303,8 @@ main.full-height { .about { margin-top: 50px; - th, td { + th, + td { border: none; } } diff --git a/assets/css/vendor/modal-fx.scss b/assets/css/vendor/modal-fx.scss index 26aa0586..81980cc2 100644 --- a/assets/css/vendor/modal-fx.scss +++ b/assets/css/vendor/modal-fx.scss @@ -1,42 +1,41 @@ // source: https://github.com/postare/bulma-modal-fx/blob/master/src/_scss/components/_modal-fx.scss -$transition-duration: .3s; +$transition-duration: 0.3s; .modal { - display: flex; - visibility: hidden; + display: flex; + visibility: hidden; - .modal-content { - max-width: 95%; - } + .modal-content { + max-width: 95%; + } + .modal-background { + transition: all $transition-duration; + opacity: 0; + } + + &.is-active { + visibility: visible; .modal-background { - transition: all $transition-duration; + opacity: 1; + } + } + + &.modal-fx { + &-fadeInScale { + .modal-content { + transform: scale(0.7); opacity: 0; - } + transition: all $transition-duration; + } - &.is-active { - visibility: visible; - .modal-background { - opacity: 1; - } - } - - &.modal-fx { - &-fadeInScale { - .modal-content { - transform: scale(0.7); - opacity: 0; - transition: all $transition-duration; - } - - &.is-active { - .modal-content { - transform: scale(1); - opacity: 1; - } - } + &.is-active { + .modal-content { + transform: scale(1); + opacity: 1; } + } } + } } - diff --git a/assets/js/socket.js b/assets/js/socket.js index 7fc80703..2738a778 100644 --- a/assets/js/socket.js +++ b/assets/js/socket.js @@ -58,10 +58,10 @@ socket.connect(); let channel = socket.channel("topic:subtopic", {}); channel .join() - .receive("ok", resp => { + .receive("ok", (resp) => { console.log("Joined successfully", resp); }) - .receive("error", resp => { + .receive("error", (resp) => { console.log("Unable to join", resp); }); diff --git a/lib/teslamate_web/controllers/drive_controller.ex b/lib/teslamate_web/controllers/drive_controller.ex index 3f879bfb..58005568 100644 --- a/lib/teslamate_web/controllers/drive_controller.ex +++ b/lib/teslamate_web/controllers/drive_controller.ex @@ -3,14 +3,15 @@ defmodule TeslaMateWeb.DriveController do require Logger import Ecto.Query - alias TeslaMate.Log.Drive + + alias TeslaMate.Log.{Drive, Position} alias TeslaMate.Repo def gpx(conn, %{"id" => id}) do drive = Drive |> Repo.get(id) - |> Repo.preload(positions: from(p in TeslaMate.Log.Position, order_by: p.date)) + |> Repo.preload(positions: from(p in Position, order_by: p.date)) case drive do nil -> conn |> send_resp(404, "Drive not found")