diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-21 08:27:38 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-25 17:12:27 +0200 |
commit | 263d2c89fb2a8faa0cfdee230de2177b34534c9b (patch) | |
tree | 87bc1d9e1eba76a357ac3a0549d662190a9c3e3a /apps/accessibility/src | |
parent | a23a6004a5a94f1bce548a0e41eb8cb642b136a3 (diff) | |
download | nextcloud-server-263d2c89fb2a8faa0cfdee230de2177b34534c9b.tar.gz nextcloud-server-263d2c89fb2a8faa0cfdee230de2177b34534c9b.zip |
Config set and drone
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/accessibility/src')
-rw-r--r-- | apps/accessibility/src/App.vue | 32 | ||||
-rw-r--r-- | apps/accessibility/src/components/itemPreview.vue | 6 | ||||
-rw-r--r-- | apps/accessibility/src/main.js | 1 |
3 files changed, 31 insertions, 8 deletions
diff --git a/apps/accessibility/src/App.vue b/apps/accessibility/src/App.vue index 7b196f840ab..f2b0eff31d3 100644 --- a/apps/accessibility/src/App.vue +++ b/apps/accessibility/src/App.vue @@ -21,6 +21,7 @@ <script> import preview from './components/itemPreview'; +import axios from 'axios'; export default { name: 'app', @@ -51,6 +52,9 @@ export default { theme: this.serverData.theme, font: this.serverData.font }; + }, + tokenHeaders() { + return { headers: { requesttoken: OC.requestToken } } } }, methods: { @@ -69,12 +73,28 @@ export default { * @param {string} id the data of the change */ selectItem(type, id) { - this.serverData[type] = id; - let cssLink = document.querySelector( - 'link[rel=stylesheet][href*=accessibility][href*=user-]' - ); - cssLink.href = - cssLink.href.split('?')[0] + '?v=' + new Date().getTime(); + axios + .post(OC.linkToOCS('apps/accessibility/api/v1/config', 2) + type, {value: id}, this.tokenHeaders) + .then(response => { + this.serverData[type] = id; + + // Remove old link + let oldLink = document.querySelector('link[rel=stylesheet][href*=accessibility][href*=user-]'); + if (oldLink) { + oldLink.remove(); + } + + // Insert new css + let link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = OC.generateUrl('/apps/accessibility/css/user-style.css'); + link.href = link.href.split('?')[0] + '?v=' + new Date().getTime(); + document.head.appendChild(link) + }) + .catch(err => { + console.log(err, err.response); + OC.Notification.showTemporary(t('accessibility', err.response.data.ocs.meta.message + '. Unable to apply the setting.')); + }); } } }; diff --git a/apps/accessibility/src/components/itemPreview.vue b/apps/accessibility/src/components/itemPreview.vue index d1139aa407e..38f54f60f9e 100644 --- a/apps/accessibility/src/components/itemPreview.vue +++ b/apps/accessibility/src/components/itemPreview.vue @@ -1,9 +1,11 @@ <template> <div :class="{preview: true, selected: preview.id === selected}" @click="selectItem"> - <div class="icon-checkmark"></div> <div class="preview-image" :style="{backgroundImage: 'url(' + preview.img + ')'}"></div> - <h3>{{preview.title}}</h3> + <h3> + <span>{{preview.title}}</span> + <div class="icon-checkmark-color">{{t('accessibility', 'enabled')}}</div> + </h3> <p>{{preview.text}}</p> </div> </template> diff --git a/apps/accessibility/src/main.js b/apps/accessibility/src/main.js index 8782a4362b6..5d9b2a2d0a8 100644 --- a/apps/accessibility/src/main.js +++ b/apps/accessibility/src/main.js @@ -3,6 +3,7 @@ import App from './App.vue'; /* global t */ // bind to window +Vue.prototype.OC = OC; Vue.prototype.t = t; new Vue({ |