Commits

Alessandro Molina committed 13b3f9b

Propagate inline_photos option to the photo controller to make possible to disable lightbox

Comments (0)

Files changed (3)

photos/controllers/root.py

 """Main Controller"""
 
 from tg import TGController
-from tg import expose, flash, require, url, lurl, request, redirect, validate, abort
+from tg import expose, flash, require, url, lurl, request, redirect, validate, abort, config
 from tg.i18n import ugettext as _, lazy_ugettext as l_
 from tg.decorators import cached_property
 
     @expose('genshi:photos.templates.gallery')
     @validate(dict(gallery=SQLAEntityConverter(Gallery)), error_handler=index)
     def gallery(self, gallery):
-        return dict(gallery=gallery)
+        photos_config = config.get('_pluggable_photos_config')
+        return dict(gallery=gallery, inline=photos_config.get('inline_photos', True))
 
     @expose('genshi:photos.templates.photo')
     @validate(dict(photo=SQLAEntityConverter(Photo)), error_handler=lambda c:abort(404))

photos/templates/gallery.html

     </div>
 
     <div id="photos_gallery">
-        ${h.call_partial('photos.partials:gallery', gallery=gallery)}
+        ${h.call_partial('photos.partials:gallery', gallery=gallery, inline=inline)}
     </div>
 
-    <script>
+    <script py:if="inline">
         jqPhoto('#photos_gallery a').lightBox({
             'imageBtnPrev':'${tg.url('/_pluggable/photos/images/lightbox-btn-prev.gif')}',
             'imageBtnNext':'${tg.url('/_pluggable/photos/images/lightbox-btn-next.gif')}',

photos/templates/photo.html

       xmlns:py="http://genshi.edgewall.org/"
       xmlns:xi="http://www.w3.org/2001/XInclude">
 
-<xi:include href="../master.html" />
+<xi:include href="master.html" />
 
 <head>
     <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/_pluggable/photos/css/style.css')}" />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.