From: ArthurHoaro Date: Tue, 19 Jan 2021 10:48:38 +0000 (+0100) Subject: Merge pull request #1689 from ArthurHoaro/fix/bulk-add-html-label X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=ffa39719a17982e6a6cac9bc3f758aa12fa69973;hp=8fbc29de0252c462884605d4f691b6746e524fc9;p=github%2Fshaarli%2FShaarli.git Merge pull request #1689 from ArthurHoaro/fix/bulk-add-html-label Fix: bulk add - use unique HTML ID --- diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php index ae946c59..d3f28f2f 100644 --- a/application/front/controller/visitor/ShaarliVisitorController.php +++ b/application/front/controller/visitor/ShaarliVisitorController.php @@ -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)); diff --git a/tests/front/controller/visitor/ShaarliVisitorControllerTest.php b/tests/front/controller/visitor/ShaarliVisitorControllerTest.php index 935ec24e..7676f14d 100644 --- a/tests/front/controller/visitor/ShaarliVisitorControllerTest.php +++ b/tests/front/controller/visitor/ShaarliVisitorControllerTest.php @@ -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']); diff --git a/tpl/default/includes.html b/tpl/default/includes.html index 3e3fb664..6be2a2ea 100644 --- a/tpl/default/includes.html +++ b/tpl/default/includes.html @@ -19,7 +19,7 @@ {/if} -{if="! empty($links) && count($links) === 1"} +{if="$template === 'linklist' && ! empty($links) && count($links) === 1"} {$link=reset($links)} diff --git a/tpl/vintage/includes.html b/tpl/vintage/includes.html index 2ce9da42..4fd78467 100644 --- a/tpl/vintage/includes.html +++ b/tpl/vintage/includes.html @@ -16,7 +16,7 @@ {if="is_file('data/user.css')"}{/if} -{if="! empty($links) && count($links) === 1"} +{if="$template === 'linklist' && ! empty($links) && count($links) === 1"} {$link=reset($links)}