Skip to content

Commit

Permalink
version 27 adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
memurats committed Jan 23, 2024
1 parent 93e9cb1 commit 65727fb
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 31 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<personal>OCA\NMCSettings\Settings\Personal\Security\NmcEndToEndEncryption</personal>
<personal-section>OCA\NMCSettings\Sections\Personal\AccountSettings</personal-section>
<personal-section>OCA\NMCSettings\Sections\Personal\DevicesSessions</personal-section>
<personal-section>OCA\NMCSettings\Sections\Personal\Themes</personal-section>
<personal-section>OCA\NMCSettings\Sections\Personal\Appearance</personal-section>
<personal>OCA\NMCSettings\Settings\Groupware</personal>
<personal>OCA\NMCSettings\Settings\PersonalInfo</personal>
<personal>OCA\NMCSettings\Settings\Security</personal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Themes implements IIconSection {
private IL10N $l;
private IURLGenerator $urlGenerator;
class Appearance implements IIconSection {

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

/** @var IURLGenerator */
private $urlGenerator;

public function __construct(IL10N $l, IURLGenerator $urlGenerator) {
$this->l = $l;
$this->urlGenerator = $urlGenerator;
}

public function getIcon(): string {
public function getIcon() {
return $this->urlGenerator->imagePath('nmctheme', 'settings/appearance.svg');
}

public function getID(): string {
return 'themes';
return 'appearance';
}

public function getName(): string {
return $this->l->t('Appearance');
}

public function getPriority(): int {
return -1;
return -5;
}
}
2 changes: 1 addition & 1 deletion lib/Settings/Personal/NmcPersonalThemes.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getForm(): TemplateResponse {

/** {@inheritDoc} */
public function getSection(): string {
return 'themes';
return 'appearance';
}

/** {@inheritDoc} */
Expand Down
12 changes: 2 additions & 10 deletions src/components/UserThemes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

<template>
<section>
<NcSettingsSection :title="t('nmcsettings', 'Appearance')"
<NcSettingsSection :name="t('nmcsettings', 'Appearance')"
:limit-width="false"
class="theming">
<p v-html="description" />

<h2 class="subheader">
{{ t('nmcsettings', 'Theming') }}
{{ t('nmcsettings', 'Design') }}
</h2>

<p v-html="themedescription" />
Expand Down Expand Up @@ -60,8 +60,6 @@ const availableThemes = loadState('theming', 'themes', [])
const enforceTheme = loadState('theming', 'enforceTheme', '')
const shortcutsDisabled = loadState('theming', 'shortcutsDisabled', false)
const background = loadState('theming', 'background')
const themingDefaultBackground = loadState('theming', 'themingDefaultBackground')
const isUserThemingDisabled = loadState('theming', 'isUserThemingDisabled')
console.debug('Available themes', availableThemes)
Expand All @@ -79,8 +77,6 @@ export default {
availableThemes,
enforceTheme,
shortcutsDisabled,
background,
themingDefaultBackground,
isUserThemingDisabled,
}
},
Expand Down Expand Up @@ -128,10 +124,6 @@ export default {
},
methods: {
updateBackground(data) {
this.background = (data.type === 'custom' || data.type === 'default') ? data.type : data.value
this.$emit('update:background')
},
changeTheme({ enabled, id }) {
// Reset selected and select new one
Expand Down
4 changes: 2 additions & 2 deletions src/js/nmcsettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ window.addEventListener('DOMContentLoaded', function() {
const type = element.attributes['data-section-type'].value
if (type === 'personal') {
const id = element.attributes['data-section-id'].value
if (id !== 'account' && id !== 'sessions') {
if (id !== 'account' && id !== 'sessions' && id !== 'appearance') {
element.remove()
}
}
Expand All @@ -20,7 +20,7 @@ window.addEventListener('DOMContentLoaded', function() {
const admin = '/admin'
const account = '/account'
const sessions = '/sessions'
const themes = '/themes'
const themes = '/appearance'

if (href.includes(admin) || href.includes(account) || href.includes(sessions) || href.includes(themes)) {
if (href.includes(admin)) {
Expand Down
19 changes: 8 additions & 11 deletions webpack.config.cjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
// webpack with standard nextcloud config
const path = require('path')
const webpack = require('webpack')
const webpackConfig = require('@nextcloud/webpack-vue-config')

webpackConfig.entry = {
...webpackConfig.entry,
account: path.join(__dirname, 'src', 'js', 'account.js'),
devices: path.join(__dirname, 'src', 'js', 'devices.js'),
nmcsettings: path.join(__dirname, 'src', 'js', 'nmcsettings.js'),
personal: path.join(__dirname, 'src', 'js', 'personal.js'),
sessions: path.join(__dirname, 'src', 'js', 'sessions.js'),
themes: path.join(__dirname, 'src', 'js', 'themes.js'),
}
...webpackConfig.entry,
account: path.join(__dirname, 'src', 'js', 'account.js'),
devices: path.join(__dirname, 'src', 'js', 'devices.js'),
nmcsettings: path.join(__dirname, 'src', 'js', 'nmcsettings.js'),
personal: path.join(__dirname, 'src', 'js', 'personal.js'),
sessions: path.join(__dirname, 'src', 'js', 'sessions.js'),
themes: path.join(__dirname, 'src', 'js', 'themes.js'),
}

// Workaround for https://github.com/nextcloud/webpack-vue-config/pull/432 causing problems with nextcloud-vue-collections
webpackConfig.resolve.alias = {}

webpackConfig.resolve.extensions = ['.*', '.js', '.ts', '.vue', '.json']

module.exports = webpackConfig

0 comments on commit 65727fb

Please sign in to comment.