Skip to content
1 change: 1 addition & 0 deletions apps/files_external/img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions apps/files_external/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\Files_External\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand Down Expand Up @@ -64,4 +72,11 @@ public function getName() {
public function getPriority() {
return 10;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('files_external', 'app-dark.svg');
}
}
1 change: 1 addition & 0 deletions apps/theming/img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions apps/theming/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\Theming\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand Down Expand Up @@ -64,4 +72,11 @@ public function getName() {
public function getPriority() {
return 30;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('theming', 'app-dark.svg');
}
}
21 changes: 18 additions & 3 deletions apps/user_ldap/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\User_LDAP\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand Down Expand Up @@ -64,4 +72,11 @@ public function getName() {
public function getPriority() {
return 25;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('user_ldap', 'app.svg');
}
}
21 changes: 18 additions & 3 deletions apps/workflowengine/lib/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
namespace OCA\WorkflowEngine\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var IL10N */
private $l;
/** @var IURLGenerator */
private $url;

public function __construct(IL10N $l) {
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}

Expand All @@ -54,4 +62,11 @@ public function getName() {
public function getPriority() {
return 55;
}

/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('core', 'actions/tag.svg');
}
}
1 change: 1 addition & 0 deletions core/img/actions/settings-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,8 @@ public function __construct($webRoot, \OC\Config $config) {
$c->getEncryptionManager(),
$c->getUserManager(),
$c->getLockingProvider(),
new \OC\Settings\Mapper($c->getDatabaseConnection())
new \OC\Settings\Mapper($c->getDatabaseConnection()),
$c->getURLGenerator()
);
return $manager;
});
Expand Down
19 changes: 12 additions & 7 deletions lib/private/Settings/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\IDBConnection;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Settings\ISettings;
Expand All @@ -55,6 +56,8 @@ class Manager implements IManager {
private $userManager;
/** @var ILockingProvider */
private $lockingProvider;
/** @var IURLGenerator */
private $url;

/**
* @param ILogger $log
Expand All @@ -65,7 +68,7 @@ class Manager implements IManager {
* @param IUserManager $userManager
* @param ILockingProvider $lockingProvider
* @param Mapper $mapper
* @internal param IDBConnection $dbc
* @param IURLGenerator $url
*/
public function __construct(
ILogger $log,
Expand All @@ -75,7 +78,8 @@ public function __construct(
EncryptionManager $encryptionManager,
IUserManager $userManager,
ILockingProvider $lockingProvider,
Mapper $mapper
Mapper $mapper,
IURLGenerator $url
) {
$this->log = $log;
$this->dbc = $dbc;
Expand All @@ -85,6 +89,7 @@ public function __construct(
$this->encryptionManager = $encryptionManager;
$this->userManager = $userManager;
$this->lockingProvider = $lockingProvider;
$this->url = $url;
}

/**
Expand Down Expand Up @@ -260,11 +265,11 @@ private function query($className) {
public function getAdminSections() {
// built-in sections
$sections = [
0 => [new Section('server', $this->l->t('Server settings'), 0)],
5 => [new Section('sharing', $this->l->t('Sharing'), 0)],
45 => [new Section('encryption', $this->l->t('Encryption'), 0)],
98 => [new Section('additional', $this->l->t('Additional settings'), 0)],
99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0)],
0 => [new Section('server', $this->l->t('Server settings'), 0, $this->url->imagePath('settings', 'admin.svg'))],
5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))],
45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))],
98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))],
];

$rows = $this->mapper->getAdminSectionsFromDB();
Expand Down
21 changes: 18 additions & 3 deletions lib/private/Settings/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,29 @@

namespace OC\Settings;

use OCP\Settings\ISection;
use OCP\Settings\IIconSection;

class Section implements ISection {
class Section implements IIconSection {
/** @var string */
private $id;
/** @var string */
private $name;
/** @var int */
private $priority;
/** @var string */
private $icon;

/**
* @param string $id
* @param string $name
* @param int $priority
* @param string $icon
*/
public function __construct($id, $name, $priority) {
public function __construct($id, $name, $priority, $icon = '') {
$this->id = $id;
$this->name = $name;
$this->priority = $priority;
$this->icon = $icon;
}

/**
Expand Down Expand Up @@ -74,4 +78,15 @@ public function getName() {
public function getPriority() {
return $this->priority;
}

/**
* returns the relative path to an 16*16 icon describing the section.
* e.g. '/core/img/places/files.svg'
*
* @returns string
* @since 12
*/
public function getIcon() {
return $this->icon;
}
}
38 changes: 38 additions & 0 deletions lib/public/Settings/IIconSection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* @copyright Copyright (c) 2017, Joas Schilling <[email protected]>
*
* @author Joas Schilling <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCP\Settings;

/**
* @since 12
*/
interface IIconSection extends ISection {
/**
* returns the relative path to an 16*16 icon describing the section.
* e.g. '/core/img/places/files.svg'
*
* @returns string
* @since 12
*/
public function getIcon();
}
1 change: 1 addition & 0 deletions lib/public/Settings/ISection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace OCP\Settings;

/**
* @deprecated 12 Use IIconSection instead
* @since 9.1
*/
interface ISection {
Expand Down
8 changes: 8 additions & 0 deletions settings/Controller/AdminSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
use OCP\AppFramework\Http\TemplateResponse;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\Settings\IIconSection;
use OCP\Settings\IManager as ISettingsManager;
use OCP\Settings\ISection;
use OCP\Template;

/**
Expand Down Expand Up @@ -133,10 +135,16 @@ private function getNavigationParameters($currentSection) {
/** @var \OC\Settings\Section[] $prioritizedSections */
foreach($sections as $prioritizedSections) {
foreach ($prioritizedSections as $section) {
$icon = '';
if ($section instanceof IIconSection) {
$icon = $section->getIcon();
}

$templateParameters[] = [
'anchor' => $section->getID(),
'section-name' => $section->getName(),
'active' => $section->getID() === $currentSection,
'icon' => $icon,
];
}
}
Expand Down
34 changes: 34 additions & 0 deletions settings/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ input#openid, input#webdav { width:20em; }

/* PERSONAL */

/* icons for sidebar */
.nav-icon-personal-settings {
background-image: url('../img/personal.svg?v=1');
}
.nav-icon-sessions {
background-image: url('../img/toggle-filelist.svg?v=1');
}
.nav-icon-apppasswords {
background-image: url('../img/password.svg?v=1');
}
.nav-icon-clientsbox {
background-image: url('../img/change.svg?v=1');
}
.nav-icon-activity {
background-image: url('../img/activity-dark.svg?v=1');
}
.nav-icon-federated-cloud {
background-image: url('../img/share.svg?v=1');
}
.nav-icon-second-factor-backup-codes {
background-image: url('../img/password.svg?v=1');
}

#avatarform {
width: 160px;
padding-right: 0;
Expand Down Expand Up @@ -703,6 +726,17 @@ table.grid td.date{
}

/* ADMIN */

/* Navigation icons */
#app-navigation img {
margin-bottom: -3px;
margin-right: 6px;
width: 16px;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I mean – it doesn't use the same way as we do in Files, or Mail etc.

We should standardize that everywhere. Also cc @skjnldsv @eppfel regarding the design / HTML/CSS guidelines we want to improve.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I actually surrendered on nextcloud/nextcloud.com#140 for now. We need to find a more engaging, agile way to work on this. Let's talk @ FOSDEM about that...

#app-navigation li span.no-icon {
padding-left: 25px;
}

#security-warning li {
list-style: initial;
margin: 10px 0;
Expand Down
Loading