refactoring: update severals components

This commit is contained in:
Simon Vieille
2025-04-04 20:13:15 +02:00
parent 4f261c434d
commit d8a622ce0f
37 changed files with 1857 additions and 1782 deletions
+19 -26
View File
@@ -15,11 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import AdminCategoriesCustom from './AdminCategoriesCustom.vue'
import Vue from 'vue'
Vue.prototype.OC = window.OC
Vue.prototype.OCA = window.OCA
import { createApp } from 'vue'
import AdminCategoriesCustom from './components/AdminCategoriesCustom.vue'
let elements = []
@@ -37,10 +34,10 @@ const userConfig = (name, value, callbacks) => {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: formData.join('&')
body: formData.join('&'),
})
.then(callbacks.success)
.catch(callbacks.error)
.then(callbacks.success)
.catch(callbacks.error)
}
const appConfig = (name, value, callbacks) => {
@@ -81,12 +78,12 @@ const saveSettings = (key) => {
const progress = document.querySelector('#side-menu-save-progress')
progress.style.width = '40px';
progress.style.marginLeft = '5px';
progress.style.width = '40px'
progress.style.marginLeft = '5px'
const callbacks = {
success: () => {
const percent = parseInt((key + 1) * 100 / size);
const percent = parseInt(((key + 1) * 100) / size)
progress.setAttribute('value', percent)
@@ -98,7 +95,7 @@ const saveSettings = (key) => {
},
error: () => {
OC.msg.finishedError(selector, t('side_menu', 'Error while saving "' + element + '"'))
}
},
}
if (element.hasAttribute('data-personal')) {
@@ -134,13 +131,11 @@ const updateAppsCategoriesCustom = () => {
}
document.addEventListener('DOMContentLoaded', () => {
$('*[data-toggle="tooltip"]').tooltip();
$('*[data-toggle="tooltip"]').tooltip()
if (document.querySelector('#side-menu-categories-custom')) {
const View = Vue.extend(AdminCategoriesCustom)
const adminCategoriesCustom = new View({})
adminCategoriesCustom.$mount('#side-menu-categories-custom')
const app = createApp(AdminCategoriesCustom)
app.mount('#side-menu-categories-custom')
}
elements = document.querySelectorAll('.side-menu-setting')
@@ -220,15 +215,15 @@ document.addEventListener('DOMContentLoaded', () => {
}
if (name === 'icon-invert-filter' || name === 'icon-opacity') {
value/=100
value /= 100
}
if (['dark-mode-background-color', 'dark-mode-background-color-to'].indexOf(name) > -1) {
const opacity = parseInt(document.querySelector('#side-menu-dark-mode-background-color-opacity').value * 255 / 100)
const opacity = parseInt((document.querySelector('#side-menu-dark-mode-background-color-opacity').value * 255) / 100)
value = [value, opacity.toString(16)].join('')
} else if (['background-color', 'background-color-to'].indexOf(name) > -1) {
const opacity = parseInt(document.querySelector('#side-menu-background-color-opacity').value * 255 / 100)
const opacity = parseInt((document.querySelector('#side-menu-background-color-opacity').value * 255) / 100)
value = [value, opacity.toString(16)].join('')
}
@@ -247,7 +242,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
sortable('#categories-list .side-menu-setting-list', {
placeholderClass: 'side-menu-setting-list-drop'
placeholderClass: 'side-menu-setting-list-drop',
})
try {
@@ -260,11 +255,10 @@ document.addEventListener('DOMContentLoaded', () => {
document.querySelector('input[name="categories-order"]').value = JSON.stringify(value)
})
} catch (e) {
}
} catch (e) {}
sortable('#apps-order-list .side-menu-setting-list', {
placeholderClass: 'side-menu-setting-list-drop'
placeholderClass: 'side-menu-setting-list-drop',
})
try {
@@ -277,6 +271,5 @@ document.addEventListener('DOMContentLoaded', () => {
document.querySelector('input[name="apps-order"]').value = JSON.stringify(value)
})
} catch (e) {
}
} catch (e) {}
})