refactor(site-subscriptions): dedupe show page back actions
This commit is contained in:
@@ -50,8 +50,9 @@
|
|||||||
<div class="page-header-actions">
|
<div class="page-header-actions">
|
||||||
@if($safeBackForLinks !== '')
|
@if($safeBackForLinks !== '')
|
||||||
<a href="{!! $safeBackForLinks !!}" class="btn btn-secondary btn-sm">返回上一页(保留上下文)</a>
|
<a href="{!! $safeBackForLinks !!}" class="btn btn-secondary btn-sm">返回上一页(保留上下文)</a>
|
||||||
|
@else
|
||||||
|
<a href="{!! $makeSubscriptionIndexUrl([]) !!}" class="btn btn-secondary btn-sm">返回订阅列表(保留上下文)</a>
|
||||||
@endif
|
@endif
|
||||||
<a href="{!! $makeSubscriptionIndexUrl([]) !!}" class="btn btn-secondary btn-sm">返回订阅列表(保留上下文)</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -66,5 +66,13 @@ class AdminSiteSubscriptionShowIndexLinkKeepsContextTest extends TestCase
|
|||||||
|
|
||||||
$res->assertSee('返回订阅列表(保留上下文)');
|
$res->assertSee('返回订阅列表(保留上下文)');
|
||||||
$res->assertSee($expectedIndexUrl, false);
|
$res->assertSee($expectedIndexUrl, false);
|
||||||
|
|
||||||
|
// 当传入有效 back 时,应优先显示“返回上一页”并隐藏该兜底按钮(避免重复入口噪音)
|
||||||
|
$res2 = $this->get('/admin/site-subscriptions/' . $sub->id . '?' . Arr::query([
|
||||||
|
'back' => '/admin',
|
||||||
|
]));
|
||||||
|
$res2->assertOk();
|
||||||
|
$res2->assertSee('返回上一页(保留上下文)');
|
||||||
|
$res2->assertDontSee('返回订阅列表(保留上下文)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user