add "edit this photo" to the search results

wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sun, 2011-07-17 15:34

Can anyone help me in this:
I want to add the option (for the logged in admin) that when I search for any image, in the results page I get the "Options menu" that has "Edit this photo", so I could directly edit the photo from the search page, without having to click on it to go to it's page, and then edit it..

I found the Options menu code at "gallery_event.php", and the search files are at Modules>Search, but I don't know which lines to copy, and where to add them..

Thanks,

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2011-07-17 18:42

in modules/search/views/search.html.php find:

      <a href="<?= $item->url() ?>">
        <?= $item->thumb_img() ?>
        <p>
          <?= html::purify(text::limit_chars($item->title, 32, "…")) ?>

change to

      <a href="<?= $item->url() ?>">
        <?= $item->thumb_img() ?>
		<? if ($item && $item->is_photo() && $user->admin) : ?>
		<?= $theme->context_menu($item, "#g-item-id-{$item->id} .g-thumbnail") ?>
		<? endif ?>
        <p>
          <?= html::purify(text::limit_chars($item->title, 32, "…")) ?>

The UI is not quite 100% but it is only for the admin anyway.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
wise_mike

Joined: 2008-10-21
Posts: 158
Posted: Sun, 2011-07-17 19:08

works perfect, thanks