Merge pull request #337 from h3poteto/iss-330

closes #330 Set sensitive in new toot modal
This commit is contained in:
AkiraFukushima 2018-05-25 00:25:20 +09:00 committed by GitHub
commit 0bad89cff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -31,6 +31,12 @@
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="sensitive" v-if="attachedMedias.length > 0">
<el-button size="small" type="text" @click="changeSensitive">
<icon name="eye-slash" v-if="sensitive"></icon>
<icon name="eye" v-else></icon>
</el-button>
</div>
<span class="text-count">{{ 500 - status.length }}</span>
<el-button @click="close">Cancel</el-button>
<el-button type="primary" @click="toot" v-loading="blockSubmit">Toot</el-button>
@ -61,6 +67,7 @@ export default {
attachedMedias: state => state.TimelineSpace.Modals.NewToot.attachedMedias,
blockSubmit: state => state.TimelineSpace.Modals.NewToot.blockSubmit,
visibility: state => state.TimelineSpace.Modals.NewToot.visibility,
sensitive: state => state.TimelineSpace.Modals.NewToot.sensitive,
visibilityIcon: (state) => {
switch (state.TimelineSpace.Modals.NewToot.visibility) {
case 'public':
@ -119,7 +126,8 @@ export default {
}
let form = {
status: this.status,
visibility: this.visibility
visibility: this.visibility,
sensitive: this.sensitive
}
if (this.replyToId !== null) {
form = Object.assign(form, {
@ -193,6 +201,9 @@ export default {
},
changeVisibility (level) {
this.$store.commit('TimelineSpace/Modals/NewToot/changeVisibility', level)
},
changeSensitive () {
this.$store.commit('TimelineSpace/Modals/NewToot/changeSensitive', !this.sensitive)
}
}
}
@ -274,6 +285,11 @@ export default {
margin-left: 8px;
}
.sensitive {
float: left;
margin-left: 8px;
}
.text-count {
padding-right: 24px;
color: #909399;

View File

@ -10,7 +10,8 @@ const NewToot = {
replyToMessage: null,
blockSubmit: false,
attachedMedias: [],
visibility: 'public'
visibility: 'public',
sensitive: false
},
mutations: {
changeModal (state, value) {
@ -36,6 +37,9 @@ const NewToot = {
},
changeVisibility (state, value) {
state.visibility = value
},
changeSensitive (state, value) {
state.sensitive = value
}
},
actions: {
@ -70,6 +74,7 @@ const NewToot = {
commit('setReplyTo', null)
commit('changeBlockSubmit', false)
commit('clearAttachedMedias')
commit('changeSensitive', false)
}
},
uploadImage ({ state, commit, rootState }, image) {