2018-01-30 18:12:13 +01:00
/ * *
* BetterDiscord Plugin Card Component
* Copyright ( c ) 2015 - present Jiiks / JsSucks - https : //github.com/Jiiks / https://github.com/JsSucks
* All rights reserved .
* https : //betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* /
2018-01-30 16:59:27 +01:00
< template >
2018-02-05 17:58:35 +01:00
< Card :item ="plugin" >
2018-02-19 19:10:09 +01:00
< SettingSwitch v -if = " plugin.type = = = ' plugin ' " slot = "toggle" :checked ="plugin.enabled" :change ="togglePlugin" / >
2018-02-05 17:58:35 +01:00
< ButtonGroup slot = "controls" >
2018-03-06 22:55:50 +01:00
< Button v-tooltip ="'Settings (shift + click to open settings without cloning the set)'" v-if="plugin.hasSettings" :onClick="e => showSettings(e.shiftKey)" > < MiSettings size = "18" / > < / Button >
2018-02-19 19:10:09 +01:00
< Button v-tooltip ="'Reload'" :onClick ="reloadPlugin" > < MiRefresh size = "18" / > < / Button >
< Button v-tooltip ="'Edit'" :onClick ="editPlugin" > < MiPencil size = "18" / > < / Button >
2018-03-06 22:55:50 +01:00
< Button v-tooltip ="'Uninstall (shift + click to unload)'" :onClick="e => deletePlugin(e.shiftKey)" type="err" > < MiDelete size = "18" / > < / Button >
2018-02-05 17:58:35 +01:00
< / ButtonGroup >
< / Card >
2018-01-30 16:59:27 +01:00
< / template >
< script >
2018-01-30 18:12:13 +01:00
// Imports
import { shell } from 'electron' ;
2018-02-05 17:58:35 +01:00
import Card from './Card.vue' ;
2018-02-04 22:19:05 +01:00
import { Button , ButtonGroup , SettingSwitch , MiSettings , MiRefresh , MiPencil , MiDelete , MiExtension } from '../common' ;
2018-01-30 18:12:13 +01:00
export default {
data ( ) {
return {
settingsOpen : false
}
} ,
2018-02-21 18:46:27 +01:00
props : [ 'plugin' , 'togglePlugin' , 'reloadPlugin' , 'deletePlugin' , 'showSettings' ] ,
2018-01-30 18:12:13 +01:00
components : {
2018-02-05 17:58:35 +01:00
Card , Button , ButtonGroup , SettingSwitch , MiSettings , MiRefresh , MiPencil , MiDelete , MiExtension
2018-01-30 18:12:13 +01:00
} ,
methods : {
editPlugin ( ) {
try {
shell . openItem ( this . plugin . pluginPath ) ;
} catch ( err ) {
console . log ( err ) ;
}
}
}
}
< / script >