Skip to content
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

Update your own comments #4

Open
wants to merge 1 commit into
base: 1
Choose a base branch
from
Open
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
14 changes: 6 additions & 8 deletions client/src/sass/reviews.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
color: #D9D500;
}

#CommentForm_CommentsForm_Rating_Holder {
ul {
padding-left: 0;
ul.rating-holder-container {
padding-left: 0;

li {
display: inline-block;
list-style: none;
}
li {
display: inline-block;
list-style: none;
}
}
}
}
5 changes: 3 additions & 2 deletions src/Control/ReviewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function CommentsForm()
$max = $this->getOption('max_rating');
$id = $this->getRequest()->postVar('ParentID');
$class = $this->getRequest()->postVar('ParentClassName');

// If we dont have exact values, look to see if we are using a post
if ((empty($min) || empty($max)) && $id && $class) {
if ($object = $class::get()->byID($id)) {
Expand Down Expand Up @@ -89,6 +89,7 @@ public function CommentsForm()
$ratings
)->setCustomValidationMessage($required_text)
->setAttribute('data-msg-required', $required_text)
->addExtraClass('rating-holder-container')
);

// Website URL is possibly overkill for a review, disable unless we overwrite this
Expand All @@ -104,4 +105,4 @@ public function CommentsForm()

return $form;
}
}
}
7 changes: 6 additions & 1 deletion src/Extensions/CommentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use SilverStripe\ORM\DataExtension;
use ilateral\SilverStripe\Reviews\Helpers\ReviewHelper;
use SilverStripe\Forms\FieldList;
use ilateral\SilverStripe\Reviews\Control\ReviewsController;

class CommentExtension extends DataExtension
{
Expand Down Expand Up @@ -70,4 +71,8 @@ public function updateCMSFields(FieldList $fields)
$owner->dbObject('Rating')->scaffoldFormField($owner->fieldLabel('Rating'))
);
}
}

public function updateController() {
return ReviewsController::create();
}
}
13 changes: 11 additions & 2 deletions templates/Includes/ReviewsInterface_singlecomment.ss
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
<p class="coments-ratings">{$RatingStars} {$ExcessStars}</p>
<p>$EscapedComment</p>
</div>

<% if $UpdateForm %>
<div class="comment-update-form-holder">
$UpdateForm
</div>
<% end_if %>
<% if not $isPreview %>
<% if $ApproveLink || $SpamLink || $HamLink || $DeleteLink || $RepliesEnabled %>
<% if $ApproveLink || $SpamLink || $HamLink || $DeleteLink || $UpdateForm || $RepliesEnabled %>
<div class="comment-action-links">
<div class="comment-moderation-options">
<% if $ApproveLink %>
Expand All @@ -33,6 +37,11 @@
<a href="$DeleteLink.ATT" class="delete"><% _t('CommentsInterface_singlecomment_ss.REMCOM','reject it') %></a>
<% end_if %>
</div>
<div class="comment-author-options">
<% if $UpdateForm %>
<button class="comment-update-link" aria-controls="$UpdateForm.FormName" aria-expanded="false"><%t CommentsInterface_singlecomment_ss.UPDCOM "Update it" %></button>
<% end_if %>
</div>
<% if $RepliesEnabled && $canPostComment %>
<button class="comment-reply-link" type="button" aria-controls="$ReplyForm.FormName" aria-expanded="false">
<% _t('CommentsInterface_singlecomment_ss.REPLYTO','Reply to') %> $AuthorName.XML
Expand Down