summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2015-05-11 16:03:41 +0200
committerAaron Parecki <aaron@parecki.com>2015-05-11 16:03:41 +0200
commit475175da5fd90162930acc123712a529f809f961 (patch)
tree4bb9d78c98e19a3fe246ed39fe2d9114288eb194 /public
parent3b7d766c31314a3d42d651b8c8f643ff8d6e15bd (diff)
adds a "new version available" banner and a dropdown menu for publish
made a nice looking dropdown menu for the publish button
Diffstat (limited to 'public')
-rw-r--r--public/editor/editor.js23
-rw-r--r--public/editor/style.css64
2 files changed, 84 insertions, 3 deletions
diff --git a/public/editor/editor.js b/public/editor/editor.js
index 17cc24e..a0873d6 100644
--- a/public/editor/editor.js
+++ b/public/editor/editor.js
@@ -31,11 +31,19 @@ $(function () {
});
$.post('/editor/test-login', {}, function(response) {
- $('#publish_btn').text(response.logged_in ? 'Publish' : 'Sign In');
+ $('#publish_btn span').text(response.logged_in ? 'Publish' : 'Sign In');
});
$('#publish_btn').click(function(){
- if($('#publish_btn').text() == 'Publish') {
+ if($('.publish-dropdown').hasClass('hidden')) {
+ $('.publish-dropdown').removeClass('hidden');
+ } else {
+ $('.publish-dropdown').addClass('hidden');
+ }
+ });
+
+ $('#--publish_btn').click(function(){
+ if($('#publish_btn span').text() == 'Publish') {
$.post('/editor/publish', {
name: $("#post-name").val(),
@@ -57,6 +65,7 @@ $(function () {
$('#new_btn').click(function(){
reset_page();
});
+
});
function reset_page() {
@@ -66,6 +75,16 @@ function reset_page() {
return localforage.setItem('currentdraft', {});
}
+function onUpdateReady() {
+ // Show the notice that says there is a new version of the app
+ $("#new_version_available").show();
+}
+
+window.applicationCache.addEventListener('updateready', onUpdateReady);
+if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
+ onUpdateReady();
+}
+
/* ************************************************ */
/* autosave loop */
var autosaveTimeout = false;
diff --git a/public/editor/style.css b/public/editor/style.css
index 8b0fae6..2f76cdb 100644
--- a/public/editor/style.css
+++ b/public/editor/style.css
@@ -69,10 +69,72 @@ img { border: 0; }
text-decoration: none;
text-align: center;
border: 1px #93dee5 solid;
- color: #60b1b8;
+ color: #72c1c8;
vertical-align: middle;
cursor: pointer;
}
+.toolbar .btn:hover {
+ border-color: #61a7ae;
+ color: #51a1a8;
+}
+
+.publish-dropdown {
+ position: absolute;
+ top: 62px;
+ right: 110px;
+ z-index: 1001;
+ background: white;
+ width: 280px;
+ min-height: 60px;
+ border: 1px solid #dbdbdb;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ box-shadow: 0 0 9px rgba(0,0,0,0.07);
+}
+.publish-dropdown .arrow {
+ clip: rect(0 14px 14px -4px);
+ transform: rotate(45deg);
+ margin-top: -7px;
+ position: absolute;
+ right: 20px;
+}
+.publish-dropdown .arrow::after {
+ content: '';
+ height: 16px;
+ width: 16px;
+ background: white;
+ display: block;
+ border: #dbdbdb 1px solid;
+}
+
+.hidden {
+ display: none;
+}
+
+/* ************************************** */
+/* App Cache */
+
+#new_version_available {
+ display: none;
+ position: fixed;
+ z-index: 1000;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background: rgba(246,206,217,0.3);
+}
+#new_version_available .inner {
+ padding: 10px;
+ width: 600px;
+ margin: 0 auto;
+ text-align: center;
+ font-weight: bold;
+ color: #cf224f;
+ font-size: 14px;
+ font-family: sans-serif;
+}
+
/* ************************************** */
/* Editor CSS */