Browse Source

adding alt text for banner image

main
jk 3 years ago
parent
commit
2e6a1e68a6
  1. 5
      controllers/editor.php
  2. 7
      public/editor-files/editor.js
  3. 1
      views/editor.php

5
controllers/editor.php

@ -51,11 +51,6 @@ $app->post('/editor/publish', function() use($app) {
$micropub_request['post-status'] = $params['status']; $micropub_request['post-status'] = $params['status'];
} }
if(array_key_exists('syndicate', $params) && $params['syndicate']) {
if($params['syndicate'] == 'yes')
$micropub_request['mp_syndicate_to'] = "gts";
}
if(array_key_exists('publish', $params) && $params['publish'] != 'now') { if(array_key_exists('publish', $params) && $params['publish'] != 'now') {
$micropub_request['published'] = $params['publish']; $micropub_request['published'] = $params['publish'];
} }

7
public/editor-files/editor.js

@ -73,7 +73,7 @@ $(function() {
$('#publish-fields').addClass('hidden'); $('#publish-fields').addClass('hidden');
var category = $("#post-tags").tokenfield("getTokens").map(function(t){ return t.value}); var category = $("#post-tags").tokenfield("getTokens").map(function(t){ return t.value});
$.post('/editor/publish', { $.post('/editor/publish', {
name: $("#post-name").val(), name: $("#post-name").val(),
description: $("#post-description").val(), description: $("#post-description").val(),
@ -143,6 +143,7 @@ function reset_page() {
$("#post-name").val(''); $("#post-name").val('');
$("#post-description").val(''); $("#post-description").val('');
$("#post-image").val(''); $("#post-image").val('');
$("#post-imagealt").val('');
$("#post-slug").val(''); $("#post-slug").val('');
$("#post-tags").tokenfield('setTokens',[]); $("#post-tags").tokenfield('setTokens',[]);
$("#post-status").val('published'); $("#post-status").val('published');
@ -167,6 +168,7 @@ function doAutoSave() {
title: $("#post-name").val(), title: $("#post-name").val(),
description: $("#post-description").val(), description: $("#post-description").val(),
image: $("#post-image").val(), image: $("#post-image").val(),
imagealt: $("#post-imagealt").val(),
body: editor.serialize().content.value, body: editor.serialize().content.value,
tags: $("#post-tags").tokenfield('getTokensList'), tags: $("#post-tags").tokenfield('getTokensList'),
slug: $("#post-slug").val(), slug: $("#post-slug").val(),
@ -197,6 +199,7 @@ $(function(){
$("#post-publish-date").val(val.publish); $("#post-publish-date").val(val.publish);
$("#post-description").val(val.description); $("#post-description").val(val.description);
$("#post-image").val(val.image); $("#post-image").val(val.image);
$("#post-imagealt").val(val.image);
// drop the cursor into the editor which clears the placeholder text // drop the cursor into the editor which clears the placeholder text
$("#content").focus().click(); $("#content").focus().click();
activateTokenField(); activateTokenField();
@ -218,5 +221,5 @@ editor.on(document.getElementById('content'), 'input', function(){
contentChanged(); contentChanged();
}); });
$(function(){ $(function(){
$('#post-name, #post-description, #post-image, #post-tags, #post-slug, #post-publish-date').on('keyup', contentChanged);
$('#post-name, #post-description, #post-image, #post-imagealt, #post-tags, #post-slug, #post-publish-date').on('keyup', contentChanged);
}); });

1
views/editor.php

@ -127,6 +127,7 @@
<input id="post-name" type="text" value="" placeholder="Title"> <input id="post-name" type="text" value="" placeholder="Title">
<input id="post-description" type="text" value="" placeholder="Description"> <input id="post-description" type="text" value="" placeholder="Description">
<input id="post-image" type="text" value="" placeholder="Banner Image"> <input id="post-image" type="text" value="" placeholder="Banner Image">
<input id="post-imagealt" type="text" value="" placeholder="Banner Image Alt. Text">
<div id="content" class="editable"></div> <div id="content" class="editable"></div>
<span style="font-size:18px">Syndicate? </span><select id="post-syndicate" class="form-select-small"> <span style="font-size:18px">Syndicate? </span><select id="post-syndicate" class="form-select-small">
<option value="no">No</option> <option value="no">No</option>

Loading…
Cancel
Save