]> git.mxchange.org Git - friendica.git/commitdiff
Replace path parameter with query string parameter in Module\Search\Saved
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Oct 2019 12:39:41 +0000 (08:39 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Oct 2019 12:39:41 +0000 (08:39 -0400)
src/Module/Search/Saved.php
static/routes.config.php
view/templates/searchbox.tpl
view/templates/widget/saved_searches.tpl
view/theme/frio/css/style.css
view/theme/frio/js/theme.js
view/theme/frio/templates/searchbox.tpl
view/theme/frio/templates/widget/saved_searches.tpl
view/theme/quattro/templates/widget/saved_searches.tpl

index 9a02c8a4e4c85ce46d7c240456968fb337309f0d..9d8d84b55a9bb10337af8801500435e1e36f723a 100644 (file)
@@ -16,11 +16,11 @@ class Saved extends BaseModule
                $args = self::getClass(Arguments::class);
 
                $action = $args->get(2, 'none');
-               $search = Strings::escapeTags(trim(rawurldecode($args->get(3, ''))));
+               $search = Strings::escapeTags(trim(rawurldecode($_GET['term'] ?? '')));
 
                $return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search);
 
-               if (local_user()) {
+               if (local_user() && $search) {
                        switch ($action) {
                                case 'add':
                                        $fields = ['uid' => local_user(), 'term' => $search];
index 841fd68f991e01fca0187e4b4b61ea6917128dfa..c52b5d8026c9b4666356506c315e1c6ba4b65c85 100644 (file)
@@ -191,8 +191,8 @@ return [
        '/search' => [
                '[/]'                  => [Module\Search\Index::class, [R::GET]],
                '/acl'                 => [Module\Search\Acl::class,   [R::GET, R::POST]],
-               '/saved/add/{term}'    => [Module\Search\Saved::class, [R::GET]],
-               '/saved/remove/{term}' => [Module\Search\Saved::class, [R::GET]],
+               '/saved/add'           => [Module\Search\Saved::class, [R::GET]],
+               '/saved/remove'        => [Module\Search\Saved::class, [R::GET]],
        ],
 
        '/settings' => [
index d566befba01bfd7ea73a7c316c2f286e1886cb13..8317c59b1d4620d4551a7ba91e9a87462124b8e4 100644 (file)
@@ -11,7 +11,7 @@
     {{/if}}
                <input type="submit" name="submit" id="search-submit" value="{{$search_label}}"/>
     {{if $s}}
-           <a href="search/saved/add/{{$q}}?return_url={{$return_url}}">{{$save_label}}</a>
+           <a href="search/saved/add?term={{$q}}&amp;return_url={{$return_url}}">{{$save_label}}</a>
     {{/if}}
 {{/strip}}
        </form>
index 858e921f78c0b403dd4652893e90df9f8d1d28e3..4e3a80b765ea07a8b1af7c5c00f17ad49f9f06ca 100644 (file)
@@ -6,7 +6,7 @@
        <ul role="menu" id="saved-search-ul">
                {{foreach $saved as $search}}
                <li role="menuitem" class="saved-search-li clear">
-                       <a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
+                       <a href="search/saved/remove?term={{$search.encodedterm}}&amp;return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="iconspacer savedsearchdrop"></a>
                        <a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
                </li>
                {{/foreach}}
index 2cfc63d3673b30da5bd13443139e3c0676155611..9f487742eb9aaabdeb445dbf30f146c300966920 100644 (file)
@@ -2312,7 +2312,7 @@ ul.dropdown-menu li:hover {
 .search-content-wrapper > .section-title-wrapper {
     display: none;
 }
-#navbar-button > #search-save-form > #search-save {
+#navbar-button > #search-save {
     margin-top: 3px;
 }
 /* Section-Content-Wrapper */
index 2ab11e637ba8284843476b1f2f6d5a094427c96e..46cea59ba23c60ccefed8efad885d55ae210139d 100644 (file)
@@ -169,7 +169,7 @@ $(document).ready(function(){
        }
 
        // move the "Save the search" button to the second navbar
-       $(".search-content-wrapper #search-save-form ").appendTo("#topbar-second > .container > #navbar-button");
+       $(".search-content-wrapper #search-save").appendTo("#topbar-second > .container > #navbar-button");
 
        // append the vcard-short-info to the second nav after passing the element
        // with .fn (vcard username). Use scrollspy to get the scroll position.
index bf2ee53040692c297faef77a264d2b39769506fd..ced6fbbd388062f518fd633c4f40f967ffcb2ab1 100644 (file)
@@ -18,7 +18,7 @@ Some parts of this template will be moved by js to other places (see theme.js) -
                                        <div class="col-md-8">
                                                {{* The button to save searches *}}
                                                {{if $s}}
-                                               <a href="search/saved/add/{{$q}}?return_url={{$return_url}}" class="btn btn-primary btn-small pull-right">{{$save_label}}</a>
+                                               <a href="search/saved/add?term={{$q}}&amp;return_url={{$return_url}}" class="btn btn-primary btn-small pull-right">{{$save_label}}</a>
                                                {{/if}}
 
                                                {{* The select popup menu to select what kind of results the user would like to search for *}}
@@ -46,16 +46,13 @@ Some parts of this template will be moved by js to other places (see theme.js) -
        </div>
 
 {{if $s}}
-       <form id="search-save-form" action="search/saved/add/{{$q}}" method="get">
-               <input type="hidden" name="return_url" value="{{$return_url}}">
-               <button class="btn btn-sm btn-main pull-right" type="submit" id="search-save" title="{{$save_label}}" aria-label="{{$save_label}}" value="{{$save_label}}" data-toggle="tooltip">
+       <a href="search/saved/add?term={{$q}}&amp;return_url={{$return_url}}" class="btn btn-sm btn-main pull-right" id="search-save" title="{{$save_label}}" aria-label="{{$save_label}}" value="{{$save_label}}" data-toggle="tooltip">
        {{if $mode == "tag"}}
-                       <i class="fa fa-plus fa-2x" aria-hidden="true"></i>
+               <i class="fa fa-plus fa-2x" aria-hidden="true"></i>
        {{else}}
-                       <i class="fa fa-floppy-o fa-2x" aria-hidden="true"></i>
+               <i class="fa fa-floppy-o fa-2x" aria-hidden="true"></i>
        {{/if}}
-                       <span class="sr-only">{{$save_label}}</span>
-               </button>
-       </form>
+               <span class="sr-only">{{$save_label}}</span>
+       </a>
 {{/if}}
 </div>
index 1553961e1e26b15140fe3bf40cca71454035aa85..1981508cfd2f8a98e403c9da93e4e5d42cd417fe 100644 (file)
@@ -6,7 +6,7 @@
        <ul role="menu" id="saved-search-ul">
                {{foreach $saved as $search}}
                <li role="menuitem" class="saved-search-li clear">
-                       <a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
+                       <a href="search/saved/remove?term={{$search.encodedterm}}&amp;return_url={{$return_url}}" title="{{$search.delete}}" onclick="return confirmDelete();" id="drop-saved-search-term-{{$search.id}}" class="savedsearchdrop pull-right widget-action faded-icon">
                                <i class="fa fa-trash" aria-hidden="true"></i>
                        </a>
                        <a href="search?q={{$search.encodedterm}}" id="saved-search-term-{{$search.id}}" class="savedsearchterm">{{$search.term}}</a>
index 69e21c786fe1fc1d163ffb9c47726e511a11d0fb..ce99d521d9dbfac402d6dde76b513769eee156cc 100644 (file)
@@ -5,7 +5,7 @@
         {{foreach $saved as $search}}
                        <li class="tool {{if $search.selected}}selected{{/if}}">
                                <a href="search?q={{$search.encodedterm}}" class="label">{{$search.term}}</a>
-                               <a href="search/saved/remove/{{$search.encodedterm}}?return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
+                               <a href="search/saved/remove?term={{$search.encodedterm}}&amp;return_url={{$return_url}}" class="action icon s10 delete" title="{{$search.delete}}" onclick="return confirmDelete();"></a>
                        </li>
         {{/foreach}}
        </ul>