Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f9fa048
Merge branch 'API-Group-Model-update' into join-a-group
secondaryfun Jul 6, 2020
5cd166d
CommunityPageGroup added axios fetch group data.
secondaryfun Jul 6, 2020
78a5bcf
added posts to group serializer
secondaryfun Jul 6, 2020
98d5f41
Adding map on groupList.
secondaryfun Jul 6, 2020
34e7d70
Posts now generating from database. Comments not loading yet.
secondaryfun Jul 6, 2020
5a7ada9
Posts now generating from database. Comments not loading yet.
secondaryfun Jul 6, 2020
b0ebf97
fixed fixture so comments and replies are linked to the correct group.
secondaryfun Jul 7, 2020
88f9b38
Added comment props generated from postList.map
secondaryfun Jul 7, 2020
2d06863
ForumPost now populated by CommunityPageGroup api data.
secondaryfun Jul 7, 2020
0a9423f
comments only render if props.length > 0
secondaryfun Jul 7, 2020
e6c084a
comments now populating
secondaryfun Jul 7, 2020
61f7336
Edited GroupSerializer to pull forum posts.
secondaryfun Jul 7, 2020
95bf048
connected description and members to api data.
secondaryfun Jul 7, 2020
21f7963
cleaned up console.logs, placeholder data, and extra conditionals.
secondaryfun Jul 7, 2020
e459679
Merge branch 'develop' into join-a-group
secondaryfun Jul 7, 2020
7f55ff2
migration for error on profile model.
secondaryfun Jul 7, 2020
5524ae2
Added dropdown selector for groups.
secondaryfun Jul 7, 2020
16f0225
added filter functionality
MilesHamilton Jul 8, 2020
7e5642b
removed conditional test in comment.js --unnecessary
secondaryfun Jul 9, 2020
641d7bd
removed commented out code.
secondaryfun Jul 9, 2020
f2c1135
Moved getGroup functions to services section.
secondaryfun Jul 9, 2020
dc479bd
removed extra code from Community Page Group.
secondaryfun Jul 9, 2020
1b6af20
rm comments
secondaryfun Jul 9, 2020
b424b2b
removing console.logs
secondaryfun Jul 9, 2020
1f0690c
Merge branch 'community-group-page-detail' of github.com:CotripperPla…
MilesHamilton Jul 9, 2020
520ea73
added autocomplete component
MilesHamilton Jul 10, 2020
1b20eea
changed width
MilesHamilton Jul 10, 2020
a74e618
refactor on ForumPost.
secondaryfun Jul 10, 2020
db667d5
Code cleanup.
secondaryfun Jul 10, 2020
5e7f41f
width change
secondaryfun Jul 13, 2020
0d16134
Revert "added gitignore to include env file"
secondaryfun Jul 13, 2020
34af8c3
Revert "Revert "added gitignore to include env file""
secondaryfun Jul 13, 2020
2e0917b
removed changes from communitypagepeople - not part of this issue
secondaryfun Jul 13, 2020
4d9162c
commented out required, pending implementation in future issue
secondaryfun Jul 13, 2020
c84d4c2
Prep app.js and sample link to point to view-group/:id
secondaryfun Jul 13, 2020
35cc109
Prep app.js and sample link to point to view-group/:id
secondaryfun Jul 13, 2020
a356e03
Merge branch 'develop' into community-group-page-detail
secondaryfun Jul 13, 2020
7c5576d
Group loads based on URL. Search select changes URL.
secondaryfun Jul 13, 2020
8bf424e
removed second api call, loading groupData from groupList.
secondaryfun Jul 14, 2020
7256368
removed changes from FilterSettingsForm: not part of this issue.
secondaryfun Jul 14, 2020
d5bdbe4
Merge branch 'develop' into community-group-page-detail
secondaryfun Jul 14, 2020
ce094b4
file cleanup for PR - 1
secondaryfun Jul 14, 2020
fa48ede
file cleanup for PR - 2
secondaryfun Jul 14, 2020
4e7c6d4
file cleanup for PR - forum serializer
secondaryfun Jul 14, 2020
262709c
Merge branch 'develop' into community-group-page-detail
secondaryfun Jul 14, 2020
2b3e970
Edit to placeholder test date. was using wrong keys.
secondaryfun Jul 14, 2020
b8748bb
Merge branch 'develop' into community-group-page-detail
secondaryfun Jul 15, 2020
e8303e7
connecting directory page
secondaryfun Jul 15, 2020
3075b42
DirectoryGroup Page & Community Group Page now connected to backend. …
secondaryfun Jul 15, 2020
66e6b1b
Link route edited.
secondaryfun Jul 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion api/community/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@


class GroupSerializer(serializers.ModelSerializer):
posts = PostSerializer(many=True)

class Meta:
model = Group
fields = '__all__'
depth = 1
fields = ['id', 'title', 'description', 'location', 'posts', 'members']



