From acafb9192a6402a3f3d60d5e6af11cb4576fc96c Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Wed, 4 Jan 2017 15:26:51 -0800 Subject: add tags, slug and status field to quill editor --- public/editor-files/editor.js | 29 +++++++++++++++++-------- public/editor-files/style.css | 50 +++++++++++++++++++++---------------------- 2 files changed, 44 insertions(+), 35 deletions(-) (limited to 'public') diff --git a/public/editor-files/editor.js b/public/editor-files/editor.js index 46b838d..63bb911 100644 --- a/public/editor-files/editor.js +++ b/public/editor-files/editor.js @@ -47,6 +47,7 @@ $(function() { $('#publish-success').addClass('hidden'); $('#publish-error').addClass('hidden'); $('#publish-help').removeClass('hidden'); + $('#publish-fields').removeClass('hidden'); } else { $('.publish-dropdown').addClass('hidden'); } @@ -69,10 +70,14 @@ $(function() { $('#publish-confirm').click(function(){ $('#publish-help').addClass('hidden'); $('#publish-in-progress').removeClass('hidden'); + $('#publish-fields').addClass('hidden'); $.post('/editor/publish', { name: $("#post-name").val(), - body: editor.serialize().content.value + body: editor.serialize().content.value, + category: csv_to_array($("#post-tags").val()), + slug: $("#post-slug").val(), + status: $("#post-status").val() }, function(response) { if(response.location) { reset_page().then(function(){ @@ -87,6 +92,7 @@ $(function() { $('#publish-error-debug').html(response.response).removeClass('hidden'); $('#publish-error').removeClass('hidden'); $('#publish-success').addClass('hidden'); + $('#publish-fields').removeClass('hidden'); } }); }); @@ -99,6 +105,10 @@ $(function() { }); }); + $("#post-status").change(function(){ + $("#published-status-warning").removeClass("hidden"); + }); + $.getJSON('/settings/html-content', function(data){ if(data.html == '0') { $('.micropub-html-warning').show(); @@ -108,22 +118,23 @@ $(function() { function reset_page() { $("#post-name").val(''); + $("#post-slug").val(''); + $("#post-tags").val(''); + $("#post-status").val('published'); $("#content").html(''); $("#draft-status").text("New"); $("#publish-confirm").hide(); return localforage.setItem('currentdraft', {}); } -function onUpdateReady() { - // Show the notice that says there is a new version of the app - $("#new_version_available").show(); +function csv_to_array(val) { + if(val.length > 0) { + return val.split(/[, ]+/); + } else { + return []; + } } -window.applicationCache.addEventListener('updateready', onUpdateReady); -if(window.applicationCache.status === window.applicationCache.UPDATEREADY) { - onUpdateReady(); -} - /* ************************************************ */ /* autosave loop */ var autosaveTimeout = false; diff --git a/public/editor-files/style.css b/public/editor-files/style.css index 9bb8042..e4099ee 100644 --- a/public/editor-files/style.css +++ b/public/editor-files/style.css @@ -22,6 +22,10 @@ h1, h2, h3, h4, h5, h6, th, td, caption { font-weight:normal; } img { border: 0; } + +/* ************************************** */ + + .micropub-html-warning { max-width: 600px; margin-left: auto; @@ -49,6 +53,8 @@ img { border: 0; } float: right; } + + /* ************************************** */ /* Toolbar */ @@ -120,15 +126,23 @@ img { border: 0; } input.form-field-small { height: 24px; - margin-top: 1px; + margin-top: 2px; font-size: 13px; color: #51a1a8; padding: 0 10px; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; border: 1px #93dee5 solid; } +select.form-select-small { + border-radius: 6px; + border: 1px #93dee5 solid; + height: 24px; + margin-top: 2px; + font-size: 13px; + color: #51a1a8; +} .publish-dropdown { position: fixed; @@ -165,6 +179,10 @@ input.form-field-small { .publish-dropdown .dropdown-content { padding: 9px; } +.publish-dropdown .dropdown-content, +.publish-dropdown .dropdown-content a { + color: #51a1a8; +} .publish-dropdown input { font-family: sans-serif; } @@ -182,30 +200,10 @@ pre#publish-error-debug { 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; +.small { + font-size: 0.8em; } - /* ************************************** */ /* Editor CSS */ -- cgit v1.2.3