Skip to content

Issues-490: Move reply to comment block #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 41 additions & 5 deletions ReplyTo/class.replyto.plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function postController_render_before($sender) {
* @param $sender
* @param $args
*/
public function base_Replies_handler($sender, $args){
public function base_InlineDiscussionOptionsLeft_handler($sender, $args){
$discussion = $sender->data('Discussion');
if (!$discussion) {
return;
Expand All @@ -84,10 +84,44 @@ public function base_Replies_handler($sender, $args){
$discussionUrl = discussionUrl($discussion, '', '/');
$viewMode = self::getViewMode();

echo '<div class="ReplyViewOptions"><span class="MLabel">View:&nbsp</span>';
echo anchor('Threaded', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_THREADED, $viewMode == self::VIEW_THREADED?'Active':'').'&nbsp;&nbsp;|&nbsp;&nbsp;';
echo anchor('Flat', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_FLAT, $viewMode == self::VIEW_FLAT?'Active':'');
echo '</div>';
echo '<span class="ReplyViewOptions">';
echo '<span class="MLabel">View:&nbsp</span>';
echo anchor('Threaded', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_THREADED, $viewMode == self::VIEW_THREADED?'ReplyViewOptionLink Active':'ReplyViewOptionLink').'&nbsp;&nbsp;|&nbsp;&nbsp;';
echo anchor('Flat', $discussionUrl.'?'.self::QUERY_PARAMETER_VIEW.'='.self::VIEW_FLAT, $viewMode == self::VIEW_FLAT?'ReplyViewOptionLink Active':'ReplyViewOptionLink');
echo '</span>';
}

public function base_inlineCommentOptionsRight_handler($sender, $args) {
ReplyToPlugin::log('base_inlineCommentOptionsRight_handler', []);

if (!Gdn::Session()->isValid()) {
return;
}

$discussion = $sender->data('Discussion');
$isClosed = ((int)$discussion->Closed) == 1;
if ($isClosed) {
return;
}

//Check permission
$CategoryID = val('PermissionCategoryID', $discussion) ? val('PermissionCategoryID', $discussion) : val('CategoryID', $discussion);

// Can the user comment on this category, and is the discussion open for comments?
if (!Gdn::Session()->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $CategoryID)) {
return;
}

$viewMode = self::getViewMode();
$comment = &$args['Comment'];
$items = & $args['Items'];
$commentID = val('CommentID', $comment);
if(empty($items)) {
$items = [];
}
array_push( $items, anchor(
t('Reply'),
url("/?ParentCommentID=".$commentID."&view=".$viewMode, false), 'ReplyComment'));
}

/**
Expand Down Expand Up @@ -208,6 +242,7 @@ public function base_commentOptions_handler($sender, $args) {
return;
}

/*
$options = &$args['CommentOptions'];
$comment = &$args['Comment'];
$options['ReplyToComment'] = [
Expand All @@ -229,6 +264,7 @@ public function base_commentOptions_handler($sender, $args) {
$options[$key]['Url'] = $currentUrl.'?view='.$viewMode;
}
}
*/
}

/**
Expand Down
5 changes: 4 additions & 1 deletion ReplyTo/design/replyto.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
display: inline-block;
line-height: 1.5;
}
.MessageList .ItemDiscussion .Item-Body .Controls a.ReplyViewOptionLink, .ReplyViewOptions .ReplyViewOptionLink {
color: #137d60;
}

.ReplyViewOptions a.Active {
.MessageList .ItemDiscussion .Item-Body .Controls a.ReplyViewOptionLink.Active, .ReplyViewOptions .ReplyViewOptionLink.Active {
color: #696969;
font-weight: 800;
}
Expand Down