Skip to content

Commit

Permalink
fix(Posts/Events): Card click triggers navitation
Browse files Browse the repository at this point in the history
When clicking on an Event or Post card, it navigates to the Post or Event with its comments
  • Loading branch information
mrmod committed Apr 26, 2020
1 parent 241880e commit 92ec377
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 69 deletions.
13 changes: 7 additions & 6 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@ Things look good so far. Below are the things we talked about and wanted to get

* Posts don't need tags right now [Done]
* Ability to create locations for a business [Done]
* Ability to add new locations to an existing business
* Posts should be sortable by `post.created_at` and latest commented
* Posts should be the default view [Done]
* Who commented and when they commented [Done]
* Maybe make comments more distinct from the rest of the page?
* Capture the center for a Places-derived region [Done]
* Maybe make comments more distinct from the rest of the page? [Done]
* Set the Region of a registering businesses's first employee to that of the Primary Location during SignUp [Done]
* Ability to add new locations to an existing business
* Posts should be sortable by `post.created_at` and latest commented
* Keep the business category information and founding information with the My Business page
* Neighbors should show the other businesses in the same region
** Triggered from a click on MyBusiness.Location showing a list of them broken down by category
* When a region is created, a GoogleBusiness search will find businesses in the region and email them
* Capture the center for a Places-derived region [Done]

* Estimate the center for a Business-derived region polygon
* Allow add/remove/modify of business employees after a business is created

* **BUG** Toggling a location on and off in the locations step of SignUp throws errors
* Ensure employee addresses are unique for employees of a business
* Set the Region of a registering businesses's first employee to that of the Primary Location during SignUp [Done]

# Features

* A side bar of post topics on the left for Posts section (crime & safety, marketplace, civic information, etc) [Done]
* Events calendar
* Neighborhood creation [Done]
* Posts should show up for the Region of the logged in Employee by default [Done]
* A side bar allowing the Neighborhood selection for Posts and Events
* Events calendar

## Feature: Check if Business Location in Region

Expand Down
68 changes: 34 additions & 34 deletions app/javascript/components/Event.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<template>
<md-card md-card-hover>
<md-card-header>
<router-link tag="span" class="no-decoration" :to='showEvent'>
<div class="md-title">{{ event.name }}</div>
</router-link>
<div class="md-subhead">{{ event.theme }}</div>
</md-card-header>
<router-link v-if='event' tag="span" class="no-decoration" :to='showEvent'>
<md-card md-card-hover>
<md-card-header>
<div class="md-title">{{ event.name }}</div>
<div class="md-subhead">{{ event.theme }}</div>
</md-card-header>

<md-card-content>
<div id="event-description" class="md-body-1">
{{ event.description }}
</div>
<md-divider></md-divider>
<div class="event-times">
<div class="md-body-1">The event starts at
<span class="md-body-2">{{ startTime }}</span>
<span class="md-body-1">and ends at
<span class="md-body-2">{{ endTime }}</span>
</span>
<md-card-content>
<div id="event-description" class="md-body-1">
{{ event.description }}
</div>
</div>
<ul id="event-invitations-list">
<li v-for="invitation in event.invitations" :key='invitation.id'>
{{invitation.name}} invited
</li>
</ul>
<EditableMedia :media='media' :model_id='event.id' :model_type='"Event"' />
</md-card-content>

<md-card-actions>
<router-link :to='editEvent' tag="span" v-if='isEditable'>
<md-button class='md-primary'>Edit</md-button>
</router-link>
<md-button class='md-accent' @click='deleteEvent' v-if='isEditable'>Delete</md-button>
</md-card-actions>
</md-card>
<md-divider></md-divider>
<div class="event-times">
<div class="md-body-1">The event starts at
<span class="md-body-2">{{ startTime }}</span>
<span class="md-body-1">and ends at
<span class="md-body-2">{{ endTime }}</span>
</span>
</div>
</div>
<ul id="event-invitations-list">
<li v-for="invitation in event.invitations" :key='invitation.id'>
{{invitation.name}} invited
</li>
</ul>
<EditableMedia :media='media' :model_id='event.id' :model_type='"Event"' />
</md-card-content>

<md-card-actions>
<router-link :to='editEvent' tag="span" v-if='isEditable'>
<md-button class='md-primary'>Edit</md-button>
</router-link>
<md-button class='md-accent' @click='deleteEvent' v-if='isEditable'>Delete</md-button>
</md-card-actions>
</md-card>
</router-link>
</template>
<script>
import {deleteEvent, updateEvent, allMedia} from '../services/events'
Expand Down
57 changes: 30 additions & 27 deletions app/javascript/components/Post.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<template>
<md-card md-with-hover v-if='post'>
<md-card-header>
<router-link tag="span" class="no-decoration" :to='showPost'>
<div class="md-title">
{{ post.topic }}
</div>
</router-link>
</md-card-header>
<router-link v-if='post' tag="span" class="no-decoration" :to='showPost'>
<md-card md-with-hover>
<md-card-header>
<div class="md-title">
{{ post.topic }}
</div>
</md-card-header>

<md-card-content>
{{ post.text }}
</md-card-content>
<EditableMedia :media='mediaList' :model_id='post.id' :model_type='"Post"' />
<slot />

<md-card-actions>
<md-card-content>
{{ post.text }}
</md-card-content>
<EditableMedia :media='mediaList' :model_id='post.id' :model_type='"Post"' />
<slot />
<md-card-actions>

<md-button :to='showPost' v-if='!isEditable'>
Comment <i class="material-icons">chat_bubble_outline</i>{{comments.length}}
</md-button>
<router-link tag="span" :to='editPost' v-if='isEditable && isEditor'>
<md-button class="md-primary">
Edit
<md-button :to='showPost' v-if='!isEditable'>
Comment <i class="material-icons">chat_bubble_outline</i>{{comments.length}}
</md-button>
</router-link>
<md-button class='md-accent' @click='deletePost' v-if='isEditable && isEditor'>
Delete
</md-button>
</md-card-actions>
</md-card>
<router-link tag="span" :to='editPost' v-if='isEditable && isEditor'>
<md-button class="md-primary">
Edit
</md-button>
</router-link>
<md-button class='md-accent' @click='deletePost' v-if='isEditable && isEditor'>
Delete
</md-button>
</md-card-actions>
</md-card>
</router-link>
</template>
<script>
import {getPostComments, deletePost, allMedia} from '../services/posts'
Expand All @@ -50,6 +50,9 @@ export default {
}
},
computed: {
postClicked: function() {
console.log('post clicked')
},
comments: function() {
return this.$store.getters.postComments(this.post.id)
// return this.$store.getters.allComments.filter(c => c.commentable_id === this.post.id && c.commentable_type === 'Post')
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/components/PostList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
},
components: { AddPost, Post, TagList },
computed: {
newPost: function() {
newPost() {
return {
employee_id: this.$currentUser.employee_id,
private: false,
Expand All @@ -31,6 +31,5 @@ export default {
}
}
},
}
</script>

0 comments on commit 92ec377

Please sign in to comment.