Only show image rater if user can rate
This commit is contained in:
parent
4dcee0eede
commit
3e52e332de
@ -103,7 +103,7 @@ class Ratings extends Extension {
|
||||
}
|
||||
|
||||
public function onImageInfoBoxBuilding(ImageInfoBoxBuildingEvent $event) {
|
||||
$event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating), 80);
|
||||
$event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating, $this->can_rate()), 80);
|
||||
}
|
||||
|
||||
public function onImageInfoSet(ImageInfoSetEvent $event) {
|
||||
|
@ -6,7 +6,7 @@ class RatingsTheme extends Themelet {
|
||||
* @param string $rating
|
||||
* @return string
|
||||
*/
|
||||
public function get_rater_html(/*int*/ $image_id, /*string*/ $rating) {
|
||||
public function get_rater_html(/*int*/ $image_id, /*string*/ $rating, /*bool*/ $can_rate) {
|
||||
$s_checked = $rating == 's' ? " checked" : "";
|
||||
$q_checked = $rating == 'q' ? " checked" : "";
|
||||
$e_checked = $rating == 'e' ? " checked" : "";
|
||||
@ -15,12 +15,16 @@ class RatingsTheme extends Themelet {
|
||||
<tr>
|
||||
<th>Rating</th>
|
||||
<td>
|
||||
".($can_rate ? "
|
||||
<span class='view'>$human_rating</span>
|
||||
<span class='edit'>
|
||||
<input type='radio' name='rating' value='s' id='s'$s_checked><label for='s'>Safe</label>
|
||||
<input type='radio' name='rating' value='q' id='q'$q_checked><label for='q'>Questionable</label>
|
||||
<input type='radio' name='rating' value='e' id='e'$e_checked><label for='e'>Explicit</label>
|
||||
</span>
|
||||
" : "
|
||||
$human_rating
|
||||
")."
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
Loading…
x
Reference in New Issue
Block a user