diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 3545417af..b787fb63b 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -663,6 +663,20 @@ display: inline-flex; align-items: center; } + &.cp-toolbar-unsync { + .cp-toolbar-title-edit, .cp-toolbar-title-save { + display: none !important; + } + .cp-toolbar-title-unsync { + display: inline-flex; + } + .cp-toolbar-title-editable, .cp-toolbar-title-edit { + border: none !important; + } + } + .cp-toolbar-title-unsync { + display: none; + } .cp-toolbar-title-hoverable { display: inline-flex; overflow: hidden; diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index deb9563c0..88a81f90f 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -162,6 +162,8 @@ define([ } else { state = newState; } + } else if (state === STATE.READY) { + // Refreshing ready state } switch (state) { case STATE.DISCONNECTED: @@ -311,6 +313,7 @@ define([ }; var closeSnapshot = function (restore) { if (restore && state !== STATE.READY) { return false; } + toolbar.setSnapshot(false); setUnsyncMode(false); // Unlock onLocal and onRemote if (restore) { onLocal(); } // Restore? commit the content onRemote(); // Make sure we're back to the realtime content @@ -318,6 +321,7 @@ define([ }; var loadSnapshot = function (hash, data) { setUnsyncMode(true); + toolbar.setSnapshot(true); Snapshots.create(common, { readOnly: readOnly, $toolbar: $(toolbarContainer), @@ -326,10 +330,8 @@ define([ close: closeSnapshot, applyVal: function (val) { var newContent = JSON.parse(val); - /* var meta = extractMetadata(newContent); cpNfInner.metadataMgr.updateMetadata(meta); - */ contentUpdate(normalize(newContent) || ["BODY",{},[]], function (h) { return h; }); diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 22068bdba..1b3dcc17c 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -661,6 +661,8 @@ MessengerUI, Messages) { .text('('+Messages.readonly+')')); return $titleContainer; } + $hoverable.append($('', {'class': 'cp-toolbar-title-readonly cp-toolbar-title-unsync'}) + .text('('+Messages.readonly+')')); var $input = $('', { type: 'text', placeholder: placeholder @@ -1348,10 +1350,22 @@ MessengerUI, Messages) { } }; + toolbar.setSnapshot = function (bool) { + toolbar.history = bool; + toolbar.title.toggleClass('cp-toolbar-unsync', bool); + if (bool && toolbar.spinner) { + toolbar.spinner.text("SNAPSHOT"); // XXX + } else { + kickSpinner(toolbar, config); + } + }; toolbar.setHistory = function (bool) { toolbar.history = bool; + toolbar.title.toggleClass('cp-toolbar-unsync', bool); if (bool && toolbar.spinner) { toolbar.spinner.text("HISTORY"); // XXX + } else { + kickSpinner(toolbar, config); } };