Skip to content

Commit e24e495

Browse files
committed
Updating forums to be sleeker
1 parent fe0e450 commit e24e495

File tree

7 files changed

+256
-180
lines changed

7 files changed

+256
-180
lines changed

.gitmodules

Lines changed: 0 additions & 69 deletions
This file was deleted.

public/less/master_mixins.less

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,125 @@ input[type="color"]:focus,
585585
vertical-align: middle !important;
586586
}
587587
/*
588+
/////////////////////////////////////////////////////// Forums /////////////////////////////////////////////////////////
589+
*/
590+
div.labels {
591+
margin-left: 25px;
592+
display: block;
593+
div {
594+
display: block;
595+
&.subject {
596+
width: 70%;
597+
display: block;
598+
float: left;
599+
}
600+
&.replies {
601+
width: 15%;
602+
float: left;
603+
}
604+
&.lastPost {
605+
width: 15%;
606+
float: left;
607+
}
608+
}
609+
}
610+
ul.forum {
611+
list-style: none;
612+
margin: 0;
613+
padding: 0;
614+
border: 0;
615+
outline: 0;
616+
font-weight: inherit;
617+
font-style: inherit;
618+
font-size: 100%;
619+
font-family: inherit;
620+
vertical-align: baseline;
621+
display: block;
622+
li {
623+
position: relative;
624+
height: auto;
625+
padding: 0;
626+
margin: 2px 0px 0px;
627+
border: none;
628+
border-left: 6px solid @grey;
629+
vertical-align: baseline;
630+
.transition-duration(0.3s);
631+
&:hover {
632+
background: rgba(red(@grey), green(@grey), blue(@grey), .4);
633+
}
634+
&.announcement:before {
635+
content: '';
636+
background: saturate(lighten(@errorColor, 15%), 40%) !important;
637+
position: absolute;
638+
top: 0;
639+
left: -6px;
640+
width: 6px;
641+
height: 100%;
642+
box-shadow: 0 0 40px saturate(lighten(@errorColor, 15%), 40%) !important;
643+
}
644+
&.sticky:before {
645+
content: '';
646+
background: saturate(lighten(@warningColor, 15%), 40%) !important;
647+
position: absolute;
648+
top: 0;
649+
left: -6px;
650+
width: 6px;
651+
height: 100%;
652+
box-shadow: 0 0 40px saturate(lighten(@warningColor, 15%), 40%) !important;
653+
}
654+
&.application:before {
655+
content: '';
656+
background: saturate(lighten(@infoColor, 15%), 40%) !important;
657+
position: absolute;
658+
top: 0;
659+
left: -6px;
660+
width: 6px;
661+
height: 100%;
662+
box-shadow: 0 0 40px saturate(lighten(@infoColor, 15%), 40%) !important;
663+
}
664+
&.unread:before, &:hover:before {
665+
content: '';
666+
background: saturate(lighten(@primaryColor, 15%), 40%);
667+
position: absolute;
668+
top: 0;
669+
left: -6px;
670+
width: 6px;
671+
height: 100%;
672+
box-shadow: 0 0 40px saturate(lighten(@primaryColor, 15%), 40%);
673+
}
674+
div {
675+
display: block;
676+
&.post {
677+
padding: 13px 0 13px 20px;
678+
width: 100%;
679+
height: auto!important;
680+
border-top: 1px solid lighten(@grey, 10%);
681+
}
682+
&.subject {
683+
width: 70%;
684+
display: block;
685+
float: left;
686+
}
687+
&.replies {
688+
width: 15%;
689+
float: left;
690+
}
691+
&.lastPost {
692+
width: 15%;
693+
float: left;
694+
}
695+
}
696+
}
697+
}
698+
.trans-03s {
699+
transition-duration: 0.3s;
700+
-moz-transition-duration: 0.3s;
701+
-webkit-transition-duration: 0.3s;
702+
-o-transition-duration: 0.3s;
703+
-webkit-perspective: 1000;
704+
-webkit-backface-visibility: hidden;
705+
}
706+
/*
588707
/////////////////////////////////////////////////////// Tables /////////////////////////////////////////////////////////
589708
*/
590709
table {
@@ -595,7 +714,7 @@ table {
595714
}
596715
}
597716
.table-striped tbody > tr:nth-child(odd) > td {
598-
.altBackgroundColor(@siteStyle) !important;
717+
.altBackgroundColor(@siteStyle);
599718
}
600719
.table-hover tbody tr:hover td,
601720
.table-hover tbody tr:hover th {
@@ -1213,7 +1332,6 @@ td {
12131332
padding: 1px 3px 2px;
12141333
font-size: 9.75px;
12151334
color: #ffffff;
1216-
background-color: @darkPrimary;
12171335
.text-shadow(~"-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000");
12181336
}
12191337
.label-important {

src/controllers/Core_AdminController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function getIndex()
4444
->addTab('Message', 'message')
4545
->addTab('Forum Category', 'forum-category')
4646
->addTab('Forum Board', 'forum-board')
47+
->addTab('Forum Post', 'forum-post')
4748
->addTab('Forum Reply', 'forum-reply')
4849
->buildPanel()
4950
->setCollapsable(true)

src/controllers/Forum/Core_BoardController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public function getView($boardId)
1010
$openIssues = Forum_Post_Status::where('forum_support_status_id', '=', Forum_Support_Status::TYPE_OPEN)->count();
1111
$inProgressIssues = Forum_Post_Status::where('forum_support_status_id', '=', Forum_Support_Status::TYPE_IN_PROGRESS)->count();
1212
$resolvedIssues = Forum_Post_Status::where('forum_support_status_id', '=', Forum_Support_Status::TYPE_RESOLVED)->count();
13-
$announcements = Forum_Post::with('author')->where('forum_board_id', '=', $board->id)->where('forum_post_type_id', '=', 5)->orderBy('modified_at', 'desc')->get();
14-
$posts = Forum_Post::with('author')->where('forum_board_id', '=', $board->id)->whereNotIn('forum_post_type_id', array(5))->orderBy('modified_at', 'desc')->paginate(30);
13+
$announcements = Forum_Post::with('author')->where('forum_board_id', $board->id)->where('forum_post_type_id', Forum_Post::TYPE_ANNOUNCEMENT)->orderBy('modified_at', 'desc')->get();
14+
$posts = Forum_Post::with('author')->where('forum_board_id', $board->id)->where('forum_post_type_id', '!=', Forum_Post::TYPE_ANNOUNCEMENT)->orderBy('modified_at', 'desc')->paginate(30);
1515

1616
// Add quick links
1717
if ($this->hasPermission('FORUM_POST')) {
@@ -27,8 +27,8 @@ public function getView($boardId)
2727
$this->setViewData('resolvedIssues', $resolvedIssues);
2828
}
2929

30-
public function getAdd($categorySlug = null)
31-
{
30+
public function getAdd($categorySlug = null)
31+
{
3232
// Make sure they can access this whole area
3333
$this->checkPermission('FORUM_ADMIN');
3434

@@ -79,5 +79,5 @@ public function postAdd()
7979

8080
return $this->redirect(null, $board->name.' has been submitted.');
8181
}
82-
}
82+
}
8383
}

