Skip to content
This repository was archived by the owner on Oct 11, 2018. It is now read-only.

Commit 6970d1a

Browse files
committed
adds buttons for saving dashboard layout state and property to show/hide buttons
1 parent 7fecefb commit 6970d1a

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

ui/drawer.reel/_drawer.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,13 @@
122122
margin-right: 1em;
123123
}
124124
}
125+
126+
/* Drawer Layout Button */
127+
128+
.Drawer-layoutButton {
129+
display: none;
130+
131+
@nest .layout-has-changed & {
132+
display: inline-block;
133+
}
134+
}

ui/drawer.reel/drawer.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/drawer.reel/drawer.html

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"bindings": {
1313
"dashboardWidgets": {"<-": "@owner.currentUser.attributes.dashboardContext.widgets"},
14-
"sideBoardWidgets": {"<-": "@owner.currentUser.attributes.sideBoardContext.widgets"}
14+
"sideBoardWidgets": {"<-": "@owner.currentUser.attributes.sideBoardContext.widgets"},
15+
"classList.has('layout-has-changed')": {"<-": "@owner.hasDashboardLayoutChanged"}
1516
}
1617
},
1718
"horizontalScroll": {
@@ -52,6 +53,20 @@
5253
"element": {"#": "closeButton"},
5354
"value": "Done Editing"
5455
}
56+
},
57+
"restoreDefaultButton": {
58+
"prototype": "blue-shark/ui/button.reel",
59+
"properties": {
60+
"element": {"#": "restoreDefaultButton"},
61+
"value": "Restore default layout"
62+
}
63+
},
64+
"saveAsDefaultButton": {
65+
"prototype": "blue-shark/ui/button.reel",
66+
"properties": {
67+
"element": {"#": "saveAsDefaultButton"},
68+
"value": "Save as default layout"
69+
}
5570
}
5671
}
5772
</script>
@@ -60,7 +75,11 @@
6075
<div data-montage-id="owner" class="Drawer">
6176
<header>
6277
<h1 class="Drawer-title">Drag to add widgets</h1>
63-
<button data-montage-id="closeButton" class="Button--create"></button>
78+
<div>
79+
<button data-montage-id="restoreDefaultButton" class="Drawer-layoutButton"></button>
80+
<button data-montage-id="saveAsDefaultButton" class="Drawer-layoutButton"></button>
81+
<button data-montage-id="closeButton" class="Button--primary"></button>
82+
</div>
6483
</header>
6584
<div class="DrawerContent">
6685
<div class="Drawer-overlay">

ui/drawer.reel/drawer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@ exports.Drawer = AbstractDropZoneComponent.specialize(/** @lends Drawer# */ {
158158
this.sideBoardWidgets.splice(index, 1);
159159
}
160160
}
161+
},
162+
163+
handleRestoreDefaultButton: {
164+
value: function () {
165+
console.log("restore default");
166+
}
167+
},
168+
169+
handleSaveAsDefaultButton: {
170+
value: function () {
171+
console.log("save as default");
172+
}
161173
}
162174

163175
});

0 commit comments

Comments
 (0)