Merge pull request #586 from im-mi/image-info-tweaks

Image info tweaks
This commit is contained in:
Shish 2016-09-26 15:21:46 -05:00 committed by GitHub
commit af0aa98649
3 changed files with 14 additions and 8 deletions

View File

@ -103,9 +103,7 @@ class Ratings extends Extension {
}
public function onImageInfoBoxBuilding(ImageInfoBoxBuildingEvent $event) {
if($this->can_rate()) {
$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) {

View File

@ -6,17 +6,25 @@ 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" : "";
$human_rating = Ratings::rating_to_human($rating);
$html = "
<tr>
<th>Rating</th>
<td>
<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>
".($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>
";

View File

@ -30,7 +30,7 @@ class RelationshipsTheme extends Themelet {
global $user;
$h_parent_id = $image->parent_id;
$s_parent_id = $h_parent_id ?: "None.";
$s_parent_id = $h_parent_id ?: "None";
$html = "<tr>\n".
" <th>Parent</th>\n".