Skip to content

Commit

Permalink
feat(gallery): make showcase gallery a real gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
hypeJunction committed Dec 29, 2016
1 parent 4745903 commit ffdbdf6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
13 changes: 12 additions & 1 deletion views/default/forms/showcase/edit.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
elgg_require_js('forms/showcase/edit');
elgg_require_js('showcase/gallery');

$showcase = $vars['entity'];
$images = array();
Expand Down Expand Up @@ -28,7 +29,17 @@
$thumb_url = elgg_get_site_url() . "showcase/icon/{$img->guid}/medium/" . md5($img->time_created) . '.jpg';
$full_url = elgg_get_site_url() . "showcase/icon/{$img->guid}/master/" . md5($img->time_created) . '.jpg';
$gallery .= '<li>';
$gallery .= "<a class=\"elgg-showcase-screenshot elgg-lightbox elgg-photo\" href=\"$full_url\" rel=\"showcase-gallery\"><img src=\"$thumb_url\" alt=\"$img->title\" title=\"$img->title\"/></a>";
$gallery .= elgg_view('output/url', [
'class' => 'elgg-showcase-screenshot elgg-photo',
'href' => $full_url,
'rel' => 'showcase-gallery',
'title' => $img->title,
'text' => elgg_view('output/img', [
'src' => $thumb_url,
'alt' => $img->title,
]),
]);

$gallery .= elgg_view('output/url', array(
'text' => elgg_view_icon('delete'),
'href' => 'action/showcase/screenshot/delete?guid=' . $img->guid,
Expand Down
13 changes: 12 additions & 1 deletion views/default/object/showcase/full.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

elgg_require_js('showcase/gallery');

$showcase = $vars['entity'];
$owner = $showcase->getOwnerEntity();

Expand Down Expand Up @@ -32,7 +34,16 @@
$thumb_url = elgg_get_site_url() . "showcase/icon/{$img->guid}/large/" . md5($img->time_created) . '.jpg';
$full_url = elgg_get_site_url() . "showcase/icon/{$img->guid}/original/" . md5($img->time_created) . '.jpg';
$gallery .= '<li>';
$gallery .= "<a class=\"elgg-showcase-screenshot elgg-lightbox elgg-photo\" href=\"$full_url\" rel=\"showcase-gallery\"><img src=\"$thumb_url\" alt=\"$img->title\" title=\"$img->title\"/></a>";
$gallery .= elgg_view('output/url', [
'class' => 'elgg-showcase-screenshot elgg-photo',
'href' => $full_url,
'rel' => 'showcase-gallery',
'title' => $img->title,
'text' => elgg_view('output/img', [
'src' => $thumb_url,
'alt' => $img->title,
]),
]);
$gallery .= '</li>';
}
$gallery .= '</ul>';
Expand Down
10 changes: 10 additions & 0 deletions views/default/showcase/gallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
define(function(require) {

var lightbox = require('elgg/lightbox');

var options = {
photo: true,
};

lightbox.bind('a[rel="showcase-gallery"]', options, false); // 3rd attribute ensures binding is done without proxies
});

0 comments on commit ffdbdf6

Please sign in to comment.