]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #1689 from ArthurHoaro/fix/bulk-add-html-label
authorArthurHoaro <arthur@hoa.ro>
Tue, 19 Jan 2021 10:48:38 +0000 (11:48 +0100)
committerGitHub <noreply@github.com>
Tue, 19 Jan 2021 10:48:38 +0000 (11:48 +0100)
Fix: bulk add - use unique HTML ID

application/front/controller/visitor/ShaarliVisitorController.php
tests/front/controller/visitor/ShaarliVisitorControllerTest.php
tpl/default/includes.html
tpl/vintage/includes.html

index ae946c592240bcee977fce824b3073d368064ee6..d3f28f2f7e536ca859049a3b22010eb6b077724e 100644 (file)
@@ -56,6 +56,10 @@ abstract class ShaarliVisitorController
 
     protected function render(string $template): string
     {
+        // Legacy key that used to be injected by PluginManager
+        $this->assignView('_PAGE_', $template);
+        $this->assignView('template', $template);
+
         $this->assignView('linkcount', $this->container->bookmarkService->count(BookmarkFilter::$ALL));
         $this->assignView('privateLinkcount', $this->container->bookmarkService->count(BookmarkFilter::$PRIVATE));
 
index 935ec24ef7597ad67dcf043176883d3f571f9995..7676f14d5155caf0fcb5d68341bf05ddf84f6d14 100644 (file)
@@ -93,6 +93,9 @@ class ShaarliVisitorControllerTest extends TestCase
 
         static::assertSame('templateName', $render);
 
+        static::assertSame('templateName', $this->assignedValues['_PAGE_']);
+        static::assertSame('templateName', $this->assignedValues['template']);
+
         static::assertSame(10, $this->assignedValues['linkcount']);
         static::assertSame(5, $this->assignedValues['privateLinkcount']);
         static::assertSame(['error'], $this->assignedValues['plugin_errors']);
index 3e3fb6640a52b366af7c3ad96b23484c5000f9b4..6be2a2ea7ef628a18e3f49c5ad2b15299cfbebd4 100644 (file)
@@ -19,7 +19,7 @@
 {/if}
 <link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#"
       title="Shaarli search - {$shaarlititle}" />
-{if="! empty($links) && count($links) === 1"}
+{if="$template === 'linklist' && ! empty($links) && count($links) === 1"}
   {$link=reset($links)}
   <meta property="og:title" content="{$link.title}" />
   <meta property="og:type" content="article" />
index 2ce9da423af296bd4638f8408f2d487445135ddc..4fd78467e54d1cecd06115631861bc554a9448e2 100644 (file)
@@ -16,7 +16,7 @@
 {if="is_file('data/user.css')"}<link type="text/css" rel="stylesheet" href="{$base_path}/data/user.css#" />{/if}
 <link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#"
       title="Shaarli search - {$shaarlititle|htmlspecialchars}" />
-{if="! empty($links) && count($links) === 1"}
+{if="$template === 'linklist' && ! empty($links) && count($links) === 1"}
   {$link=reset($links)}
   <meta property="og:title" content="{$link.title}" />
   <meta property="og:type" content="article" />