Skip to content

Commit

Permalink
Adjust UI to the new structure
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Feb 8, 2019
1 parent 0d1512d commit e8c924b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 302 deletions.
269 changes: 4 additions & 265 deletions js/admin/commands.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/admin/commands.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue/src/Commands.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div id="chat_commands" class="section">
<div id="chat_commands" class="videocalls section">
<h2>{{ t('spreed', 'Commands') }}</h2>

<div>
Expand Down
64 changes: 29 additions & 35 deletions vue/src/components/Command.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,51 @@
-->

<template>
<div>
<input type="text" class="name" placeholder="t('spreed', 'Poster name')" :value="name" :aria-label="t('spreed', 'Poster name')">
<input type="text" class="pattern" placeholder="t('spreed', 'Command pattern (e.g. `^help` to match all messages starting with help)')" :value="pattern" :aria-label="t('spreed', 'Command pattern')">
<input type="text" class="script" placeholder="/path/to/your/script" :value="script" :aria-label="t('spreed', 'Script to execute')">

<multiselect
:value="selectedOutput"
:options="outputOptions"
:placeholder="t('spreed', 'Response visibility')"
label="label"
track-by="value"
@input="updateOutput" />
<div class="row">
<div class="name">{{name}}</div>
<div class="command">{{command}}</div>
<div class="script">{{script}}</div>
<div class="response">{{translatedResponse}}</div>
<div class="enabled">{{translatedEnabled}}</div>
</div>
</template>

<script>
import { Multiselect } from 'nextcloud-vue';

export default {
name: 'command',

props: [
'id',
'name',
'pattern',
'command',
'script',
'output'
'response',
'enabled'
],

computed: {
selectedOutput() {
return this.outputOptions.find(option => option.value === this.output)
translatedResponse () {
switch (this.response) {
case 0:
return t('spreed', 'None');
case 1:
return t('spreed', 'User');
default:
return t('spreed', 'Everyone');
}
},
outputOptions () {
return [
{ label: t('spreed', 'None'), value: 0 },
{ label: t('spreed', 'User'), value: 1 },
{ label: t('spreed', 'Everyone'), value: 2 },
];
}
},

methods: {
updateOutput: option => {
console.debug(option)
// send the option.value change to the database
translatedEnabled () {
switch (this.enabled) {
case 0:
return t('spreed', 'Disabled');
case 1:
return t('spreed', 'Moderators');
case 2:
return t('spreed', 'Users');
default:
return t('spreed', 'Everyone');
}
}
},

components: {
Multiselect
}
}
</script>

0 comments on commit e8c924b

Please sign in to comment.