]> git.mxchange.org Git - friendica.git/commitdiff
[frio] Add support for asynchronous call to /filerm module for post categories and...
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 5 Sep 2022 05:04:32 +0000 (01:04 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 11 Sep 2022 06:36:06 +0000 (02:36 -0400)
- This prevents the page to change to an empty page when clicking on the remove link of categories and folders

view/theme/frio/templates/jot-header.tpl
view/theme/frio/templates/wall_thread.tpl

index 8eb76ccc6941aa08811b268ce0a8096fb4b396e8..bc5b2088897a7058c9200b87bd4ed62a5eda40e9 100644 (file)
@@ -56,7 +56,6 @@
                        jotTextOpenUI(document.getElementById("profile-jot-text"));
                });
 
-
                /* show images / file browser window
                 *
                 **/
                        Dialog.doFileBrowser("main");
                        jotActive();
                });
+
+               $('body').on('click', '.p-category .filerm', function(e){
+                       e.preventDefault();
+
+                       let $href = $(e.target).attr('href');
+                       // Prevents arbitrary Ajax requests
+                       if ($href.substr(0, 7) === 'filerm/') {
+                               $(e.target).parent().removeClass('btn-success btn-danger');
+                               $.post($href)
+                               .done(function() {
+                                       liking = 1;
+                                       force_update = true;
+                               })
+                               .always(function () {
+                                       NavUpdate();
+                               });
+                       }
+               });
        });
 
        function deleteCheckedItems() {
                                return false;
                        });
                });
-
        }
 
        function jotClearLocation() {
index 12b12a2e7b2a54972f0dac933e68c4b25a311da9..4f2d7e1bc4b4b6082b3d2e29b41b2f8561c08385 100644 (file)
@@ -278,12 +278,12 @@ as the value of $top_child_total (this is done at the end of this file)
                                <span class="mention label label-default sm">{{$tag nofilter}} <i class="fa fa-eye-slash" aria-hidden="true"></i></span>
                        {{/foreach*}}
                {{/if}}
-                       {{foreach $item.folders as $cat}}
-                               <span class="folder label btn-danger sm p-category">{{$cat.name}}{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                       {{foreach $item.folders as $folder}}
+                               <span class="folder label btn-danger sm p-category">{{$folder.name}}{{if $folder.removeurl}} (<a href="{{$folder.removeurl}}" class="filerm" title="{{$remove}}">x</a>){{/if}}</span>
                        {{/foreach}}
 
                        {{foreach $item.categories as $cat}}
-                               <span class="category label btn-success sm p-category"><a href="{{$cat.url}}">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" title="{{$remove}}">x</a>) {{/if}} </span>
+                               <span class="category label btn-success sm p-category"><a href="{{$cat.url}}">{{$cat.name}}</a>{{if $cat.removeurl}} (<a href="{{$cat.removeurl}}" class="filerm" title="{{$remove}}">x</a>){{/if}}</span>
                        {{/foreach}}
                        </div>
                        {{if $item.edited}}<div class="itemedited text-muted">{{$item.edited['label']}} (<span title="{{$item.edited['date']}}">{{$item.edited['relative']}}</span>)</div>{{/if}}