brainlet/app/app.html

139 lines
6.5 KiB
HTML
Raw Normal View History

2020-10-05 20:36:03 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>App</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic|Material+Icons">
<link rel="stylesheet" href="https://unpkg.com/vue-material/dist/vue-material.min.css">
<link rel="stylesheet" href="https://unpkg.com/vue-material/dist/theme/default-dark.css">
<script defer src="https://unpkg.com/vue-material"></script>
<script defer src="/socket.io/socket.io.js"></script>
2020-10-05 20:36:03 +03:00
<script defer src="./resources/js/app.js"></script>
<style>
.md-card {
width: 312px;
margin: 4px;
display: inline-block;
vertical-align: top;
}
.cursor {
cursor: pointer;
}
</style>
</head>
<body>
<div id="app">
<div v-if="showApp">
<md-dialog id="create-category-dialog" :md-active.sync="dialog.show.createCategory">
<md-dialog-title>Create category</md-dialog-title>
<md-dialog-content>
<md-field>
<label>Title</label>
<md-input v-model="dialog.text.createCategory.title"></md-input>
</md-field>
<md-dialog-actions>
<md-button @click="dialog.show.createCategory = false">Close</md-button>
<md-button class="md-primary" @click="createCategory()">Create</md-button>
</md-dialog-actions>
</md-dialog-content>
</md-dialog>
<md-dialog id="create-post-dialog" :md-active.sync="dialog.show.createPost">
<md-dialog-title>Create post for <strong>{{ selection.category.title }}</strong></md-dialog-title>
<md-dialog-content>
<md-field>
<label>Title</label>
<md-input v-model="dialog.text.createPost.title"></md-input>
</md-field>
<md-field>
<label>Content</label>
<md-textarea v-model="dialog.text.createPost.body" md-counter="1000"></md-textarea>
</md-field>
<md-dialog-actions>
<md-button @click="dialog.show.createPost = false">Close</md-button>
<md-button class="md-primary" @click="createPost()">Create</md-button>
</md-dialog-actions>
</md-dialog-content>
</md-dialog>
<md-dialog id="user-info-dialog" :md-active.sync="viewingProfile.show">
<md-dialog-title><strong>{{ viewingProfile.username }}</strong></md-dialog-title>
<md-dialog-content>
<p>Role: {{ viewingProfile.role }}</p>
<md-dialog-actions>
<md-button @click="viewingProfile.show = false">Close</md-button>
</md-dialog-actions>
</md-dialog-content>
</md-dialog>
<md-toolbar class="md-accent" md-elevation="5">
<h3 class="md-title" style="flex: 1">Brainlet</h3>
<md-menu md-size="small">
<md-button md-menu-trigger>{{ loggedInUser.username }}</md-button>
<md-menu-content>
<md-menu-item @click="navigateToAccountManager()">Manage account</md-menu-item>
</md-menu-content>
</md-menu>
</md-toolbar>
<md-toolbar v-show="selection.category.browsing" class="md-dense" md-elevation="5">
<h3 v-if="selection.category.isCategory" class="md-title" style="flex: 1">Browsing category: {{ selection.category.title }}</h3>
<h3 v-if="!selection.category.isCategory" class="md-title" style="flex: 1">Browsing {{ selection.category.title }}</h3>
<md-button @click="browseCategories()" v-if="selection.category.isCategory">Back</md-button>
<md-button @click="refresh()">Refresh</md-button>
</md-toolbar>
<div id="posts-container" v-if="selection.category.browsing">
<md-card v-for="post in selection.posts">
<md-card-header>
<div class="md-title" v-html="post.title"></div>
<span>by <a class="md-dense cursor" v-on:click="viewProfile(post.creator._id)">{{ post.creator.username }}</a></span>
</md-card-header>
<md-card-content v-html="post.body"></md-card-content>
<md-card-actions>
<md-button v-for="button in cardButtons" @click="button.click(post)">{{ button.text }}</md-button>
</md-card-actions>
</md-card>
</div>
<md-speed-dial class="md-fixed md-bottom-right" md-direction="top" md-elevation="5" style="z-index: 4000;">
<md-speed-dial-target>
<md-icon class="md-morph-initial">add</md-icon>
<md-icon class="md-morph-final">edit</md-icon>
</md-speed-dial-target>
<md-speed-dial-content>
<md-button v-show="selection.category.isCategory" class="md-icon-button" @click="showCreatePostDialog()">
<md-icon>add</md-icon>
<md-tooltip md-direction="left">Create a new post</md-tooltip>
</md-button>
<md-button class="md-icon-button" @click="dialog.show.createCategory = true">
<md-icon>category</md-icon>
<md-tooltip md-direction="left">Create a new category</md-tooltip>
</md-button>
</md-speed-dial-content>
</md-speed-dial>
</div>
<md-snackbar md-position="center" :md-duration="snackbarNotificationDuration" :md-active.sync="showSnackbarNotification" md-persistent>
<span>{{ snackbarNotification }}</span>
<md-button class="md-primary" @click="snackbarButtonClick()">{{ snackbarButtonText }}</md-button>
</md-snackbar>
</div>
</body>
</html>