1
0
mirror of https://github.com/nolanlawson/pinafore synced 2025-02-02 22:57:36 +01:00

56 lines
1.6 KiB
HTML
Raw Normal View History

2018-04-04 20:33:17 -07:00
<ModalDialog
:id
2018-04-04 20:33:17 -07:00
:label
:title
background="var(--main-bg)"
>
2018-03-11 19:40:32 -07:00
<GenericDialogList :items on:click="onClick(event)" />
2018-03-03 13:23:26 -08:00
</ModalDialog>
<script>
import ModalDialog from './ModalDialog.html'
import { store } from '../../../_store/store'
import { POST_PRIVACY_OPTIONS } from '../../../_static/statuses'
import { setPostPrivacy } from '../../../_actions/postPrivacy'
2018-03-11 19:40:32 -07:00
import GenericDialogList from './GenericDialogList.html'
import { show } from '../helpers/showDialog'
import { close } from '../helpers/closeDialog'
import { oncreate } from '../helpers/onCreateDialog'
2018-03-03 13:23:26 -08:00
export default {
oncreate,
2018-03-03 13:23:26 -08:00
components: {
2018-03-11 19:40:32 -07:00
ModalDialog,
GenericDialogList
2018-03-03 13:23:26 -08:00
},
store: () => store,
data: () => ({
postPrivacyOptions: POST_PRIVACY_OPTIONS
}),
methods: {
show,
close,
2018-04-19 21:38:01 -07:00
onClick (item) {
let { realm } = this.get()
setPostPrivacy(realm, item.key)
this.close()
2018-03-03 13:23:26 -08:00
}
},
computed: {
2018-03-03 14:15:50 -08:00
composeData: ($currentComposeData, realm) => $currentComposeData[realm] || {},
2018-03-03 13:23:26 -08:00
postPrivacy: (postPrivacyKey) => {
return POST_PRIVACY_OPTIONS.find(_ => _.key === postPrivacyKey)
},
2018-03-03 14:15:50 -08:00
postPrivacyKey: (composeData, $currentVerifyCredentials) => {
return composeData.postPrivacy || $currentVerifyCredentials.source.privacy
2018-03-11 19:40:32 -07:00
},
items: (postPrivacy, postPrivacyOptions) => {
return postPrivacyOptions.map(option => ({
key: option.key,
label: option.label,
icon: option.icon,
selected: postPrivacy.key === option.key
}))
2018-03-03 13:23:26 -08:00
}
}
}
</script>