diff options
Diffstat (limited to 'modules/gallery')
| -rw-r--r-- | modules/gallery/css/l10n_client.css | 12 | ||||
| -rw-r--r-- | modules/gallery/helpers/gallery.php | 65 | ||||
| -rw-r--r-- | modules/gallery/js/l10n_client.js | 7 | ||||
| -rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 14 | ||||
| -rw-r--r-- | modules/gallery/views/l10n_client.html.php | 5 | 
5 files changed, 54 insertions, 49 deletions
| diff --git a/modules/gallery/css/l10n_client.css b/modules/gallery/css/l10n_client.css index 51cbc753..9c1b12d0 100644 --- a/modules/gallery/css/l10n_client.css +++ b/modules/gallery/css/l10n_client.css @@ -42,9 +42,17 @@    cursor:pointer;    display:block;    position:absolute; right:0em; -  padding: 0em .75em; height:2em; line-height:2em; +  height:2em; line-height:2em;    text-transform:uppercase; -  text-align:center; background:#000;} +  text-align:center; background:#000; +} +#l10n-client-toggler a { +	font-size: 1em; +	padding: .5em; +} +#l10n-client-toggler #gMinimizeL10n { +  border-right: 1px solid #ffffff; +}  /* Panel labels */  #l10n-client h2 { diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index c81af842..122227fc 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -82,9 +82,9 @@ class gallery_Core {    static function site_menu($menu, $theme) {      if ($theme->page_type != "login") {        $menu->append(Menu::factory("link") -                    ->id("home") -                    ->label(t("Home")) -                    ->url(url::site("albums/1"))); +              ->id("home") +              ->label(t("Home")) +              ->url(url::site("albums/1")));        $item = $theme->item(); @@ -92,48 +92,47 @@ class gallery_Core {        $can_add = $item && access::can("add", $item);        if ($can_add) { -        $menu->append(Menu::factory("dialog") -                      ->id("add_photos_item") -                      ->label(t("Add photos")) -                      ->url(url::site("simple_uploader/app/$item->id"))); +      	$menu->append($add_menu = Menu::factory("submenu") +                    ->id("add_menu") +                    ->label(t("Add"))); +        $add_menu->append(Menu::factory("dialog") +                    ->id("add_photos_item") +                    ->label(t("Add photos")) +                    ->url(url::site("simple_uploader/app/$item->id"))); +        if ($item->is_album()) { +        	$add_menu->append(Menu::factory("dialog") +                      ->id("add_album_item") +                      ->label(t("Add an album")) +                      ->url(url::site("form/add/albums/$item->id?type=album"))); +				}        }        $menu->append($options_menu = Menu::factory("submenu") -                    ->id("options_menu") -                    ->label(t("Options"))); +              ->id("options_menu") +              ->label(t("Photo options")));        if ($item && ($can_edit || $can_add)) {          if ($can_edit) { -          $options_menu -            ->append(Menu::factory("dialog") -                     ->id("edit_item") -                     ->label($item->is_album() ? t("Edit album") : t("Edit photo")) -                     ->url(url::site("form/edit/{$item->type}s/$item->id"))); +          $options_menu->append(Menu::factory("dialog") +                          ->id("edit_item") +                          ->label($item->is_album() ? t("Edit album") : t("Edit photo")) +                          ->url(url::site("form/edit/{$item->type}s/$item->id")));          } -        // @todo Move album options menu to the album quick edit pane          if ($item->is_album()) { -          if ($can_add) { -            $options_menu -              ->append(Menu::factory("dialog") -                       ->id("add_album") -                       ->label(t("Add an album")) -                       ->url(url::site("form/add/albums/$item->id?type=album"))); -          } - +          $options_menu->label(t("Album options"));            if ($can_edit) { -            $options_menu -              ->append(Menu::factory("dialog") -                       ->id("edit_permissions") -                       ->label(t("Edit permissions")) -                       ->url(url::site("permissions/browse/$item->id"))); +            $options_menu->append(Menu::factory("dialog") +                            ->id("edit_permissions") +                            ->label(t("Edit permissions")) +                            ->url(url::site("permissions/browse/$item->id")));            }          }        }        if (user::active()->admin) {          $menu->append($admin_menu = Menu::factory("submenu") -                      ->id("admin_menu") -                      ->label(t("Admin"))); +                ->id("admin_menu") +                ->label(t("Admin")));          gallery::admin_menu($admin_menu, $theme);          module::event("admin_menu", $admin_menu, $theme);        } @@ -160,12 +159,6 @@ class gallery_Core {                          ->label(t("Languages"))                          ->url(url::site("admin/languages")))                 ->append(Menu::factory("link") -                        ->id("l10n_mode") -                        ->label(Session::instance()->get("l10n_mode", false) -                                ? t("Stop translating") : t("Start translating")) -                        ->url(url::site("l10n_client/toggle_l10n_mode?csrf=" . -                                        access::csrf_token()))) -               ->append(Menu::factory("link")                          ->id("advanced")                          ->label(t("Advanced"))                          ->url(url::site("admin/advanced_settings")))) diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index f5be5058..80fe166b 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -58,7 +58,8 @@ jQuery.extend(Gallery, {          case 1:            $('#l10n-client-string-select, #l10n-client-string-editor, #l10n-client .labels .label').show();            $('#l10n-client').height('22em').removeClass('hidden'); -        $('#l10n-client-toggler').text(MSG_CLOSE_X); +					//$('#l10n-client').slideUp(); +					$('#gMinimizeL10n').text("_");          /*           * This CSS clashes with Gallery's CSS, probably due to           * YUI's grid / floats. @@ -72,7 +73,7 @@ jQuery.extend(Gallery, {            $('#l10n-client-string-select, #l10n-client-string-editor, #l10n-client .labels .label').hide();            $('#l10n-client').height('2em').addClass('hidden');            // TODO: Localize this message -          $('#l10n-client-toggler').text(MSG_TRANSLATE_TEXT); +					$('#gMinimizeL10n').text(MSG_TRANSLATE_TEXT);          /*            if(!$.browser.msie) {              $('body').css('border-bottom', '0px'); @@ -197,7 +198,7 @@ Gallery.behaviors.l10nClient = function(context) {    });    // When l10n_client window is clicked, toggle based on current state. -  $('#l10n-client-toggler').click(function() { +  $('#gMinimizeL10n').click(function() {      if($('#l10n-client').is('.hidden')) {        Gallery.l10nClient.toggle(1);      } else { diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 0940d076..585e247c 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -19,12 +19,12 @@   */  class Item_Model_Test extends Unit_Test_Case {    public function saving_sets_created_and_updated_dates_test() { -    $item = self::create_random_item(); +    $item = self::_create_random_item();      $this->assert_true(!empty($item->created));      $this->assert_true(!empty($item->updated));    } -  private function create_random_item() { +  private static function _create_random_item() {      $item = ORM::factory("item");      /* Set all required fields (values are irrelevant) */      $item->name = rand(); @@ -33,7 +33,7 @@ class Item_Model_Test extends Unit_Test_Case {    }    public function updating_doesnt_change_created_date_test() { -    $item = self::create_random_item(); +    $item = self::_create_random_item();      // Force the creation date to something well known      $db = Database::instance(); @@ -47,7 +47,7 @@ class Item_Model_Test extends Unit_Test_Case {    }    public function updating_view_count_only_doesnt_change_updated_date_test() { -    $item = self::create_random_item(); +    $item = self::_create_random_item();      $item->reload();      $this->assert_same(0, $item->view_count); @@ -64,7 +64,7 @@ class Item_Model_Test extends Unit_Test_Case {    public function move_photo_test() {      // Create a test photo -    $item = self::create_random_item(); +    $item = self::_create_random_item();      file_put_contents($item->thumb_path(), "thumb");      file_put_contents($item->resize_path(), "resize"); @@ -128,7 +128,7 @@ class Item_Model_Test extends Unit_Test_Case {    public function item_rename_wont_accept_slash_test() {      // Create a test photo -    $item = self::create_random_item(); +    $item = self::_create_random_item();      $new_name = rand() . "/"; @@ -142,7 +142,7 @@ class Item_Model_Test extends Unit_Test_Case {    }    public function save_original_values_test() { -    $item = $this->create_random_item(); +    $item = self::_create_random_item();      $item->title = "ORIGINAL_VALUE";      $item->save();      $item->title = "NEW_VALUE"; diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php index c73719ca..5ee7eca3 100644 --- a/modules/gallery/views/l10n_client.html.php +++ b/modules/gallery/views/l10n_client.html.php @@ -1,7 +1,10 @@  <?php defined("SYSPATH") or die("No direct script access.") ?>  <div id="l10n-client" class="hidden">    <div class="labels"> -    <span id="l10n-client-toggler">X</span> +    <span id="l10n-client-toggler"> +    	<a id="gMinimizeL10n">_</a> +			<a id="gCloseL10n" href="<?= url::site("l10n_client/toggle_l10n_mode?csrf=".access::csrf_token()) ?>">X</a> +	  </span>      <div class="label strings"><h2><?= t("Page Text") ?>      <? if (!Input::instance()->get('show_all_l10n_messages')): ?>        <a style="background-color:#fff" href="<?= url::site("admin/languages?show_all_l10n_messages=1") ?>"><?= t("(Show All)") ?></a> | 
