Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
fix #807: merging was supported after all
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 13, 2017
1 parent 9c634eb commit 97957b7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/cloud-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<button id="cloudPush" type="button" title="cloudPush"></button>
<span data-i18n="cloudNoData"></span>
<button id="cloudPull" type="button" title="cloudPull" disabled></button>
<!-- <button id="cloudPullAndMerge" type="button" title="cloudPullAndMerge" disabled></button> -->
<button id="cloudPullAndMerge" type="button" title="cloudPullAndMerge" disabled></button>
<p id="cloudError"><span></span></p>
<span id="cloudCog" class="fa">&#xf013;</span>
<div id="cloudOptions">
Expand Down
46 changes: 29 additions & 17 deletions src/css/cloud-ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,45 @@
background: url("../img/cloud.png") hsl(216, 100%, 93%);
border-radius: 3px;
margin: 0.5em 0;
padding: 1em;
padding: 1em 1em 0 1em;
position: relative;
}
#cloudWidget.hide {
display: none;
}
#cloudWidget > button {
font-size: 160%;
padding: 0.1em 0.2em;
}
#cloudPull[disabled] {
visibility: hidden;
}
#cloudPush:after ,
#cloudPull:before {
display: inline-block;
font-family: FontAwesome;
font-size: 160%;
font-style: normal;
font-weight: normal;
line-height: 1;
padding: 0.2em 0.25em 0.1em 0.25em;
position: relative;
vertical-align: baseline;
display: inline-block;
}
body[dir="ltr"] #cloudPush:after {
content: '\f0ee';
#cloudWidget > button[disabled] {
visibility: hidden;
}
body[dir="rtl"] #cloudPush:after {
#cloudWidget > button.error {
color: red;
}
#cloudPush:after {
content: '\f0ee';
}
body[dir="ltr"] #cloudPull:before {
#cloudPull:before,
#cloudPullAndMerge:before {
content: '\f0ed';
}
#cloudPullAndMerge {
margin: 0 0.25em;
}
body[dir="rtl"] #cloudPull:before {
content: '\f0ed';
#cloudPullAndMerge:after {
content: '\f067';
font-size: 50%;
position: absolute;
right: 0;
top: 10%;
}
#cloudWidget > span {
color: gray;
Expand All @@ -45,7 +51,13 @@ body[dir="rtl"] #cloudPull:before {
vertical-align: bottom;
white-space: pre;
}
#cloudWidget > .nodata {
#cloudError {
color: red;
margin: 0;
padding: 0.5em 0;
}
#cloudError > span {
font-size: x-small;
}
#cloudWidget > #cloudCog {
cursor: pointer;
Expand Down
10 changes: 10 additions & 0 deletions src/js/cloud-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var onCloudDataReceived = function(entry) {
self.cloud.data = entry.data;

uDom.nodeFromId('cloudPull').removeAttribute('disabled');
uDom.nodeFromId('cloudPullAndMerge').removeAttribute('disabled');

var timeOptions = {
weekday: 'short',
Expand Down Expand Up @@ -118,6 +119,14 @@ var pullData = function(ev) {

/******************************************************************************/

var pullAndMergeData = function() {
if ( typeof self.cloud.onPull === 'function' ) {
self.cloud.onPull(self.cloud.data, true);
}
};

/******************************************************************************/

var openOptions = function() {
var input = uDom.nodeFromId('cloudDeviceName');
input.value = self.cloud.options.deviceName;
Expand Down Expand Up @@ -188,6 +197,7 @@ var onInitialize = function(options) {

uDom('#cloudPush').on('click', pushData);
uDom('#cloudPull').on('click', pullData);
uDom('#cloudPullAndMerge').on('click', pullAndMergeData);
uDom('#cloudCog').on('click', openOptions);
uDom('#cloudOptions').on('click', closeOptions);
uDom('#cloudOptionsSubmit').on('click', submitOptions);
Expand Down
4 changes: 1 addition & 3 deletions src/js/user-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ self.cloud.onPush = function() {
};

self.cloud.onPull = function(data, append) {
if ( typeof data !== 'string' ) {
return;
}
if ( typeof data !== 'string' ) { return; }
if ( append ) {
data = rulesFromHTML('#diff .right li') + '\n' + data;
}
Expand Down

0 comments on commit 97957b7

Please sign in to comment.