File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed
Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ const modulesRoutes = [
8181 {
8282 page : 'shortcuts' ,
8383 handler : 'applyShortcutsPageHandlers'
84+ } ,
85+ {
86+ page : 'tags' ,
87+ handler : 'applyTagsPageHandlers'
8488 }
8589]
8690
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ public function process() {
102102 Hm_Tags::add ($ tag );
103103 Hm_Msgs::add ('Tag Created ' );
104104 }
105+ $ this ->session ->set ('tags_updated ' , true );
105106 }
106107}
107108
@@ -117,6 +118,7 @@ public function process() {
117118 if (($ tag = Hm_Tags::get ($ form ['tag_id ' ]))) {
118119 Hm_Tags::del ($ tag ['id ' ]);
119120 Hm_Msgs::add ('Tag Deleted ' );
121+ $ this ->session ->set ('tags_updated ' , true );
120122 } else {
121123 Hm_Msgs::add ('Tag ID not found ' , 'warning ' );
122124 return ;
@@ -189,6 +191,10 @@ class Hm_Handler_tag_data extends Hm_Handler_Module {
189191 public function process () {
190192 Hm_Tags::init ($ this );
191193 $ this ->out ('tags ' , Hm_Tags::getAll ());
194+ if ($ this ->session ->get ('tags_updated ' )) {
195+ $ this ->out ('tags_updated ' , true );
196+ $ this ->session ->set ('tags_updated ' , false );
197+ }
192198 }
193199}
194200
Original file line number Diff line number Diff line change 1+ function applyTagsPageHandlers ( ) {
2+ if ( window . tagsUpdated ) {
3+ Hm_Folders . reload_folders ( true ) ;
4+ }
5+ }
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ protected function output() {
117117 // Generate the tree view HTML
118118 $ treeViewHtml = generate_tree_view ($ folderTree , $ this ->html_safe (Hm_Request_Key::generate ()));
119119 $ treeContent = count ($ folderTree ) > 0 ? $ treeViewHtml : '<p> ' . $ this ->trans ('No tags available yet. ' ) .'</p> ' ;
120- return '<div class="tags_tree mt-3 col-lg-8 col-md-8 col-sm-12">
120+ $ out = '<div class="tags_tree mt-3 col-lg-8 col-md-8 col-sm-12">
121121 <div class="card m-3 mr-0">
122122 <div class="card-body">
123123 <div class="tree-view">
@@ -126,7 +126,11 @@ protected function output() {
126126 </div>
127127 </div>
128128 </div> ' ;
129-
129+
130+ if ($ this ->get ('tags_updated ' )) {
131+ $ out .= '<script>window.tagsUpdated = true;</script> ' ;
132+ }
133+ return $ out ;
130134 }
131135 }
132136}
You can’t perform that action at this time.
0 commit comments