koel/resources/assets/js/components/main-wrapper/main-content/users.vue

145 lines
2.8 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<section id="usersWrapper">
<h1 class="heading">
<span>Users
2016-10-31 04:28:12 +00:00
<i class="fa fa-angle-down toggler" v-show="isPhone && !showingControls" @click="showingControls = true"/>
<i class="fa fa-angle-up toggler" v-show="isPhone && showingControls" @click.prevent="showingControls = false"/>
2016-06-25 16:05:24 +00:00
</span>
<div class="buttons" v-show="!isPhone || showingControls">
2016-11-30 09:23:11 +00:00
<button class="btn btn-green btn-add" @click="addUser">
2016-06-25 16:05:24 +00:00
<i class="fa fa-plus"></i>
Add</button>
</div>
</h1>
<div class="main-scroll-wrap">
<div class="users">
2016-11-30 09:23:11 +00:00
<user-item v-for="user in state.users" :user="user" @editUser="editUser"/>
2016-10-31 04:28:12 +00:00
<article class="user-item" v-for="n in 6"/>
2016-06-25 16:05:24 +00:00
</div>
</div>
2016-11-30 09:23:11 +00:00
<edit-user-form ref="editUserForm"/>
<add-user-form ref="addUserForm"/>
2016-06-25 16:05:24 +00:00
</section>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-11-26 03:25:35 +00:00
import isMobile from 'ismobilejs'
2016-06-25 16:05:24 +00:00
2016-11-26 03:25:35 +00:00
import { userStore } from '../../../stores'
import userItem from '../../shared/user-item.vue'
2016-11-30 09:23:11 +00:00
import editUserForm from '../../modals/edit-user-form.vue'
import addUserForm from '../../modals/add-user-form.vue'
2016-06-25 16:05:24 +00:00
export default {
2016-11-30 09:23:11 +00:00
components: { userItem, editUserForm, addUserForm },
2016-06-25 16:05:24 +00:00
2016-11-26 03:25:35 +00:00
data () {
2016-06-25 16:05:24 +00:00
return {
state: userStore.state,
isPhone: isMobile.phone,
2016-11-30 09:23:11 +00:00
showingControls: false
2016-11-26 03:25:35 +00:00
}
2016-06-25 16:05:24 +00:00
},
methods: {
/**
2016-11-30 09:23:11 +00:00
* Open the "Add User" form.
*/
addUser () {
this.$refs.addUserForm.open()
},
/**
* Open the "Edit User" form.
*
* @param {Object} user
2016-06-25 16:05:24 +00:00
*/
2016-11-30 09:23:11 +00:00
editUser (user) {
this.$refs.editUserForm.open(user)
2016-11-26 03:25:35 +00:00
}
}
}
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
#usersWrapper {
.users {
justify-content: space-between;
flex-wrap: wrap;
display: flex;
}
button {
margin-right: 3px;
}
@media only screen and (max-width: 768px) {
.users {
flex-direction: column;
.buttons {
margin-top: 12px;
display: block;
}
}
}
}
.user-item {
width: 32%;
margin-bottom: 16px;
.info {
display: flex;
img {
flex: 0 0 128px;
}
.right {
flex: 1;
padding: 16px;
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: rgba(255, 255, 255, .02);
}
h1 {
font-size: 1.4rem;
margin-bottom: 5px;
.you {
color: $colorHighlight;
margin-left: 5px;
}
}
.buttons {
display: none;
margin-top: 16px;
}
&:hover, html.touchevents & {
.buttons {
display: block;
}
}
}
html.with-extra-panel & {
width: 49%;
}
@media only screen and (max-width: 1024px) {
width: 100%;
}
}
2015-12-13 04:42:28 +00:00
</style>