src/presenters/Forum/PostPresenter.php

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,79 @@
22

33
class Forum_PostPresenter extends CorePresenter {
44

5+
public function classes()
6+
{
7+
$classes = array();
8+
9+
if ($this->resource->forum_post_type_id == \Forum_Post::TYPE_ANNOUNCEMENT) {
10+
$classes[] = 'announcement';
11+
} elseif ($this->resource->forum_post_type_id == \Forum_Post::TYPE_STICKY) {
12+
$classes[] = 'sticky';
13+
} elseif ($this->resource->forum_post_type_id == \Forum_Post::TYPE_APPLICATION) {
14+
$classes[] = 'application';
15+
}
16+
if ($this->resource->checkUserViewed(\CoreView::getActiveUser()->id)) {
17+
$classes[] = 'unread';
18+
}
19+
20+
return implode(' ', $classes);
21+
}
22+
23+
public function link()
24+
{
25+
if ($this->resource->checkUserViewed(\CoreView::getActiveUser()->id)) {
26+
return '<strong>'. \HTML::link('/forum/post/view/'. $this->resource->id, $this->resource->name) .'</strong>';
27+
}
28+
29+
return \HTML::link('/forum/post/view/'. $this->resource->id, $this->resource->name, array('class' => 'text-disabled'));
30+
}
31+
32+
public function startedBy()
33+
{
34+
$label = null;
35+
if ($this->resource->forum_post_type_id == \Forum_Post::TYPE_ANNOUNCEMENT) {
36+
$label = '<span class="label label-default">Announcement</span>';
37+
} elseif ($this->resource->forum_post_type_id == \Forum_Post::TYPE_STICKY) {
38+
$label = '<span class="label label-default">Sticky</span>';
39+
} elseif ($this->resource->forum_post_type_id == \Forum_Post::TYPE_APPLICATION) {
40+
$label = '<span class="label label-default">Application</span>';
41+
}
42+
43+
$block = '<small>';
44+
45+
if ($label != null) {
46+
$block .= $label .' ';
47+
}
48+
49+
$block .= 'Started by '. \HTML::link('/user/view/'. $this->resource->author->id, $this->resource->author->username);
50+
$block .= '</small>';
51+
52+
return $block;
53+
}
54+
55+
public function repliesBlock()
56+
{
57+
return '<small>
58+
'. $this->resource->repliesCount .' '. \Str::plural('Reply', $this->resource->repliesCount) .'
59+
<br />
60+
'. $this->resource->views .' '. \Str::plural('View', $this->resource->views) .'
61+
</small>';
62+
}
63+
64+
public function lastPostBlock()
65+
{
66+
$lastUpdateType = $this->resource->lastUpdate->type->keyName;
67+
$lastUpdateUser = ($this->resource->lastUpdate->morph_id == null || $lastUpdateType == 'application'
68+
? $this->resource->lastUpdate->author : $this->resource->lastUpdate->morph);
69+
$lastUpdateName = ($lastUpdateUser instanceof \UserPresenter ? $lastUpdateUser->username : $lastUpdateUser->name);
70+
71+
return '<small>
72+
'. $this->resource->lastUpdate->created_at .'
73+
<br />
74+
by '. \HTML::link('/user/view/'. $lastUpdateUser->id, $lastUpdateName) .'
75+
</small>';
76+
}
77+
578
/**
679
* Make the last active date easier to read
780
*

0 commit comments

Comments
 (0)