eslint —fix

This commit is contained in:
taehoon 2019-07-10 20:59:10 -04:00
parent 9712e324e5
commit b2dbf01a72
3 changed files with 423 additions and 191 deletions

View file

@ -1,8 +1,7 @@
<template> <template>
<div> <div>
<Popper <Popper
trigger="click" trigger="click"
@hide='showDropDown = false'
append-to-body append-to-body
:options="{ :options="{
placement: 'bottom-end', placement: 'bottom-end',
@ -10,76 +9,158 @@
arrow: { enabled: true }, arrow: { enabled: true },
offset: { offset: '0, 5px' }, offset: { offset: '0, 5px' },
} }
}"> }"
@hide="showDropDown = false"
>
<div class="popper-wrapper"> <div class="popper-wrapper">
<div class="dropdown-menu"> <div class="dropdown-menu">
<span v-if='user.is_local'> <span v-if="user.is_local">
<button class="dropdown-item" @click='toggleRight("admin")'> <button
class="dropdown-item"
@click="toggleRight(&quot;admin&quot;)"
>
{{ $t(!!user.rights.admin ? 'user_card.admin_menu.revoke_admin' : 'user_card.admin_menu.grant_admin') }} {{ $t(!!user.rights.admin ? 'user_card.admin_menu.revoke_admin' : 'user_card.admin_menu.grant_admin') }}
</button> </button>
<button class="dropdown-item" @click='toggleRight("moderator")'> <button
class="dropdown-item"
@click="toggleRight(&quot;moderator&quot;)"
>
{{ $t(!!user.rights.moderator ? 'user_card.admin_menu.revoke_moderator' : 'user_card.admin_menu.grant_moderator') }} {{ $t(!!user.rights.moderator ? 'user_card.admin_menu.revoke_moderator' : 'user_card.admin_menu.grant_moderator') }}
</button> </button>
<div role="separator" class="dropdown-divider"></div> <div
role="separator"
class="dropdown-divider"
/>
</span> </span>
<button class="dropdown-item" @click='toggleActivationStatus()'> <button
class="dropdown-item"
@click="toggleActivationStatus()"
>
{{ $t(!!user.deactivated ? 'user_card.admin_menu.activate_account' : 'user_card.admin_menu.deactivate_account') }} {{ $t(!!user.deactivated ? 'user_card.admin_menu.activate_account' : 'user_card.admin_menu.deactivate_account') }}
</button> </button>
<button class="dropdown-item" @click='deleteUserDialog(true)'> <button
class="dropdown-item"
@click="deleteUserDialog(true)"
>
{{ $t('user_card.admin_menu.delete_account') }} {{ $t('user_card.admin_menu.delete_account') }}
</button> </button>
<div role="separator" class="dropdown-divider" v-if='hasTagPolicy'></div> <div
<span v-if='hasTagPolicy'> v-if="hasTagPolicy"
<button class="dropdown-item" @click='toggleTag(tags.FORCE_NSFW)'> role="separator"
class="dropdown-divider"
/>
<span v-if="hasTagPolicy">
<button
class="dropdown-item"
@click="toggleTag(tags.FORCE_NSFW)"
>
{{ $t('user_card.admin_menu.force_nsfw') }} {{ $t('user_card.admin_menu.force_nsfw') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_NSFW) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_NSFW) }"
/>
</button> </button>
<button class="dropdown-item" @click='toggleTag(tags.STRIP_MEDIA)'> <button
class="dropdown-item"
@click="toggleTag(tags.STRIP_MEDIA)"
>
{{ $t('user_card.admin_menu.strip_media') }} {{ $t('user_card.admin_menu.strip_media') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.STRIP_MEDIA) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.STRIP_MEDIA) }"
/>
</button> </button>
<button class="dropdown-item" @click='toggleTag(tags.FORCE_UNLISTED)'> <button
class="dropdown-item"
@click="toggleTag(tags.FORCE_UNLISTED)"
>
{{ $t('user_card.admin_menu.force_unlisted') }} {{ $t('user_card.admin_menu.force_unlisted') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_UNLISTED) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_UNLISTED) }"
/>
</button> </button>
<button class="dropdown-item" @click='toggleTag(tags.SANDBOX)'> <button
class="dropdown-item"
@click="toggleTag(tags.SANDBOX)"
>
{{ $t('user_card.admin_menu.sandbox') }} {{ $t('user_card.admin_menu.sandbox') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.SANDBOX) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.SANDBOX) }"
/>
</button> </button>
<button class="dropdown-item" v-if='user.is_local' @click='toggleTag(tags.DISABLE_REMOTE_SUBSCRIPTION)'> <button
v-if="user.is_local"
class="dropdown-item"
@click="toggleTag(tags.DISABLE_REMOTE_SUBSCRIPTION)"
>
{{ $t('user_card.admin_menu.disable_remote_subscription') }} {{ $t('user_card.admin_menu.disable_remote_subscription') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_REMOTE_SUBSCRIPTION) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_REMOTE_SUBSCRIPTION) }"
/>
</button> </button>
<button class="dropdown-item" v-if='user.is_local' @click='toggleTag(tags.DISABLE_ANY_SUBSCRIPTION)'> <button
v-if="user.is_local"
class="dropdown-item"
@click="toggleTag(tags.DISABLE_ANY_SUBSCRIPTION)"
>
{{ $t('user_card.admin_menu.disable_any_subscription') }} {{ $t('user_card.admin_menu.disable_any_subscription') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_ANY_SUBSCRIPTION) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_ANY_SUBSCRIPTION) }"
/>
</button> </button>
<button class="dropdown-item" v-if='user.is_local' @click='toggleTag(tags.QUARANTINE)'> <button
v-if="user.is_local"
class="dropdown-item"
@click="toggleTag(tags.QUARANTINE)"
>
{{ $t('user_card.admin_menu.quarantine') }} {{ $t('user_card.admin_menu.quarantine') }}
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.QUARANTINE) }"></span> <span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.QUARANTINE) }"
/>
</button> </button>
</span> </span>
</div> </div>
</div> </div>
<button slot="reference" class="btn btn-default btn-block" v-bind:class="{ pressed: showDropDown }" @click='toggleMenu'> <button
slot="reference"
class="btn btn-default btn-block"
:class="{ pressed: showDropDown }"
@click="toggleMenu"
>
{{ $t('user_card.admin_menu.moderation') }} {{ $t('user_card.admin_menu.moderation') }}
</button> </button>
</Popper> </Popper>
<portal to="modal"> <portal to="modal">
<DialogModal v-if="showDeleteUserDialog" :onCancel='deleteUserDialog.bind(this, false)'> <DialogModal
<template slot="header">{{ $t('user_card.admin_menu.delete_user') }}</template> v-if="showDeleteUserDialog"
:on-cancel="deleteUserDialog.bind(this, false)"
>
<template slot="header">
{{ $t('user_card.admin_menu.delete_user') }}
</template>
<p>{{ $t('user_card.admin_menu.delete_user_confirmation') }}</p> <p>{{ $t('user_card.admin_menu.delete_user_confirmation') }}</p>
<template slot="footer"> <template slot="footer">
<button class="btn btn-default" @click='deleteUserDialog(false)'> <button
class="btn btn-default"
@click="deleteUserDialog(false)"
>
{{ $t('general.cancel') }} {{ $t('general.cancel') }}
</button> </button>
<button class="btn btn-default danger" @click='deleteUser()'> <button
class="btn btn-default danger"
@click="deleteUser()"
>
{{ $t('user_card.admin_menu.delete_user') }} {{ $t('user_card.admin_menu.delete_user') }}
</button> </button>
</template> </template>
</DialogModal> </DialogModal>
</portal> </portal>
</div> </div>
</template> </template>
<script src="./moderation_tools.js"></script> <script src="./moderation_tools.js"></script>

