Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable25] Create headings for sidebar pages #1108

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $(function(){
var navigationLink = this.$navigation.find('a[data-navigation=' + filter + ']');
navigationLink.parent().addClass('active').attr('aria-current', 'page');
window.document.title = navigationLink.text().trim() + ' - ' + this.defaultPageTitle;

OCP.Accessibility.setPageHeading(navigationLink.text().trim());
OCA.Activity.InfinitScrolling.prefill();
}
};
Expand Down
10 changes: 9 additions & 1 deletion lib/Controller/ActivitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
Expand All @@ -39,6 +40,9 @@ class ActivitiesController extends Controller {
/** @var Data */
protected $data;

/** @var IL10N */
private $l10n;

/** @var Navigation */
protected $navigation;

Expand All @@ -52,18 +56,21 @@ class ActivitiesController extends Controller {
* @param Data $data
* @param Navigation $navigation
* @param EventDispatcherInterface $eventDispatcher
* @param IL10N $l10n
*/
public function __construct($appName,
IRequest $request,
IConfig $config,
Data $data,
Navigation $navigation,
EventDispatcherInterface $eventDispatcher) {
EventDispatcherInterface $eventDispatcher,
IL10N $l10n) {
parent::__construct($appName, $request);
$this->data = $data;
$this->config = $config;
$this->navigation = $navigation;
$this->eventDispatcher = $eventDispatcher;
$this->l10n = $l10n;
}

/**
Expand All @@ -83,6 +90,7 @@ public function showList($filter = 'all') {
'appNavigation' => $this->navigation->getTemplate($filter),
'avatars' => $this->config->getSystemValue('enable_avatars', true) ? 'yes' : 'no',
'filter' => $filter,
'pageTitle' => $this->l10n->t('Activity')
]);
}
}
8 changes: 7 additions & 1 deletion tests/Controller/ActivitiesControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

use OCA\Activity\Controller\ActivitiesController;
use OCA\Activity\Tests\TestCase;
use OCP\IL10N;
use OCP\ILogger;
use OCP\Template;
use PHPUnit\Framework\MockObject\MockObject;
Expand Down Expand Up @@ -51,6 +52,8 @@ class ActivitiesControllerTest extends TestCase {
protected $eventDispatcher;
/** @var Navigation|MockObject */
protected $navigation;
/** @var IL10N */
protected $l10n;

/** @var ActivitiesController */
protected $controller;
Expand All @@ -63,6 +66,7 @@ protected function setUp(): void {
$this->navigation = $this->createMock(Navigation::class);
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->request = $this->createMock(IRequest::class);
$this->l10n = $this->createMock(IL10N::class);

$this->controller = $this->getController();
}
Expand All @@ -75,7 +79,8 @@ protected function getController(array $methods = []): ActivitiesController {
$this->config,
$this->data,
$this->navigation,
$this->eventDispatcher
$this->eventDispatcher,
$this->l10n,
);
}

Expand All @@ -87,6 +92,7 @@ protected function getController(array $methods = []): ActivitiesController {
$this->data,
$this->navigation,
$this->eventDispatcher,
$this->l10n,
])
->onlyMethods($methods)
->getMock();
Expand Down