diff --git a/assets/javascripts/views/layout/settings.coffee b/assets/javascripts/views/layout/settings.coffee index 6bf02479..0d731a70 100644 --- a/assets/javascripts/views/layout/settings.coffee +++ b/assets/javascripts/views/layout/settings.coffee @@ -9,6 +9,7 @@ class app.views.Settings extends app.View backBtn: 'button[data-back]' @events: + change: 'onChange' submit: 'onSubmit' click: 'onClick' @@ -52,6 +53,10 @@ class app.views.Settings extends app.View app.reload() return + onChange: => + @addClass('_dirty') + return + onEnter: => @save() return diff --git a/assets/stylesheets/components/_mobile.scss b/assets/stylesheets/components/_mobile.scss index b1863df1..ba2d29e9 100644 --- a/assets/stylesheets/components/_mobile.scss +++ b/assets/stylesheets/components/_mobile.scss @@ -32,7 +32,7 @@ ._header { position: fixed; } - ._header, ._list, ._sidebar-footer { + ._header, ._list { width: 100%; border-right: 0; box-shadow: none; @@ -42,7 +42,7 @@ ._settings { position: relative; } ._settings-tabs { display: block; } - ._header ._settings-btn { width: auto; } + ._header > ._settings-btn-back { width: auto; } // Header diff --git a/assets/stylesheets/components/_settings.scss b/assets/stylesheets/components/_settings.scss index 3d6dd701..6f9c289e 100644 --- a/assets/stylesheets/components/_settings.scss +++ b/assets/stylesheets/components/_settings.scss @@ -11,17 +11,14 @@ &._in { display: block; } - ._sidebar { - display: block !important; - - &:after { // padding bottom - content: ''; - display: block; - height: $headerHeight; - } - } + ._sidebar { display: block !important; } + + > ._header { justify-content: space-between; } - ._header { justify-content: space-between; } + &._dirty > ._header { + background: $noteGreenBackground; + border-color: $noteGreenBorder; + } } // @@ -79,25 +76,9 @@ } // -// Footer +// Settings buttons // -._sidebar-footer { - position: absolute; - z-index: $headerZ; - bottom: 0; - left: 0; - width: $sidebarWidth; - height: $headerHeight; - background: $noteGreenBackground; - border-top: 1px solid $noteGreenBorder; - border-right: 1px solid $noteGreenBorder; - @extend %border-box; - @extend %user-select-none; - - @media #{$mediumScreen} { width: $sidebarMediumWidth; } -} - ._settings-btn { display: block; width: 100%; @@ -122,6 +103,16 @@ } } +._settings-btn-back { + ._dirty & { display: none; } +} + +._settings-btn-save { + display: none; + + ._dirty & { display: block; } +} + // // Header tabs // @@ -129,6 +120,8 @@ ._settings-tabs { display: none; // mobile only margin-right: .5rem; + + ._dirty & { display: none !important; } } ._settings-tab { diff --git a/assets/stylesheets/components/_sidebar.scss b/assets/stylesheets/components/_sidebar.scss index 04f1ce7e..ff19772a 100644 --- a/assets/stylesheets/components/_sidebar.scss +++ b/assets/stylesheets/components/_sidebar.scss @@ -18,6 +18,8 @@ @extend %border-box; @extend %user-select-none; + &:focus { outline: none; } + ._overlay-scrollbars & { padding-top: 0; top: $headerHeight; diff --git a/views/app.erb b/views/app.erb index 509859fe..266202fc 100644 --- a/views/app.erb +++ b/views/app.erb @@ -40,19 +40,17 @@