Merge branch 'develop' into translations
ci/woodpecker/push/woodpecker Pipeline was successful Details
gitea-sonarqube-bot OK Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details

This commit is contained in:
Simon Vieille 2022-12-05 23:44:49 +01:00
commit 901668236f
18 changed files with 129 additions and 62 deletions

View File

@ -15,6 +15,29 @@ pipeline:
branch: [master, develop, feature/*]
event: [push, pull_request]
code_quality:
image: sonarsource/sonar-scanner-cli
secrets: [sonar_token, sonar_host, sonar_project]
commands:
- sonar-scanner
-Dsonar.projectKey=$SONAR_PROJECT
-Dsonar.sources=.
-Dsonar.host.url=$SONAR_HOST
-Dsonar.pullrequest.key=$CI_COMMIT_PULL_REQUEST
-Dsonar.pullrequest.branch=$CI_COMMIT_SOURCE_BRANCH
-Dsonar.pullrequest.base=$CI_COMMIT_TARGET_BRANCH
failure: ignore
when:
event: [pull_request]
dependency_check:
image: node:16-slim
commands:
- npm audit
failure: ignore
when:
event: [pull_request]
package:
image: gitnet.fr/deblan/devenv
volumes:

View File

@ -1,7 +1,10 @@
## [Unreleased]
## 3.4.1
## Added
* add translations (thanks to zonorti, jorisvandijk)
* add translations (thanks to zonorti, jorisvandijk, jak2k)
## Fixed
* fix #183: hide custom categories list when empty (admin page)
## 3.4.0
### Added

View File

@ -34,4 +34,4 @@ translations:
.ONESHELL:
run-code-quality-analysis:
export SONAR_TOKEN="$$SONAR_TOKEN_DEBLAN_SIDE_MENU"
sonar-scanner -Dsonar.projectKey=deblan-side_menu -Dsonar.sources=. -Dsonar.host.url=https://cq.gitnet.fr
sonar-scanner -Dsonar.projectKey=deblan-side_menu -Dsonar.sources=. -Dsonar.host.url=$$SONAR_SERVER -Dsonar.branch.name=$$(git branch --show-current)

View File

@ -21,7 +21,7 @@ You like this app and you want to support me? ☕ [Buy me a coffee](https://www.
Requirements
------------
* PHP >= 7.4
* PHP >= 8.0
* App `theming` enabled
Installation and upgrade

View File

@ -17,7 +17,7 @@ You can report a bug or request a feature by opening an issue.
Requirements:
* PHP >= 7.4
* PHP >= 8.0
* App `theming` enabled
If you like this application and if you want to support the development:
@ -32,7 +32,7 @@ Notice
Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**.
In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/).
]]></description>
<version>3.4.0</version>
<version>3.4.1</version>
<licence>agpl</licence>
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
<namespace>SideMenu</namespace>

View File

@ -137,6 +137,10 @@
padding-right: 20px;
}
.side-menu-setting-label--top {
vertical-align: top;
}
.side-menu-setting-form {
display: table-cell;
min-width: 300px;
@ -182,7 +186,7 @@
}
.badge {
border-size: 1px;
border-width: 1px;
padding: 2px 8px;
margin-right: 2px;
margin-bottom: 5px;

View File

@ -235,9 +235,6 @@
.side-menu-always-displayed body {
width: calc(100% - 50px) !important;
}
.side-menu-always-displayed body {
position: absolute;
left: 50px;
}

View File

@ -86,7 +86,11 @@ class AppController extends Controller
protected function redirectToApp($appId): RedirectResponse
{
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false);
$isIgnoreFrontController = true === OC::$server->getConfig()->getSystemValue(
'htaccess.IgnoreFrontController',
false
);
$isFrontControllerActive = 'true' === getenv('front_controller_active');
if ($isIgnoreFrontController || $isFrontControllerActive) {

View File

@ -21,14 +21,14 @@ namespace OCA\SideMenu\Controller;
use OC;
use OC\User\User;
use OCA\SideMenu\AppInfo\Application;
use OCA\SideMenu\Service\Color;
use OCA\SideMenu\Service\ConfigProxy;
use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCP\IUserSession;
use OCA\Theming\ThemingDefaults;
use OCA\SideMenu\Service\Color;
class CssController extends Controller
{
@ -58,8 +58,7 @@ class CssController extends Controller
ConfigProxy $config,
ThemingDefaults $theming,
Color $color
)
{
) {
parent::__construct($appName, $request);
$this->user = OC::$server[IUserSession::class]->getUser();
@ -105,16 +104,18 @@ class CssController extends Controller
$topSideMenuApps = $userTopSideMenuApps;
}
$isDarkThemeUserEnabled = $this->config->getUserValue($this->user, 'theme', '', 'accessibility') === 'dark';
$isDarkThemeUserEnabled = 'dark' === $this->config->getUserValue($this->user, 'theme', '', 'accessibility');
$isBreezeDarkUserEnabled = $this->config->getUserValue($this->user, 'theme_enabled', '', 'breezedark');
$isBreezeDarkUserEnabled = $isBreezeDarkUserEnabled === '1' || ($isBreezeDarkGlobalEnabled && $isBreezeDarkUserEnabled === '');
$isBreezeDarkUserEnabled = '1' === $isBreezeDarkUserEnabled ||
($isBreezeDarkGlobalEnabled && '' === $isBreezeDarkUserEnabled);
} else {
$isDarkThemeUserEnabled = false;
$isBreezeDarkUserEnabled = false;
}
$isDarkMode = ($isAccessibilityAppEnabled && $isDarkThemeUserEnabled) || ($isBreezeDarkAppEnabled && $isBreezeDarkUserEnabled);
$isDarkMode = ($isAccessibilityAppEnabled && $isDarkThemeUserEnabled) ||
($isBreezeDarkAppEnabled && $isBreezeDarkUserEnabled);
$primaryColor = $this->theming->getColorPrimary();
$lightenPrimaryColor = $this->color->adjustBrightness($primaryColor, 0.2);
@ -125,25 +126,33 @@ class CssController extends Controller
if ($isDarkMode) {
$backgroundColor = $this->config->getAppValue('dark-mode-background-color', $darkenPrimaryColor);
$backgroundColorTo = $this->config->getAppValue('dark-mode-background-color-to', $darkenPrimaryColor);
$currentAppBackgroundColor = $this->config->getAppValue('dark-mode-current-app-background-color', $darkenPrimaryColor2);
$currentAppBackgroundColor = $this->config->getAppValue(
'dark-mode-current-app-background-color',
$darkenPrimaryColor2
);
$loaderColor = $this->config->getAppValue('dark-mode-loader-color', $lightenPrimaryColor);
$textColor = $this->config->getAppValue('dark-mode-text-color', $textColor);
$iconInvertFilter = abs($this->config->getAppValueInt('dark-mode-icon-invert-filter', '0')).'%';
$iconOpacity = abs($this->config->getAppValueInt('dark-mode-icon-opacity', '100') / 100);
$opener = $this->config->getAppValue('dark-mode-opener', 'side-menu-opener');
$backgroundOpacity = dechex($this->config->getAppValueInt('dark-mode-background-color-opacity', '100') * 255 / 100);
$opacity = $this->config->getAppValueInt('dark-mode-background-color-opacity', '100');
$backgroundOpacity = dechex($opacity * 255 / 100);
} else {
$backgroundColor = $this->config->getAppValue('background-color', $darkenPrimaryColor);
$backgroundColorTo = $this->config->getAppValue('background-color-to', $darkenPrimaryColor);
$currentAppBackgroundColor = $this->config->getAppValue('current-app-background-color', $darkenPrimaryColor2);
$currentAppBackgroundColor = $this->config->getAppValue(
'current-app-background-color',
$darkenPrimaryColor2
);
$loaderColor = $this->config->getAppValue('loader-color', $lightenPrimaryColor);
$textColor = $this->config->getAppValue('text-color', $textColor);
$iconInvertFilter = abs($this->config->getAppValueInt('icon-invert-filter', '0')).'%';
$iconOpacity = abs($this->config->getAppValueInt('icon-opacity', '100') / 100);
$opener = $this->config->getAppValue('opener', 'side-menu-opener');
$backgroundOpacity = dechex($this->config->getAppValueInt('background-color-opacity', '100') * 255 / 100);
$opacity = $this->config->getAppValueInt('background-color-opacity', '100');
$backgroundOpacity = dechex($opacity * 255 / 100);
}
$backgroundColor .= $backgroundOpacity;

View File

@ -95,7 +95,6 @@ class JsController extends Controller
{
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
$topSideMenuApps = $this->config->getAppValueArray('top-side-menu-apps', '[]');
$topMenuAppsOrder = $this->config->getAppValueArray('top-menu-apps-order', '[]');
$targetBlankApps = $this->config->getAppValueArray('target-blank-apps', '[]');
$useAvatar = $this->config->getAppValueBool('use-avatar', '0');
$isForced = $this->config->getAppValueBool('force', '0');

View File

@ -43,8 +43,13 @@ class PersonalSettingController extends Controller
*/
protected $userSession;
public function __construct($appName, IRequest $request, IConfig $config, ConfigProxy $configProxy, IUserSession $userSession)
{
public function __construct(
$appName,
IRequest $request,
IConfig $config,
ConfigProxy $configProxy,
IUserSession $userSession
) {
parent::__construct($appName, $request);
$this->config = $config;

View File

@ -74,7 +74,8 @@ class CategoryRepository
}
foreach ($categoriesLabels as $k => $category) {
$categoriesLabels[$category['id']] = $category['translations'][$currentLanguage]['name'] ?? $category['translations']['en']['name'];
$categoriesLabels[$category['id']] = $category['translations'][$currentLanguage]['name'] ??
$category['translations']['en']['name'];
unset($categoriesLabels[$k]);
}

View File

@ -125,15 +125,24 @@ class Admin implements ISettings
'background-color' => $backgroundColor,
'background-color-to' => $backgroundColorTo,
'background-color-opacity' => $this->config->getAppValueInt('background-color-opacity', '100'),
'current-app-background-color' => $this->config->getAppValue('current-app-background-color', $darkenPrimaryColor2),
'current-app-background-color' => $this->config->getAppValue(
'current-app-background-color',
$darkenPrimaryColor2
),
'loader-color' => $this->config->getAppValue('loader-color', $lightenPrimaryColor),
'icon-invert-filter' => $this->config->getAppValueInt('icon-invert-filter', '0'),
'icon-opacity' => $this->config->getAppValueInt('icon-opacity', '100'),
'text-color' => $this->config->getAppValue('text-color', $textColor),
'dark-mode-background-color' => $darkModeBackgroundColor,
'dark-mode-background-color-to' => $darkModeBackgroundColorTo,
'dark-mode-background-color-opacity' => $this->config->getAppValueInt('dark-mode-background-color-opacity', '100'),
'dark-mode-current-app-background-color' => $this->config->getAppValue('dark-mode-current-app-background-color', $darkenPrimaryColor2),
'dark-mode-background-color-opacity' => $this->config->getAppValueInt(
'dark-mode-background-color-opacity',
'100'
),
'dark-mode-current-app-background-color' => $this->config->getAppValue(
'dark-mode-current-app-background-color',
$darkenPrimaryColor2
),
'dark-mode-loader-color' => $this->config->getAppValue('dark-mode-loader-color', $textColor),
'dark-mode-icon-invert-filter' => $this->config->getAppValueInt('dark-mode-icon-invert-filter', '0'),
'dark-mode-icon-opacity' => $this->config->getAppValueInt('dark-mode-icon-opacity', '100'),

View File

@ -54,8 +54,13 @@ class Personal implements ISettings
*/
private $appRepository;
public function __construct(IL10N $l, ILogger $logger, ConfigProxy $config, IUserSession $userSession, AppRepository $appRepository)
{
public function __construct(
IL10N $l,
ILogger $logger,
ConfigProxy $config,
IUserSession $userSession,
AppRepository $appRepository
) {
$this->l = $l;
$this->logger = $logger;
$this->config = $config;

View File

@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<template>
<div>
<ul class="side-menu-setting-list">
<ul class="side-menu-setting-list" :class="{hide: values.length === 0}">
<li v-for="item in values" class="side-menu-setting-list-item" v-on:click="showEditForm(item)">
<span v-text="item.en"></span>
</li>
@ -77,6 +77,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}
</style>
<style scoped>
.hide {
display: none;
}
</style>
<script>
import NcModal from '@nextcloud/vue/dist/Components/NcModal'
import NcActions from '@nextcloud/vue/dist/Components/NcActions'

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{{ label }}
<span class="avatardiv avatardiv-shown">
<img v-bind:src="avatar">
<img v-bind:src="avatar" :alt="label">
</span>
</a>
</div>

View File

@ -53,7 +53,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</template>
<script>
import trim from 'trim'
import axios from 'axios'
import OpenerButton from './OpenerButton'
import SettingsButton from './SettingsButton'

View File

@ -41,6 +41,9 @@ $choicesSizes = [
$labelShowHideApps = 'Show and hide the list of applications';
$labelReset = 'Reset to default';
$labelWithCategories = 'With categories';
$labelBigMenu = 'Big menu';
$labelAlwaysDisplayed = 'Always displayed';
?>
<div id="side-menu-section">
@ -75,7 +78,7 @@ $labelReset = 'Reset to default';
<div>
<label>
<?php p($l->t('With categories')); ?>
<?php p($l->t($labelWithCategories)); ?>
</label>
</div>
<p>
@ -84,12 +87,12 @@ $labelReset = 'Reset to default';
data-alwaysdiplayed="0"
data-bigmenu="0"
data-sidewithcategories="1"
src="<?php print_unescaped(image_path('side_menu', 'admin/layout-side-with-categories.svg')); ?>" alt="<?php p($l->t('With categories')); ?>">
src="<?php print_unescaped(image_path('side_menu', 'admin/layout-side-with-categories.svg')); ?>" alt="<?php p($l->t($labelWithCategories)); ?>">
</p>
<div>
<label for="side-menu-opener">
<?php p($l->t('Big menu')); ?>
<?php p($l->t($labelBigMenu)); ?>
</label>
</div>
<p>
@ -98,12 +101,12 @@ $labelReset = 'Reset to default';
data-alwaysdiplayed="0"
data-bigmenu="1"
data-sidewithcategories="0"
src="<?php print_unescaped(image_path('side_menu', 'admin/layout-big-menu.svg')); ?>" alt="<?php p($l->t('Big menu')); ?>">
src="<?php print_unescaped(image_path('side_menu', 'admin/layout-big-menu.svg')); ?>" alt="<?php p($l->t($labelBigMenu)); ?>">
</p>
<div>
<label for="side-menu-opener">
<?php p($l->t('Always displayed')); ?>
<?php p($l->t($labelAlwaysDisplayed)); ?>
</label>
</div>
<p><em><?php p($l->t('Not compatible with touch screens.')); ?></em></p>
@ -113,7 +116,7 @@ $labelReset = 'Reset to default';
data-alwaysdiplayed="1"
data-bigmenu="0"
data-sidewithcategories="0"
src="<?php print_unescaped(image_path('side_menu', 'admin/layout-always-displayed.svg')); ?>" alt="<?php p($l->t('Always displayed')); ?>">
src="<?php print_unescaped(image_path('side_menu', 'admin/layout-always-displayed.svg')); ?>" alt="<?php p($l->t($labelAlwaysDisplayed)); ?>">
</p>
<input
@ -148,9 +151,9 @@ $labelReset = 'Reset to default';
<div class="badges">
<span class="badge badge-1"><?php p($l->t('Default')); ?></span>
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-4"><?php p($l->t('Always displayed')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
<span class="badge badge-4"><?php p($l->t($labelAlwaysDisplayed)); ?></span>
</div>
<div class="side-menu-setting-table">
@ -339,9 +342,9 @@ $labelReset = 'Reset to default';
<div class="badges">
<span class="badge badge-1"><?php p($l->t('Default')); ?></span>
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-4"><?php p($l->t('Always displayed')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
<span class="badge badge-4"><?php p($l->t($labelAlwaysDisplayed)); ?></span>
</div>
<p>
@ -534,9 +537,9 @@ $labelReset = 'Reset to default';
<div class="badges">
<span class="badge badge-1"><?php p($l->t('Default')); ?></span>
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-4"><?php p($l->t('Always displayed')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
<span class="badge badge-4"><?php p($l->t($labelAlwaysDisplayed)); ?></span>
</div>
<div class="side-menu-setting-table">
@ -675,8 +678,8 @@ $labelReset = 'Reset to default';
<?php p($l->t('Apps that should not be displayed in the menu')); ?>
<div class="badges">
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
</div>
</div>
<div class="side-menu-setting-form">
@ -799,9 +802,9 @@ $labelReset = 'Reset to default';
<div class="badges">
<span class="badge badge-1"><?php p($l->t('Default')); ?></span>
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-4"><?php p($l->t('Always displayed')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
<span class="badge badge-4"><?php p($l->t($labelAlwaysDisplayed)); ?></span>
</div>
<div class="side-menu-setting-table">
@ -878,9 +881,9 @@ $labelReset = 'Reset to default';
<div class="badges">
<span class="badge badge-1"><?php p($l->t('Default')); ?></span>
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-4"><?php p($l->t('Always displayed')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
<span class="badge badge-4"><?php p($l->t($labelAlwaysDisplayed)); ?></span>
</div>
<div class="side-menu-setting-table">
@ -924,8 +927,8 @@ $labelReset = 'Reset to default';
</h2>
<div class="badges">
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
</div>
<div class="side-menu-setting-table">
@ -951,7 +954,7 @@ $labelReset = 'Reset to default';
</div>
<div class="side-menu-setting-row">
<div class="side-menu-setting-label">
<div class="side-menu-setting-label side-menu-setting-label--top">
<?php p($l->t('Custom categories')); ?>
</div>
<div class="side-menu-setting-form">
@ -1040,9 +1043,9 @@ $labelReset = 'Reset to default';
<div class="badges">
<span class="badge badge-1"><?php p($l->t('Default')); ?></span>
<span class="badge badge-2"><?php p($l->t('With categories')); ?></span>
<span class="badge badge-3"><?php p($l->t('Big menu')); ?></span>
<span class="badge badge-4"><?php p($l->t('Always displayed')); ?></span>
<span class="badge badge-2"><?php p($l->t($labelWithCategories)); ?></span>
<span class="badge badge-3"><?php p($l->t($labelBigMenu)); ?></span>
<span class="badge badge-4"><?php p($l->t($labelAlwaysDisplayed)); ?></span>
</div>
<p>