class EventSerializer(serializers.ModelSerializer):
Expand All @@ -27,6 +31,7 @@ class Meta:
fields = ['id', 'title', 'description', 'posts']



class HashtagSerializer(serializers.ModelSerializer):
posts = PostSerializer(many=True)

Expand All @@ -36,6 +41,7 @@ class Meta:
fields = ['id', 'title', 'description', 'posts']



class MediaSerializer(serializers.ModelSerializer):
hashtag = serializers.CharField()
group = serializers.CharField()
Expand Down
2 changes: 1 addition & 1 deletion api/forum/fixtures/forum.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"likes": 0,
"author": 3,
"parent": [],
"group": 1
"group": 3
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions api/forum/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Post(models.Model):
parent = models.ManyToManyField(
'self', related_name='comments', null=True, blank=True)
'self', related_name='comments', symmetrical=False, null=True, blank=True)
post_type = models.CharField(max_length=200, null=True, blank=True)
title = models.CharField(max_length=200)
time = models.DateTimeField(auto_now=True)
Expand All @@ -14,7 +14,7 @@ class Post(models.Model):
author = models.ForeignKey(Profile,
on_delete=models.CASCADE, related_name='posts', null=True)
group = models.ForeignKey(
Group, on_delete=models.CASCADE, related_name='posts', null=True)
Group, on_delete=models.CASCADE, related_name='posts', null=True, blank=True)

hashtags = models.ManyToManyField(
'community.hashtag', related_name='posts', null=True, blank=True)
Expand Down
7 changes: 5 additions & 2 deletions api/forum/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@


class PostSerializer(serializers.ModelSerializer):
# author = ProfileSerializer()
author = ProfileSerializer()

class Meta:
model = Post
fields = '__all__'
depth = 2
fields = ['id', 'parent', 'comments', 'post_type', 'title',
'time', 'body', 'likes', 'author', 'group', 'hashtags', 'topics']
6 changes: 2 additions & 4 deletions api/forum/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
from .serializers import PostSerializer



class PostList(generics.ListCreateAPIView):
queryset = Post.objects.all()
queryset = Post.objects.all().order_by('time')
serializer_class = PostSerializer
permission_classes = (permissions.IsAuthenticated,)


class PostDetail(generics.RetrieveUpdateDestroyAPIView):
serializer_class = PostSerializer

def get_queryset(self):
user = self.request.user
return Post.objects.filter(author=user.id)


5 changes: 3 additions & 2 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ class App extends Component {
)}
></Route>
<Route
path="/community/view-group"
path="/community/view-group/:id"
exact
render={routerProps => (
<CommunityPageGroup handle_logout={this.handleLogout} {...routerProps} />
<CommunityPageGroup handle_logout={this.handleLogout} {...this.state} {...routerProps} />
)}
></Route>
<Route
Expand Down Expand Up @@ -203,6 +203,7 @@ class App extends Component {
<DirectoryGroup handle_logout={this.handleLogout} {...routerProps} />
)}
></Route>

</Layout>

<Route path="/welcome" exact component={SplashPage}></Route>
Expand Down
12 changes: 4 additions & 8 deletions client/src/components/Comment/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@ import Profile2 from "../../assets/images/card_profile3.png";

// Function based React Component
const Comment = props => {
// Default Class to apply to Component
// No props right now but when there is data we can use
// this.props.comment and this.props.date
const { body, date, time, to, image, name, likes, replies, type } = props;
const { body, date, time, to, image, name, likes } = props;

return (
<div className="Comment">
<div className="Comment__column Comment__profile">
<ProfilePicture type="small" to={to} image={Profile2} />
<ProfilePicture type="small" to={to} image={image} />
<h4 className="Comment__name">{name}</h4>
</div>
<div className="Comment__column Comment__content">
<div className="Comment__column--left">
<p className="Comment__body">{body}</p>
<div className="Comment__activities">
<div className="Comment__likes">{likes} Likes</div>
<div className="Comment__replies">{replies} Replies</div>
</div>
</div>
<div className="Comment__column Comment__timing--container">
Expand All @@ -31,7 +27,7 @@ const Comment = props => {
</div>
</div>
</div>
);
};
)
}

export default Comment;
7 changes: 3 additions & 4 deletions client/src/components/Connections/Connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ function Connections(props) {
}

