implement jot reset button

This commit is contained in:
Mario Vavti 2018-05-20 09:23:44 +02:00
parent 7a1afc315d
commit 7e99931733
6 changed files with 37 additions and 6 deletions

View File

@ -185,7 +185,8 @@ class Network extends \Zotlabs\Web\Controller {
'editor_autocomplete' => true, 'editor_autocomplete' => true,
'bbco_autocomplete' => 'bbcode', 'bbco_autocomplete' => 'bbcode',
'bbcode' => true, 'bbcode' => true,
'jotnets' => true 'jotnets' => true,
'reset' => t('Reset form')
); );
if($deftag) if($deftag)
$x['pretext'] = $deftag; $x['pretext'] = $deftag;

View File

@ -50,7 +50,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.5.5' ); define ( 'STD_VERSION', '3.5.6' );
define ( 'ZOT_REVISION', '6.0a' ); define ( 'ZOT_REVISION', '6.0a' );

View File

@ -1304,6 +1304,8 @@ function status_editor($a, $x, $popup = false) {
$id_select = ''; $id_select = '';
$webpage = ((x($x,'webpage')) ? $x['webpage'] : ''); $webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
$reset = ((x($x,'reset')) ? $x['reset'] : '');
$feature_auto_save_draft = ((feature_enabled($x['profile_uid'], 'auto_save_draft')) ? "true" : "false"); $feature_auto_save_draft = ((feature_enabled($x['profile_uid'], 'auto_save_draft')) ? "true" : "false");
@ -1329,6 +1331,7 @@ function status_editor($a, $x, $popup = false) {
'$nocomment_enabled' => t('Comments enabled'), '$nocomment_enabled' => t('Comments enabled'),
'$nocomment_disabled' => t('Comments disabled'), '$nocomment_disabled' => t('Comments disabled'),
'$auto_save_draft' => $feature_auto_save_draft, '$auto_save_draft' => $feature_auto_save_draft,
'$reset' => $reset
)); ));
$tpl = get_markup_template('jot.tpl'); $tpl = get_markup_template('jot.tpl');
@ -1441,7 +1444,8 @@ function status_editor($a, $x, $popup = false) {
'$expiryModalCANCEL' => t('Cancel'), '$expiryModalCANCEL' => t('Cancel'),
'$expanded' => ((x($x, 'expanded')) ? $x['expanded'] : false), '$expanded' => ((x($x, 'expanded')) ? $x['expanded'] : false),
'$bbcode' => ((x($x, 'bbcode')) ? $x['bbcode'] : false), '$bbcode' => ((x($x, 'bbcode')) ? $x['bbcode'] : false),
'$parent' => ((array_key_exists('parent',$x) && $x['parent']) ? $x['parent'] : 0) '$parent' => ((array_key_exists('parent',$x) && $x['parent']) ? $x['parent'] : 0),
'$reset' => $reset
)); ));
if ($popup === true) { if ($popup === true) {

View File

@ -27,6 +27,16 @@
padding: 0.5rem; padding: 0.5rem;
} }
#jot-text-wrap {
position: relative;
}
#profile-jot-reset {
position: absolute;
top: 0px;
right: 0px;
}
#profile-jot-text { #profile-jot-text {
resize: none; resize: none;
border-width: 0px; border-width: 0px;
@ -39,6 +49,7 @@
#profile-jot-text.jot-expanded { #profile-jot-text.jot-expanded {
resize: vertical; resize: vertical;
height: 200px;
} }
#profile-jot-text.hover { #profile-jot-text.hover {

View File

@ -7,10 +7,11 @@ var pretext = '{{$pretext}}';
function initEditor(cb){ function initEditor(cb){
if (editor==false){ if (editor==false){
$("#profile-jot-text-loading").show(); $("#profile-jot-text-loading").show();
$("#profile-jot-reset").removeClass('d-none');
{{$geotag}} {{$geotag}}
if(plaintext == 'none') { if(plaintext == 'none') {
$("#profile-jot-text-loading").hide(); $("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200 }); //$("#profile-jot-text").css({ 'height': 200 });
{{if $bbco_autocomplete}} {{if $bbco_autocomplete}}
$("#profile-jot-text").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode $("#profile-jot-text").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
{{/if}} {{/if}}
@ -361,8 +362,16 @@ var activeCommentText = '';
$("#jot-title").val(''); $("#jot-title").val('');
$("#profile-jot-text").val(''); $("#profile-jot-text").val('');
$("#jot-category").val(''); $("#jot-category").val('');
postSaveChanges('clean',''); postSaveChanges('clean');
{{if $reset}}
$(".jothidden").hide();
$("#profile-jot-text").removeClass('jot-expanded');
$("#profile-jot-reset").addClass('d-none');
editor = false;
{{else}}
window.history.back(); window.history.back();
{{/if}}
} }
function itemFiler(id) { function itemFiler(id) {
@ -573,7 +582,7 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del
<script> <script>
var postSaveTimer = null; var postSaveTimer = null;
function postSaveChanges(action, type) { function postSaveChanges(action) {
if({{$auto_save_draft}}) { if({{$auto_save_draft}}) {
var doctype = $('#jot-webpage').val(); var doctype = $('#jot-webpage').val();

View File

@ -9,6 +9,7 @@
</div> </div>
{{/if}} {{/if}}
<div class="mb-4" id="profile-jot-wrapper"> <div class="mb-4" id="profile-jot-wrapper">
{{if $parent}} {{if $parent}}
<input type="hidden" name="parent" value="{{$parent}}" /> <input type="hidden" name="parent" value="{{$parent}}" />
{{/if}} {{/if}}
@ -41,6 +42,11 @@
</div> </div>
{{/if}} {{/if}}
<div id="jot-text-wrap"> <div id="jot-text-wrap">
{{if $reset}}
<button id="profile-jot-reset" class="btn btn-outline-secondary btn-sm d-none border-0" title="{{$reset}}" onclick="itemCancel(); return false;">
<i class="fa fa-close"></i>
</button>
{{/if}}
<textarea class="profile-jot-text" id="profile-jot-text" name="body" tabindex="2" placeholder="{{$placeholdtext}}" >{{$content}}</textarea> <textarea class="profile-jot-text" id="profile-jot-text" name="body" tabindex="2" placeholder="{{$placeholdtext}}" >{{$content}}</textarea>
</div> </div>
{{if $attachment}} {{if $attachment}}