From 5dae0ef4f9be92d76260739348e7adf85c2fff19 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 10 May 2018 20:54:48 -0700 Subject: add cancel button to editor, fix issue with autosave of categories --- Zotlabs/Module/Article_edit.php | 1 + Zotlabs/Module/Card_edit.php | 1 + Zotlabs/Module/Editblock.php | 1 + Zotlabs/Module/Editlayout.php | 1 + Zotlabs/Module/Editpost.php | 1 + Zotlabs/Module/Editwebpage.php | 1 + Zotlabs/Module/Rpost.php | 1 + view/tpl/edpost_head.tpl | 7 +++++-- view/tpl/jot-header.tpl | 10 +++++++++- 9 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Article_edit.php b/Zotlabs/Module/Article_edit.php index 758c1db2e..89abccc40 100644 --- a/Zotlabs/Module/Article_edit.php +++ b/Zotlabs/Module/Article_edit.php @@ -128,6 +128,7 @@ class Article_edit extends \Zotlabs\Web\Controller { '$title' => t('Edit Article'), '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), '$id' => $itm[0]['id'], + '$cancel' => t('Cancel'), '$editor' => $editor )); diff --git a/Zotlabs/Module/Card_edit.php b/Zotlabs/Module/Card_edit.php index 7cc563fd2..694bdc4ea 100644 --- a/Zotlabs/Module/Card_edit.php +++ b/Zotlabs/Module/Card_edit.php @@ -128,6 +128,7 @@ class Card_edit extends \Zotlabs\Web\Controller { '$title' => t('Edit Card'), '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), '$id' => $itm[0]['id'], + '$cancel' => t('Cancel'), '$editor' => $editor )); diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php index 8a7e87a09..563ad9ca2 100644 --- a/Zotlabs/Module/Editblock.php +++ b/Zotlabs/Module/Editblock.php @@ -138,6 +138,7 @@ class Editblock extends \Zotlabs\Web\Controller { '$title' => t('Edit Block'), '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), '$id' => $itm[0]['id'], + '$cancel' => t('Cancel'), '$editor' => $editor )); diff --git a/Zotlabs/Module/Editlayout.php b/Zotlabs/Module/Editlayout.php index 3d6a79507..67e0bcd32 100644 --- a/Zotlabs/Module/Editlayout.php +++ b/Zotlabs/Module/Editlayout.php @@ -137,6 +137,7 @@ class Editlayout extends \Zotlabs\Web\Controller { '$title' => t('Edit Layout'), '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), '$id' => $itm[0]['id'], + '$cancel' => t('Cancel'), '$editor' => $editor )); diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php index 57a4cb97f..45d8e7644 100644 --- a/Zotlabs/Module/Editpost.php +++ b/Zotlabs/Module/Editpost.php @@ -106,6 +106,7 @@ class Editpost extends \Zotlabs\Web\Controller { $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit post'), + '$cancel' => t('Cancel'), '$editor' => $editor )); diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php index da536a729..b67421cd5 100644 --- a/Zotlabs/Module/Editwebpage.php +++ b/Zotlabs/Module/Editwebpage.php @@ -166,6 +166,7 @@ class Editwebpage extends \Zotlabs\Web\Controller { '$title' => t('Edit Webpage'), '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), '$editor' => $editor, + '$cancel' => t('Cancel'), '$id' => $itm[0]['id'] )); diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php index f0c4a06b9..86ee296ec 100644 --- a/Zotlabs/Module/Rpost.php +++ b/Zotlabs/Module/Rpost.php @@ -142,6 +142,7 @@ class Rpost extends \Zotlabs\Web\Controller { $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( '$title' => t('Edit post'), + '$cancel' => '', '$editor' => $editor )); diff --git a/view/tpl/edpost_head.tpl b/view/tpl/edpost_head.tpl index b2ab5db4e..4f39137ab 100755 --- a/view/tpl/edpost_head.tpl +++ b/view/tpl/edpost_head.tpl @@ -1,10 +1,13 @@
- {{if $delete}}
+ {{if $cancel}} + + {{/if}} + {{if $delete}}  {{$delete}} + {{/if}}
- {{/if}}

{{$title}}

diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index df67e9b2d..f2b68ece0 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -357,6 +357,14 @@ var activeCommentText = ''; } } + function itemCancel() { + $("#jot-title").val(''); + $("#profile-jot-text").val(''); + $("#jot-category").val(''); + postSaveChanges('clean',''); + window.history.back(); + } + function itemFiler(id) { if($('#item-filer-dialog').length) $('#item-filer-dialog').remove(); @@ -575,7 +583,7 @@ $( document ).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-del localStorage.setItem("post_title" + postid, $("#jot-title").val()); localStorage.setItem("post_body" + postid, $("#profile-jot-text").val()); if($("#jot-category").length) - localStorage.setItem("post_category + postid", $("#jot-category").val()); + localStorage.setItem("post_category" + postid, $("#jot-category").val()); } if(action == 'start') { -- cgit v1.2.3