let userArray = props.users.map((person, index) => {
let userLastInitial = person.userSurname.slice(0, 1) + ".";
if (index < 4) {
return (
<div key={person.userId} className="Connections__person">
<ProfilePicture type="small" image={person.userPic} />
<div key={person.user} className="Connections__person">
<ProfilePicture type="small" image={person.image} />
<p className="Connections--name">
{person.userFirstName} {userLastInitial}
{`${person.first_name} ${person.last_name[0].toUpperCase()}`}
</p>
</div>
);
Expand Down
33 changes: 16 additions & 17 deletions client/src/components/ForumPost/ForumPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ export default function ForumPost(props) {
hashtags={props.post.hashtags}
/>
) : (
<PostBody />
)}
<PostBody />
)}
</div>
<div className="ForumPost__middle">
<div className="ForumPost__topic-pills">
{props.topics
? props.topics.map(topic => (
<Pill
key={topic}
text={topic}
active={false}
size={"small"}
color={"red"}
inactiveColor={"pink"}
onClick={props.pillClick}
selectId={0}
/>
))
<Pill
key={topic}
text={topic}
active={false}
size={"small"}
color={"red"}
inactiveColor={"pink"}
onClick={props.pillClick}
selectId={0}
/>
))
: null}
</div>
<div className="ForumPost__likes-comments">
Expand All @@ -53,8 +53,7 @@ export default function ForumPost(props) {
{" Likes"}
</p>
<p>
{props.comments}
{" Comments"}
{`${props.comments.length} ${props.comments.length === 1 ? " Comment" : " Comments"}`}
</p>
</div>
</div>
Expand All @@ -75,11 +74,11 @@ ForumPost.defaultProps = {
};
ForumPost.propTypes = {
commentClick: PropTypes.func.isRequired,
likeClick: PropTypes.func.isRequired,
// likeClick: PropTypes.func.isRequired,
pillClick: PropTypes.func.isRequired,
to: PropTypes.string,
likes: PropTypes.number,
comments: PropTypes.number,
comments: PropTypes.array,
name: PropTypes.string,
image: PropTypes.string,
topics: PropTypes.array,
Expand Down
26 changes: 11 additions & 15 deletions client/src/components/ForumPostContainer/ForumPostContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import Comment from '../Comment/Comment'


export default function ForumPostContainer(props) {
const comments = props.forumPost.comments
return (
<div className="PostContainer">
<div>
{props.forumPost ? (
<ForumPost
key={props.postId}
pillClick={props.forumPost.pillClick}
commentClick={props.forumPost.commentClick}
likeClick={props.forumPost.likeClick}
Expand All @@ -20,30 +22,24 @@ export default function ForumPostContainer(props) {
topics={props.forumPost.topics}
image={props.forumPost.image}
post={props.forumPost.post}
topic={props.forumPost.topic}
hashtags={props.forumPost.hashtags}
/>
) : (
<ForumPost />
)}
<ForumPost />
)}
</div>
<div>
{props.comments ? (
props.comments.map((comment, i) => {
{!comments ? "" : (
comments.map((comment, i) => {
return (
<Comment
name={comment.name}
likes={comment.likes}
replies={comment.replies}
image= {comment.image}
date={comment.date}
time={comment.time}
body={comment.body}
key={i}
key={comment.id}
{...comment}
/>
);
})

) : (
<Comment />

)}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/GroupCard/GroupCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { Link } from "react-router-dom";
import Card from "../Card/Card";

const GroupCard = props => {
let { picture, name, members, location } = props;
let { picture, name, members, location, id } = props;
return (
<Card size="medium-short" picture={picture}>
<Link className="GroupCard" to="#">
<Link className="GroupCard" to={`../community/view-group/${id}`}>
<div className="GroupCard__text-container">
<h2 className="GroupCard__group-name">{name}</h2>
<footer className="GroupCard__details">
<p className="GroupCard__members">{members} members</p>
<p className="GroupCard__location">{location}</p>
<p className="GroupCard__location">{location.name}</p>
</footer>
</div>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/InputSelect/InputSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ InputSelect.defaultProps = {
{ value: "option1", title: "Option 1" },
{ value: "option2", title: "Option 2" }
],
onSelect:function(){}
onSelect: function () { }
};
InputSelect.propTypes = {
optionPrefix: PropTypes.string,
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/InputTextField/InputTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import "./InputTextField.css";
const InputTextField = props => {
let { variation = "default", type, name, placeholder, onChange } = props;

if(props.loadcallback && props.loadcallbackarg) props.loadcallback(props.loadcallbackarg);
console.log(props);
if (props.loadcallback && props.loadcallbackarg) {
props.loadcallback(props.loadcallbackarg)
}
return (
<input
className={`InputTextField__container--${variation}`}
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";
import "./Modal.css";

const Modal = props => {
console.log(props);
return (
<div
className="Modal"
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Modal/_ModalContainer-join.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class ModalContainerJoin extends Component {
};

render() {
console.log(this.props);
return (
<div className="Modal__container">
<Button
Expand Down
1 change: 0 additions & 1 deletion client/src/components/NavLink/NavLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class NavLink extends React.Component {
}
}
render() {
console.log(this.props);
if (this.props.text === "Community") {
return (
<div
Expand Down
Loading