mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Adding new save-bar directive for handling save actions for index pages
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
angular.module("admin.indexUtils").directive "saveBar", ->
|
||||
restrict: "E"
|
||||
scope:
|
||||
save: "&"
|
||||
saving: "&"
|
||||
dirty: "&"
|
||||
templateUrl: "admin/save_bar.html"
|
||||
10
app/assets/javascripts/templates/admin/save_bar.html.haml
Normal file
10
app/assets/javascripts/templates/admin/save_bar.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
#save-bar.animate-show{ ng: { show: 'dirty()' } }
|
||||
.twelve.columns.alpha
|
||||
%h5{ ng: { show: "dirty() && !saving()" } }
|
||||
You have made unsaved changes
|
||||
%h5{ ng: { hide: "dirty() || saving()" } }
|
||||
All changes saved
|
||||
%h5{ ng: { show: "saving()" } }
|
||||
Saving...
|
||||
.four.columns.omega.text-right
|
||||
%input.red{type: "button", value: "Save Changes", ng: { click: "save()" } }
|
||||
35
app/assets/stylesheets/admin/animations.css.sass
Normal file
35
app/assets/stylesheets/admin/animations.css.sass
Normal file
@@ -0,0 +1,35 @@
|
||||
@-webkit-keyframes slideInUp
|
||||
0%
|
||||
-webkit-transform: translateY(20px)
|
||||
transform: translateY(20px)
|
||||
100%
|
||||
-webkit-transform: translateY(0)
|
||||
transform: translateY(0)
|
||||
|
||||
// @-webkit-keyframes slideOutDown
|
||||
// 0%
|
||||
// -webkit-transform: translateY(0)
|
||||
// transform: translateY(0)
|
||||
// 100%
|
||||
// -webkit-transform: translateY(20px)
|
||||
// transform: translateY(20px)
|
||||
|
||||
.animate-show
|
||||
-webkit-animation-name: slideInUp
|
||||
animation-name: slideInUp
|
||||
-webkit-animation-duration: 0.3s
|
||||
animation-duration: 0.3s
|
||||
-webkit-animation-fill-mode: both
|
||||
animation-fill-mode: both
|
||||
// line-height: 20px
|
||||
// opacity: 1
|
||||
|
||||
// &.ng-hide
|
||||
// -webkit-animation-name: slideOutDown
|
||||
// animation-name: slideOutDown
|
||||
// -webkit-animation-duration: 0.5s
|
||||
// animation-duration: 0.5s
|
||||
// -webkit-animation-fill-mode: both
|
||||
// animation-fill-mode: both
|
||||
// // line-height: 20px
|
||||
// // opacity: 1
|
||||
9
app/assets/stylesheets/admin/components/save_bar.sass
Normal file
9
app/assets/stylesheets/admin/components/save_bar.sass
Normal file
@@ -0,0 +1,9 @@
|
||||
#save-bar
|
||||
position: fixed
|
||||
bottom: 0px
|
||||
padding: 8px 10px
|
||||
font-weight: bold
|
||||
background-color: #fff
|
||||
color: #5498da
|
||||
h5
|
||||
color: #5498da
|
||||
Reference in New Issue
Block a user