Permalink
Browse files

Actually disable the "make album cover" option when the item is alrea…

…dy the album cover. Fixes #1979.
  • Loading branch information...
1 parent cff1e76 commit 075b95f0ed6f843c64756c772011a1ecb406168f @bharat bharat committed Jan 31, 2013
Showing with 8 additions and 7 deletions.
  1. +8 −7 modules/gallery/helpers/gallery_event.php
@@ -346,9 +346,9 @@ static function site_menu($menu, $theme, $item_css_selector) {
if (($item->type == "album" && empty($item->album_cover_item_id)) ||
($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) ||
$parent->album_cover_item_id == $item->id) {
- $disabledState = " ui-state-disabled";
+ $disabledState = "ui-state-disabled";
} else {
- $disabledState = " ";
+ $disabledState = "";
}
if ($item->parent()->id != 1) {
@@ -357,7 +357,7 @@ static function site_menu($menu, $theme, $item_css_selector) {
Menu::factory("ajax_link")
->id("make_album_cover")
->label(t("Choose as the album cover"))
- ->css_class("ui-icon-star")
+ ->css_class("ui-icon-star $disabledState")
->ajax_handler("function(data) { window.location.reload() }")
->url(url::site("quick/make_album_cover/$item->id?csrf=$csrf")));
}
@@ -500,16 +500,16 @@ static function context_menu($menu, $theme, $item, $thumb_css_selector) {
if (($item->type == "album" && empty($item->album_cover_item_id)) ||
($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) ||
$parent->album_cover_item_id == $item->id) {
- $disabledState = " ui-state-disabled";
+ $disabledState = "ui-state-disabled";
} else {
- $disabledState = " ";
+ $disabledState = "";
}
if ($item->parent()->id != 1) {
$options_menu
->append(Menu::factory("ajax_link")
->id("make_album_cover")
->label($cover_title)
- ->css_class("ui-icon-star")
+ ->css_class("ui-icon-star $disabledState")
->ajax_handler("function(data) { window.location.reload() }")
->url(url::site("quick/make_album_cover/$item->id?csrf=$csrf")));
}
@@ -518,7 +518,8 @@ static function context_menu($menu, $theme, $item, $thumb_css_selector) {
->id("delete")
->label($delete_title)
->css_class("ui-icon-trash")
- ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&from_id={$theme_item->id}&page_type=$page_type")));
+ ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&" .
+ "from_id={$theme_item->id}&page_type=$page_type")));
}
if ($item->is_album()) {

0 comments on commit 075b95f

Please sign in to comment.