Skip to content

Commit

Permalink
Update Picture.vue, AllReviews.vue, forum.vue, show image in these
Browse files Browse the repository at this point in the history
  • Loading branch information
B16CS006 committed Apr 21, 2019
1 parent 9ca5cb1 commit 13ca015
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 42 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<title>Pathology</title>

<head>
<link rel="shortcut icon" type="image/png" href="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-512.png" />
<link rel="shortcut icon" type="image/png" href="./logo.png" />
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons" rel="stylesheet">
<!-- <link href="https://cdn.jsdelivr.net/npm/vuetify/dist/vuetify.min.css" rel="stylesheet"> -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</v-list>
</v-navigation-drawer>

<v-toolbar app flat dark color="teal" clipped-left absolute>
<v-toolbar app flat dark color="teal" clipped-left>
<v-toolbar-side-icon @click="drawer = !drawer"></v-toolbar-side-icon>
<v-toolbar-title class="text-uppercase white--text">
<!-- <span>{{ title }}</span> -->
Expand Down
40 changes: 20 additions & 20 deletions src/components/pathology/Picture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@
<info block v-bind:picture="picture"></info>
</v-flex>
<v-flex xs12 md6 v-if="userIsAuthenticated">
<review v-bind:details="pictureDetails" v-bind:pictureId="picture[0]" v-on:syncDetails="getDetails"/>
</v-flex>
</v-layout>
<v-layout v-if="forum" row wrap justify-center>
<v-flex xs12>
<Forum v-bind:pictureId="picture[0]"/>
</v-flex>
</v-layout>
<v-layout v-else row wrap justify-center>
<v-flex xs12>
<AllReviews v-bind:details="pictureDetails"/>
<review
v-bind:details="pictureDetails"
v-bind:pictureId="picture[0]"
v-on:syncDetails="getDetails"
/>
</v-flex>
</v-layout>
<v-tabs color="teal lighten-3" centered>
<v-tabs-slider color="teal"></v-tabs-slider>
<v-tab href="#tab-1">All Reviews</v-tab>
<v-tab href='#tab-2' v-if="userIsAuthenticated">Forum</v-tab>
<v-tab-item value="tab-1"><AllReviews v-bind:details="pictureDetails"/></v-tab-item>
<v-tab-item value="tab-2" v-if="userIsAuthenticated"><Forum v-bind:pictureId="picture[0]"/></v-tab-item>
</v-tabs>
</template>
<p v-else>{{pictureId}} : No such Image found</p>
</template>
Expand All @@ -44,15 +45,14 @@
import PictureReview from "./Picture/Review.vue";
import PictureInfo from "./Picture/Info.vue";
import AllReviews from "./Picture/AllReviews.vue";
import Forum from './Picture/forum.vue'
import Forum from "./Picture/forum.vue";
import { database } from "firebase";
export default {
props: ["pictureId"],
data() {
return {
pictureDetails: "loading",
forum:true
pictureDetails: "loading"
};
},
computed: {
Expand All @@ -64,7 +64,7 @@ export default {
},
loading() {
return this.$store.getters.loading;
},
}
},
methods: {
getDetails() {
Expand All @@ -81,12 +81,12 @@ export default {
});
}
},
beforeMount(){
this.getDetails()
beforeMount() {
this.getDetails();
},
watch:{
picture(){
this.getDetails()
watch: {
picture() {
this.getDetails();
}
},
components: {
Expand Down
42 changes: 33 additions & 9 deletions src/components/pathology/Picture/AllReviews.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,37 @@
<v-layout row wrap>
<v-flex class="teal lighten-3 subheading pa-2">Reviews</v-flex>
</v-layout>
<v-expansion-panel v-model="panel">
<v-expansion-panel-content v-for="(detail, key, i) in details" :key="i">
<template v-slot:header>
<div class="font-weight-medium text-capitalize">{{ userName(key) }}</div>
<v-spacer/>
<div class="font-weight-medium text-lowercase">{{ email(key) }}</div>
<v-list>
<v-list-group
v-model="panel[i]"
no-action
v-for="(detail, key, i) in details"
:key="i"
>
<template v-slot:activator>
<v-list-tile>
<v-list-tile-avatar>
<img :src="avatar(key)">
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title class="text-capitalize">{{ userName(key) }}</v-list-tile-title>
<v-list-tile-sub-title>{{ email(key) }}</v-list-tile-sub-title>
</v-list-tile-content>
</v-list-tile>
</template>
<v-divider/>
<v-container fluid>
<v-layout row wrap justify-center>
<v-flex v-for="(value, title, j) in detail" :key="j" xs12 sm6 md6 lg6 xl2>
<v-flex v-for="(value, title, j) in detail" :key="j" xs12 sm6 md6 lg4 xl4>
<div
class="text-capitalize subheading font-weight-bold pa-1 grey lighten-3"
>{{title}}:</div>
<div class="pa-2 grey lighten-5">{{value}}</div>
</v-flex>
</v-layout>
</v-expansion-panel-content>
</v-expansion-panel>
</v-container>
</v-list-group>
</v-list>
</template>
</v-container>
</template>
Expand Down Expand Up @@ -63,6 +77,16 @@ export default {
: uid
: uid;
},
avatar(uid){
const link = "http://images.goodsmile.info/cgm/images/product/20160805/5858/40556/large/af31d8e81b224d2f38f554e5f2b5cd40.jpg"
return this.users
? this.users[uid]
? this.users[uid].avatar
? this.users[uid].avatar
: link
: link
: link
},
getAllUsers() {
database()
.ref("Users")
Expand Down
34 changes: 23 additions & 11 deletions src/components/pathology/Picture/forum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,21 @@
>
<template v-slot:activator>
<v-list-tile>
<v-list-tile-avatar>
<img :src="avatar(detail.by)">
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title>{{ detail.message }}</v-list-tile-title>
<v-list-tile-sub-title>{{ userName(detail.by) }}</v-list-tile-sub-title>
</v-list-tile-content>
<v-list-tile-action>

<v-btn fab small flat @click="replyDialog = true">
<v-icon>add</v-icon>
<v-icon>reply</v-icon>
<single-input-dialog
:visible="replyDialog"
value
v-model="detail.dialog"
title="Enter here"
@close="replyDialog = false"
@update="reply({message: $event, key: key})"
Expand All @@ -48,6 +52,9 @@
</template>
<v-divider/>
<v-list-tile v-for="(reply, j) in detail.replies" :key="j">
<v-list-tile-avatar>
<img :src="avatar(reply.by)">
</v-list-tile-avatar>
<v-list-tile-content>
<v-list-tile-title>{{ reply.message }}</v-list-tile-title>
<v-list-tile-sub-title>{{ userName(reply.by) }}</v-list-tile-sub-title>
Expand Down Expand Up @@ -94,15 +101,16 @@ export default {
: uid
: uid;
},
// email(uid) {
// return this.users
// ? this.users[uid]
// ? this.users[uid].email
// ? this.users[uid].email
// : uid
// : uid
// : uid;
// },
avatar(uid){
const link = "http://images.goodsmile.info/cgm/images/product/20160805/5858/40556/large/af31d8e81b224d2f38f554e5f2b5cd40.jpg"
return this.users
? this.users[uid]
? this.users[uid].avatar
? this.users[uid].avatar
: link
: link
: link
},
getAllUsers() {
if (!this.currentUser) {
return;
Expand Down Expand Up @@ -160,8 +168,12 @@ export default {
});
}
},
watch:{
pictureId(){
this.getForum()
}
},
created() {
console.log(this.pictureId);
this.getAllUsers();
this.getForum();
}
Expand Down

0 comments on commit 13ca015

Please sign in to comment.