diff --git a/src/apps/forums/views.py b/src/apps/forums/views.py index 9bc13dc78..6525255f3 100644 --- a/src/apps/forums/views.py +++ b/src/apps/forums/views.py @@ -85,7 +85,6 @@ def delete(self, request, *args, **kwargs): self.object = self.get_object() if self.object.thread.forum.competition.created_by == request.user or \ - request.user in self.object.thread.forum.competition.admins.all() or \ self.object.posted_by == request.user: # If there are more posts in the thread, leave it around, otherwise delete it @@ -129,7 +128,6 @@ def delete(self, request, *args, **kwargs): self.object = self.get_object() if self.object.forum.competition.created_by == request.user or \ - request.user in self.object.forum.competition.admins.all() or \ self.object.started_by == request.user: success_url = self.object.forum.get_absolute_url() @@ -161,7 +159,7 @@ def pin_thread(request, thread_pk): except Thread.DoesNotExist: raise Http404() - if thread.forum.competition.created_by == request.user or request.user in thread.forum.competition.admins.all(): + if thread.forum.competition.created_by == request.user or thread.started_by == request.user: # Toggle pinned date on/off thread.pinned_date = now() if thread.pinned_date is None else None thread.save() diff --git a/src/apps/profiles/models.py b/src/apps/profiles/models.py index a6b92e944..7c18e21bf 100644 --- a/src/apps/profiles/models.py +++ b/src/apps/profiles/models.py @@ -89,7 +89,7 @@ def get_full_name(self): return self.name def __str__(self): - return f'{self.username} | {self.email}' + return self.username @property def slug_url(self): diff --git a/src/static/css/forums.css b/src/static/css/forums.css index 6e7651998..40eccedb5 100644 --- a/src/static/css/forums.css +++ b/src/static/css/forums.css @@ -15,16 +15,6 @@ .forum-panel .thread_title { border-bottom: 1px solid #CCC; } - -.pin-button, .remove-button { - opacity: 0.5; - color: darkred; -} -.pin-button, .remove-button:hover { - opacity: 1; - cursor: pointer; -} - .pinned-thread-icon { opacity: 0.5; color: darkred; diff --git a/src/static/stylus/forum.styl b/src/static/stylus/forum.styl new file mode 100644 index 000000000..8cc4d6598 --- /dev/null +++ b/src/static/stylus/forum.styl @@ -0,0 +1,47 @@ +.forum-post + background-color #fff + padding 10px + width 80% + border-radius: 5px + box-shadow 0.5px 0.5px 2px gray + +.post-header + display flex + justify-content flex-start + +.post-user + margin-right 10px + +.post-user-img + width 50px + height 50px + border-radius 50% + border 1px solid #000 + +.post-user-name-date + display flex + flex-direction column + justify-content center + +.poster-name + font-size 18px + +.posted-date + font-size 14px + color #aba8a8 + line-height 1 + margin-top 5px + +.post-actions + margin-left auto + cursor pointer + +.post-content + margin-left 60px + margin-right 60px + padding 10px + background-color #F5F5F5 + border-radius: 2px + +.forum-pin-icon + color #017BFE \ No newline at end of file diff --git a/src/static/stylus/index.styl b/src/static/stylus/index.styl index 78b3d1afd..f68e56b2b 100644 --- a/src/static/stylus/index.styl +++ b/src/static/stylus/index.styl @@ -6,4 +6,5 @@ @import "src/static/stylus/search.styl" @import "src/static/stylus/simple_page.styl" @import "src/static/stylus/toastr.styl" +@import "src/static/stylus/forum.styl" diff --git a/src/templates/base.html b/src/templates/base.html index 1f80a1a52..c65de9078 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -17,6 +17,8 @@ + + diff --git a/src/templates/forums/base_forum.html b/src/templates/forums/base_forum.html index 885df8292..bbedca296 100644 --- a/src/templates/forums/base_forum.html +++ b/src/templates/forums/base_forum.html @@ -33,8 +33,8 @@
| Posts | - {% if forum.competition.creator == request.user %} -- - | - {% endif %} ++ Actions + | {% for thread in thread_list_sorted %} -|||
|---|---|---|---|---|---|
| {% if thread.pinned_date %} - + {% endif %} - {{ thread.title }} + + {{ thread.title }} | {{ thread.started_by }} | {{ thread.date_created|date:"M d, Y" }} | {{ thread.last_post_date|timesince }} | {# date:"g:iA M d" #}{{ thread.posts.count }} | - {% if forum.competition.creator == request.user or request.user in forum.competition.admins.all %} + {% if thread.started_by == request.user %}- - + + {% if not thread.pinned_date %} + + {% endif %} | {% endif %}