You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

files-app-settings.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>
  3. * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
  4. *
  5. * @author Gary Kim <gary@garykim.dev>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. import Vue from 'vue'
  24. import Settings from './services/Settings'
  25. import SettingsView from './views/Settings'
  26. import Setting from './models/Setting'
  27. Vue.prototype.t = t
  28. // Init Files App Settings Service
  29. if (!window.OCA.Files) {
  30. window.OCA.Files = {}
  31. }
  32. Object.assign(window.OCA.Files, { Settings: new Settings() })
  33. Object.assign(window.OCA.Files.Settings, { Setting })
  34. window.addEventListener('DOMContentLoaded', function() {
  35. // Init Vue app
  36. // eslint-disable-next-line
  37. new Vue({
  38. el: '#files-app-settings',
  39. render: h => h(SettingsView),
  40. })
  41. const appSettingsHeader = document.getElementById('app-settings-header')
  42. if (appSettingsHeader) {
  43. appSettingsHeader.addEventListener('click', e => {
  44. const opened = e.currentTarget.children[0].classList.contains('opened')
  45. OCA.Files.Settings.settings.forEach(e => opened ? e.close() : e.open())
  46. })
  47. }
  48. })