fix: restyle pager chips and restore theme ad slots
Build and Deploy / verify (push) Successful in 37s
Build and Deploy / deploy (push) Successful in 38s

Replace the loose page-count label with a SaBlog-style 6 / 316 chip, wire inject/stylevar HTML into list and post views, and flush page cache when ads are saved.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-18 21:48:24 +00:00
co-authored by Cursor
parent ae47447062
commit 36c4ffc5b4
41 changed files with 936 additions and 81 deletions
+19 -2
View File
@@ -57,7 +57,7 @@ class ThemeInjectTest extends TestCase
['point' => 'footer', 'title' => '第二条', 'html' => '<div id="inject-2">second</div>', 'sort' => 2, 'enabled' => true],
]);
$html = $this->get('/posts/inject-test.shtml')->getContent();
$html = $this->get('/show-'.Post::where('slug', 'inject-test')->value('id').'.shtml')->getContent();
$pos1 = strpos($html, 'id="inject-1"');
$pos2 = strpos($html, 'id="inject-2"');
@@ -82,7 +82,7 @@ class ThemeInjectTest extends TestCase
['point' => 'post_content_bottom', 'title' => '正文后广告', 'html' => '<div id="post-bottom-ad">BOTTOM</div>', 'sort' => 1, 'enabled' => true],
]);
$html = $this->get('/posts/inject-test.shtml')->getContent();
$html = $this->get('/show-'.Post::where('slug', 'inject-test')->value('id').'.shtml')->getContent();
$this->assertStringContainsString('post-top-ad', $html);
$this->assertStringContainsString('post-bottom-ad', $html);
@@ -97,4 +97,21 @@ class ThemeInjectTest extends TestCase
// theme('var') 直接可用
$this->assertSame('<div class="header-ad">头部广告</div>', theme('var', 'ad_header', ''));
}
public function test_content_top_and_stylevars_render_on_home(): void
{
Setting::set('inject.blocks', [
['point' => 'content_top', 'title' => '首页广告', 'html' => '<div id="home-top-ad">首页广告位</div>', 'sort' => 1, 'enabled' => true],
]);
Setting::set('theme_vars_sablog', [
'ad_header' => '<div class="header-ad">头部广告</div>',
'huangjinlian' => '<div class="footer-ad">页脚广告</div>',
]);
$this->get('/')
->assertOk()
->assertSee('首页广告位', false)
->assertSee('头部广告', false)
->assertSee('页脚广告', false);
}
}