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) { public function onImageInfoBoxBuilding(ImageInfoBoxBuildingEvent $event) {
if($this->can_rate()) { $event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating, $this->can_rate()), 80);
$event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating), 80);
}
} }
public function onImageInfoSet(ImageInfoSetEvent $event) { public function onImageInfoSet(ImageInfoSetEvent $event) {

View File

@ -6,17 +6,25 @@ class RatingsTheme extends Themelet {
* @param string $rating * @param string $rating
* @return string * @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" : ""; $s_checked = $rating == 's' ? " checked" : "";
$q_checked = $rating == 'q' ? " checked" : ""; $q_checked = $rating == 'q' ? " checked" : "";
$e_checked = $rating == 'e' ? " checked" : ""; $e_checked = $rating == 'e' ? " checked" : "";
$human_rating = Ratings::rating_to_human($rating);
$html = " $html = "
<tr> <tr>
<th>Rating</th> <th>Rating</th>
<td> <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='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='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> <input type='radio' name='rating' value='e' id='e'$e_checked><label for='e'>Explicit</label>
</span>
" : "
$human_rating
")."
</td> </td>
</tr> </tr>
"; ";

View File

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