refs #2606 Use vue-fontawesome in Modals/AddListMember

This commit is contained in:
AkiraFukushima 2022-03-22 21:27:45 +09:00
parent 12036d1ab8
commit e785ed2b7e
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
2 changed files with 17 additions and 20 deletions

View File

@ -1,14 +1,10 @@
<template> <template>
<el-dialog <el-dialog :title="$t('modals.add_list_member.title')" :visible.sync="addListMemberModal" width="400px" class="add-member">
:title="$t('modals.add_list_member.title')"
:visible.sync="addListMemberModal"
width="400px"
class="add-member">
<div class="search-account" :element-loading-background="loadingBackground"> <div class="search-account" :element-loading-background="loadingBackground">
<el-form :inline="true"> <el-form :inline="true">
<input v-model="name" placeholder="Account name" class="account-name" v-shortkey="['enter']" @shortkey="search" autofocus></input> <input v-model="name" placeholder="Account name" class="account-name" v-shortkey="['enter']" @shortkey="search" autofocus />
<el-button type="text" class="search" @click="search"> <el-button type="text" class="search" @click="search">
<icon name="search"></icon> <font-awesome-icon icon="search" />
</el-button> </el-button>
</el-form> </el-form>
<div class="search-results"> <div class="search-results">
@ -21,13 +17,11 @@
<div class="username"> <div class="username">
{{ username(user) }} {{ username(user) }}
</div> </div>
<div class="acct"> <div class="acct">@{{ user.acct }}</div>
@{{ user.acct }}
</div>
</div> </div>
<div class="add"> <div class="add">
<el-button type="text" @click="add(user)"> <el-button type="text" @click="add(user)">
<icon name="plus"></icon> <font-awesome-icon icon="plus" />
</el-button> </el-button>
</div> </div>
</div> </div>
@ -42,7 +36,7 @@ import { mapState } from 'vuex'
export default { export default {
name: 'add-list-member', name: 'add-list-member',
data () { data() {
return { return {
name: '' name: ''
} }
@ -54,27 +48,28 @@ export default {
listId: state => state.TimelineSpace.Modals.AddListMember.targetListId listId: state => state.TimelineSpace.Modals.AddListMember.targetListId
}), }),
addListMemberModal: { addListMemberModal: {
get () { get() {
return this.$store.state.TimelineSpace.Modals.AddListMember.modalOpen return this.$store.state.TimelineSpace.Modals.AddListMember.modalOpen
}, },
set (value) { set(value) {
this.$store.dispatch('TimelineSpace/Modals/AddListMember/changeModal', value) this.$store.dispatch('TimelineSpace/Modals/AddListMember/changeModal', value)
} }
} }
}, },
methods: { methods: {
username (account) { username(account) {
if (account.display_name !== '') { if (account.display_name !== '') {
return account.display_name return account.display_name
} else { } else {
return account.username return account.username
} }
}, },
search () { search() {
this.$store.dispatch('TimelineSpace/Modals/AddListMember/search', this.name) this.$store.dispatch('TimelineSpace/Modals/AddListMember/search', this.name)
}, },
add (user) { add(user) {
this.$store.dispatch('TimelineSpace/Modals/AddListMember/add', user) this.$store
.dispatch('TimelineSpace/Modals/AddListMember/add', user)
.then(() => { .then(() => {
this.addListMemberModal = false this.addListMemberModal = false
this.$store.dispatch('TimelineSpace/Contents/Lists/Edit/fetchMembers', this.listId) this.$store.dispatch('TimelineSpace/Contents/Lists/Edit/fetchMembers', this.listId)

View File

@ -23,7 +23,8 @@ import {
faUnlock, faUnlock,
faLock, faLock,
faEyeSlash, faEyeSlash,
faEye faEye,
faPlus
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import 'vue-awesome/icons' import 'vue-awesome/icons'
@ -64,7 +65,8 @@ library.add(
faUnlock, faUnlock,
faLock, faLock,
faEyeSlash, faEyeSlash,
faEye faEye,
faPlus
) )
Vue.use(ElementUI, { locale }) Vue.use(ElementUI, { locale })