View file

@ -1,5 +1,8 @@
<template> <template>
<button :disabled="progress || disabled" @click="onClick"> <button
:disabled="progress || disabled"
@click="onClick"
>
<template v-if="progress && $slots.progress"> <template v-if="progress && $slots.progress">
<slot name="progress" /> <slot name="progress" />
</template> </template>

View file

@ -1,53 +1,127 @@
<template> <template>
<div class="user-card" :class="classes" :style="style"> <div
class="user-card"
:class="classes"
:style="style"
>
<div class="panel-heading"> <div class="panel-heading">
<div class='user-info'> <div class="user-info">
<div class='container'> <div class="container">
<router-link :to="userProfileLink(user)"> <router-link :to="userProfileLink(user)">
<UserAvatar :betterShadow="betterShadow" :user="user"/> <UserAvatar
:better-shadow="betterShadow"
:user="user"
/>
</router-link> </router-link>
<div class="user-summary"> <div class="user-summary">
<div class="top-line"> <div class="top-line">
<div :title="user.name" class='user-name' v-if="user.name_html" v-html="user.name_html"></div> <!-- eslint-disable vue/no-v-html -->
<div :title="user.name" class='user-name' v-else>{{user.name}}</div> <div
<router-link :to="{ name: 'user-settings' }" v-if="!isOtherUser"> v-if="user.name_html"
<i class="button-icon icon-wrench usersettings" :title="$t('tool_tip.user_settings')"></i> :title="user.name"
class="user-name"
v-html="user.name_html"
/>
<!-- eslint-enabled vue/no-v-html -->
<div
v-else
:title="user.name"
class="user-name"
>
{{ user.name }}
</div>
<router-link
v-if="!isOtherUser"
:to="{ name: 'user-settings' }"
>
<i
class="button-icon icon-wrench usersettings"
:title="$t('tool_tip.user_settings')"
/>
</router-link> </router-link>
<a :href="user.statusnet_profile_url" target="_blank" v-if="isOtherUser && !user.is_local"> <a
<i class="icon-link-ext usersettings"></i> v-if="isOtherUser && !user.is_local"
:href="user.statusnet_profile_url"
target="_blank"
>
<i class="icon-link-ext usersettings" />
</a> </a>
</div> </div>
<div class="bottom-line"> <div class="bottom-line">
<router-link class="user-screen-name" :to="userProfileLink(user)">@{{user.screen_name}}</router-link> <router-link
<span class="alert staff" v-if="!hideBio && !!visibleRole">{{visibleRole}}</span> class="user-screen-name"
<span v-if="user.locked"><i class="icon icon-lock"></i></span> :to="userProfileLink(user)"
<span v-if="!hideUserStatsLocal && !hideBio" class="dailyAvg">{{dailyAvg}} {{ $t('user_card.per_day') }}</span> >
@{{ user.screen_name }}
</router-link>
<span
v-if="!hideBio && !!visibleRole"
class="alert staff"
>{{ visibleRole }}</span>
<span v-if="user.locked"><i class="icon icon-lock" /></span>
<span
v-if="!hideUserStatsLocal && !hideBio"
class="dailyAvg"
>{{ dailyAvg }} {{ $t('user_card.per_day') }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="user-meta"> <div class="user-meta">
<div v-if="user.follows_you && loggedIn && isOtherUser" class="following"> <div
v-if="user.follows_you && loggedIn && isOtherUser"
class="following"
>
{{ $t('user_card.follows_you') }} {{ $t('user_card.follows_you') }}
</div> </div>
<div class="highlighter" v-if="isOtherUser && (loggedIn || !switcher)"> <div
v-if="isOtherUser && (loggedIn || !switcher)"
class="highlighter"
>
<!-- id's need to be unique, otherwise vue confuses which user-card checkbox belongs to --> <!-- id's need to be unique, otherwise vue confuses which user-card checkbox belongs to -->
<input class="userHighlightText" type="text" :id="'userHighlightColorTx'+user.id" v-if="userHighlightType !== 'disabled'" v-model="userHighlightColor"/> <input
<input class="userHighlightCl" type="color" :id="'userHighlightColor'+user.id" v-if="userHighlightType !== 'disabled'" v-model="userHighlightColor"/> v-if="userHighlightType !== 'disabled'"
<label for="style-switcher" class='userHighlightSel select'> :id="'userHighlightColorTx'+user.id"
<select class="userHighlightSel" :id="'userHighlightSel'+user.id" v-model="userHighlightType"> v-model="userHighlightColor"
class="userHighlightText"
type="text"
>
<input
v-if="userHighlightType !== 'disabled'"
:id="'userHighlightColor'+user.id"
v-model="userHighlightColor"
class="userHighlightCl"
type="color"
>
<label
for="style-switcher"
class="userHighlightSel select"
>
<select
:id="'userHighlightSel'+user.id"
v-model="userHighlightType"
class="userHighlightSel"
>
<option value="disabled">No highlight</option> <option value="disabled">No highlight</option>
<option value="solid">Solid bg</option> <option value="solid">Solid bg</option>
<option value="striped">Striped bg</option> <option value="striped">Striped bg</option>
<option value="side">Side stripe</option> <option value="side">Side stripe</option>
</select> </select>
<i class="icon-down-open"/> <i class="icon-down-open" />
</label> </label>
</div> </div>
</div> </div>
<div v-if="loggedIn && isOtherUser" class="user-interactions"> <div
v-if="loggedIn && isOtherUser"
class="user-interactions"
>
<div v-if="!user.following"> <div v-if="!user.following">
<button @click="followUser" class="btn btn-default btn-block" :disabled="followRequestInProgress" :title="followRequestSent ? $t('user_card.follow_again') : ''"> <button
class="btn btn-default btn-block"
:disabled="followRequestInProgress"
:title="followRequestSent ? $t('user_card.follow_again') : ''"
@click="followUser"
>
<template v-if="followRequestInProgress"> <template v-if="followRequestInProgress">
{{ $t('user_card.follow_progress') }} {{ $t('user_card.follow_progress') }}
</template> </template>
@ -60,72 +134,146 @@
</button> </button>
</div> </div>
<div v-else-if="followRequestInProgress"> <div v-else-if="followRequestInProgress">
<button @click="unfollowUser" class="btn btn-default btn-block pressed" disabled :title="$t('user_card.follow_unfollow')"> <button
class="btn btn-default btn-block pressed"
disabled
:title="$t('user_card.follow_unfollow')"
@click="unfollowUser"
>
{{ $t('user_card.follow_progress') }} {{ $t('user_card.follow_progress') }}
</button> </button>
</div> </div>
<div class="btn-group" v-else> <div
<button @click="unfollowUser" class="btn btn-default pressed" :title="$t('user_card.follow_unfollow')"> v-else
class="btn-group"
>
<button
class="btn btn-default pressed"
:title="$t('user_card.follow_unfollow')"
@click="unfollowUser"
>
{{ $t('user_card.following') }} {{ $t('user_card.following') }}
</button> </button>
<ProgressButton class="btn btn-default" :click="subscribeUser" :title="$t('user_card.subscribe')" v-if="!user.subscribed"> <ProgressButton
v-if="!user.subscribed"
class="btn btn-default"
:click="subscribeUser"
:title="$t('user_card.subscribe')"
>
<i class="icon-bell-alt" /> <i class="icon-bell-alt" />
</ProgressButton> </ProgressButton>
<ProgressButton class="btn btn-default pressed" :click="unsubscribeUser" :title="$t('user_card.unsubscribe')" v-else> <ProgressButton
v-else
class="btn btn-default pressed"
:click="unsubscribeUser"
:title="$t('user_card.unsubscribe')"
>
<i class="icon-bell-alt" /> <i class="icon-bell-alt" />
</ProgressButton> </ProgressButton>
</div> </div>
<div> <div>
<button @click="unmuteUser" class="btn btn-default btn-block pressed" v-if="user.muted"> <button
v-if="user.muted"
class="btn btn-default btn-block pressed"
@click="unmuteUser"
>
{{ $t('user_card.muted') }} {{ $t('user_card.muted') }}
</button> </button>
<button @click="muteUser" class="btn btn-default btn-block" v-else> <button
v-else
class="btn btn-default btn-block"
@click="muteUser"
>
{{ $t('user_card.mute') }} {{ $t('user_card.mute') }}
</button> </button>
</div> </div>
<div> <div>
<button @click="unblockUser" class="btn btn-default btn-block pressed" v-if="user.statusnet_blocking"> <button
v-if="user.statusnet_blocking"
class="btn btn-default btn-block pressed"
@click="unblockUser"
>
{{ $t('user_card.blocked') }} {{ $t('user_card.blocked') }}
</button> </button>
<button @click="blockUser" class="btn btn-default btn-block" v-else> <button
v-else
class="btn btn-default btn-block"
@click="blockUser"
>
{{ $t('user_card.block') }} {{ $t('user_card.block') }}
</button> </button>
</div> </div>
<div> <div>
<button @click="reportUser" class="btn btn-default btn-block"> <button
class="btn btn-default btn-block"
@click="reportUser"
>
{{ $t('user_card.report') }} {{ $t('user_card.report') }}
</button> </button>
</div> </div>
<ModerationTools :user='user' v-if='loggedIn.role === "admin"' /> <ModerationTools
v-if="loggedIn.role === &quot;admin&quot;"
:user="user"
/>
</div> </div>
<div class="user-interactions" v-if="!loggedIn && user.is_local"> <div
v-if="!loggedIn && user.is_local"
class="user-interactions"
>
<RemoteFollow :user="user" /> <RemoteFollow :user="user" />
</div> </div>
</div> </div>
</div> </div>
<div class="panel-body" v-if="!hideBio"> <div
<div v-if="!hideUserStatsLocal && switcher" class="user-counts"> v-if="!hideBio"
<div class="user-count" v-on:click.prevent="setProfileView('statuses')"> class="panel-body"
>
<div
v-if="!hideUserStatsLocal && switcher"
class="user-counts"
>
<div
class="user-count"
@click.prevent="setProfileView('statuses')"
>
<h5>{{ $t('user_card.statuses') }}</h5> <h5>{{ $t('user_card.statuses') }}</h5>
<span>{{user.statuses_count}} <br></span> <span>{{ user.statuses_count }} <br></span>
</div> </div>
<div class="user-count" v-on:click.prevent="setProfileView('friends')"> <div
class="user-count"
@click.prevent="setProfileView('friends')"
>
<h5>{{ $t('user_card.followees') }}</h5> <h5>{{ $t('user_card.followees') }}</h5>
<span>{{user.friends_count}}</span> <span>{{ user.friends_count }}</span>
</div> </div>
<div class="user-count" v-on:click.prevent="setProfileView('followers')"> <div
class="user-count"
@click.prevent="setProfileView('followers')"
>
<h5>{{ $t('user_card.followers') }}</h5> <h5>{{ $t('user_card.followers') }}</h5>
<span>{{user.followers_count}}</span> <span>{{ user.followers_count }}</span>
</div> </div>
</div> </div>
<p @click.prevent="linkClicked" v-if="!hideBio && user.description_html" class="user-card-bio" v-html="user.description_html"></p> <!-- eslint-disable vue/no-v-html -->
<p v-else-if="!hideBio" class="user-card-bio">{{ user.description }}</p> <p
v-if="!hideBio && user.description_html"
class="user-card-bio"
@click.prevent="linkClicked"
v-html="user.description_html"
/>
<!-- eslint-enabled vue/no-v-html -->
<p
v-else-if="!hideBio"
class="user-card-bio"
>
{{ user.description }}
</p>
</div>
</div> </div>
</div>
</template> </template>
<script src="./user_card.js"></script> <script src="./user_card.js"></script>