diff options
| author | Henry Jameson <me@hjkos.com> | 2019-06-16 20:24:03 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-06-16 20:24:03 +0300 |
| commit | b00da1778830853e0bed4cb1d0fa93ca09a82167 (patch) | |
| tree | 8072f743384b45dc2b4a62e619bb0b1db3e3ebf9 /src/components/scope_selector | |
| parent | 6c7cf7d9b5f2faec03fe75881b5ec81e0ac851fd (diff) | |
| parent | 1db3c785d805bfe1e7bb09f2d85875448cb03f9a (diff) | |
Merge remote-tracking branch 'upstream/develop' into docs
* upstream/develop: (374 commits)
fix typo
rename mutations according to actual property names
fix
fix
fix logged out post-update
fix user banner
fix
AMERICA
comments
No longer sending extra data, renamed some properties
Revert "add TOTP/Recovery Form for mobile version"
Apply suggestion to src/services/entity_normalizer/entity_normalizer.service.js
i18n/Update Japanese translation
render modal at the root level using portal
install portal vue
Small improve of the who to follow panel layout
Fix/Small fix in the who to follow page
remove console spam
i18n
wire up user.description with masto api data
...
Diffstat (limited to 'src/components/scope_selector')
| -rw-r--r-- | src/components/scope_selector/scope_selector.js | 54 | ||||
| -rw-r--r-- | src/components/scope_selector/scope_selector.vue | 46 |
2 files changed, 100 insertions, 0 deletions
diff --git a/src/components/scope_selector/scope_selector.js b/src/components/scope_selector/scope_selector.js new file mode 100644 index 00000000..8a42ee7b --- /dev/null +++ b/src/components/scope_selector/scope_selector.js @@ -0,0 +1,54 @@ +const ScopeSelector = { + props: [ + 'showAll', + 'userDefault', + 'originalScope', + 'initialScope', + 'onScopeChange' + ], + data () { + return { + currentScope: this.initialScope + } + }, + computed: { + showNothing () { + return !this.showPublic && !this.showUnlisted && !this.showPrivate && !this.showDirect + }, + showPublic () { + return this.originalScope !== 'direct' && this.shouldShow('public') + }, + showUnlisted () { + return this.originalScope !== 'direct' && this.shouldShow('unlisted') + }, + showPrivate () { + return this.originalScope !== 'direct' && this.shouldShow('private') + }, + showDirect () { + return this.shouldShow('direct') + }, + css () { + return { + public: {selected: this.currentScope === 'public'}, + unlisted: {selected: this.currentScope === 'unlisted'}, + private: {selected: this.currentScope === 'private'}, + direct: {selected: this.currentScope === 'direct'} + } + } + }, + methods: { + shouldShow (scope) { + return this.showAll || + this.currentScope === scope || + this.originalScope === scope || + this.userDefault === scope || + scope === 'direct' + }, + changeVis (scope) { + this.currentScope = scope + this.onScopeChange && this.onScopeChange(scope) + } + } +} + +export default ScopeSelector diff --git a/src/components/scope_selector/scope_selector.vue b/src/components/scope_selector/scope_selector.vue new file mode 100644 index 00000000..5ebb5d56 --- /dev/null +++ b/src/components/scope_selector/scope_selector.vue @@ -0,0 +1,46 @@ +<template> +<div v-if="!showNothing" class="scope-selector"> + <i class="icon-mail-alt" + :class="css.direct" + :title="$t('post_status.scope.direct')" + v-if="showDirect" + @click="changeVis('direct')"> + </i> + <i class="icon-lock" + :class="css.private" + :title="$t('post_status.scope.private')" + v-if="showPrivate" + v-on:click="changeVis('private')"> + </i> + <i class="icon-lock-open-alt" + :class="css.unlisted" + :title="$t('post_status.scope.unlisted')" + v-if="showUnlisted" + @click="changeVis('unlisted')"> + </i> + <i class="icon-globe" + :class="css.public" + :title="$t('post_status.scope.public')" + v-if="showPublic" + @click="changeVis('public')"> + </i> +</div> +</template> + +<script src="./scope_selector.js"></script> + +<style lang="scss"> +@import '../../_variables.scss'; + +.scope-selector { + i { + font-size: 1.2em; + cursor: pointer; + + &.selected { + color: $fallback--lightText; + color: var(--lightText, $fallback--lightText); + } + } +} +</style> |
