Skip to content

Commit

Permalink
Merge pull request #3 from operun/feature/fix_gallery
Browse files Browse the repository at this point in the history
Feature/fix gallery
  • Loading branch information
santonelli committed Jan 26, 2016
2 parents 1f5569e + 3da2dbc commit d0b55ff
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 47 deletions.
8 changes: 8 additions & 0 deletions src/operun/gallery/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@
permission="zope2.View"
/>

<browser:menuItem
for="plone.app.contenttypes.interfaces.IFolder"
menu="plone_displayviews"
title="Gallery"
action="gallery"
description="Show folder contents as a gallery"
/>

</configure>
24 changes: 23 additions & 1 deletion src/operun/gallery/browser/static/gallery-compiled.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/operun/gallery/browser/static/gallery-compiled.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/operun/gallery/browser/static/gallery-compiled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/operun/gallery/browser/static/gallery-compiled.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/operun/gallery/browser/static/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,17 @@ require([
'use strict';

// Custom variables
$('.gallery-image').each(function() {
$(this).delay(Math.floor(Math.random() * 1000)).animate({
opacity: 1
}, 250);
});

$('.gallery-image').hover(function() {
$(this).find('.gallery-image-title').fadeIn('fast');
},
function() {
$(".gallery-image-title").fadeOut('fast');
});

});
36 changes: 31 additions & 5 deletions src/operun/gallery/browser/static/gallery.less
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
/* import lightbox less */
@import "lightbox.less";
@import 'lightbox.less';

#gallery {
/* Gallery variables */

#image-gallery {
margin-bottom: 30px;
padding: 0 15px 0 15px;
}

.gallery-image-wrapper {
padding: 15px;
}

.gallery-image {
position: relative;
width: 100%;
height: auto;
opacity: 0;
}

.gallery-image img {
width: 100%;
height: 100%;
}

.lightbox a:focus,
.lightbox a:hover,
.lightbox a:active {
/* Gradient variables */

.gallery-image-title {
width: 100%;
position: absolute;
bottom: 0;
display: none;
padding: 10px;
color: #fff;
background-color: rgba(0, 0, 0, 0.5);
}

/* Overrides */

.lightbox a:focus, .lightbox a:hover, .lightbox a:active {
outline: none !important;
}
13 changes: 0 additions & 13 deletions src/operun/gallery/browser/static/lightbox.min.js

This file was deleted.

42 changes: 19 additions & 23 deletions src/operun/gallery/browser/templates/gallery.pt
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
<html i18n:domain="plone"
lang="en"
metal:use-macro="context/main_template/macros/master"
xml:lang="en"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xml:lang="en" xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns="http://www.w3.org/1999/xhtml">

<body>
<metal:content-core fill-slot="content-core">
<metal:content-core define-macro="content-core" tal:define="toc context/table_of_contents|nothing;">
<body>
<metal:content-core fill-slot="content-core">
<metal:content-core define-macro="content-core" tal:define="toc context/table_of_contents|nothing;">

<div id="parent-fieldname-text"
tal:condition="exists:context/text"
tal:content="structure python:context.text.output_relative_to(view.context)"
tal:attributes="class python: toc and 'pat-autotoc' or ''"/>
<div id="parent-fieldname-text" tal:condition="exists:context/text"
tal:content="structure python:context.text.output_relative_to(view.context)"
tal:attributes="class python: toc and 'pat-autotoc' or ''" />

<div class="row" id="gallery" tal:define="images view/images" tal:condition="images">
<div class="col-xs-4 col-sm-3" tal:repeat="image images">
<div class="gallery-image">
<div class="image-title">
<h2 tal:content="image/title">Teaser Title</h2>
</div>
<a href="" data-lightbox="" data-title="" tal:attributes="href image/url;
data-lightbox context/id;
data-title image/title">
<img tal:replace="structure image/image"/>
</a>
</div>
<div class="row" id="image-gallery" tal:define="images view/images" tal:condition="images">
<div class="col-xs-4 col-sm-3 gallery-image-wrapper" tal:repeat="image images">
<div class="gallery-image">
<a href="" data-lightbox="" data-title="" tal:attributes="href image/url;
data-lightbox context/id;
data-title image/title">
<div class="gallery-image-title" tal:content="image/title"></div>
<img tal:replace="structure image/image" />
</a>
</div>
</div>
</div>

</metal:content-core>
</metal:content-core>
</body>
</metal:content-core>
</body>

</html>
2 changes: 1 addition & 1 deletion src/operun/gallery/profiles/default/types.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<object name="portal_types" meta_type="Plone Types Tool">
<object name="Gallery" meta_type="Dexterity FTI"/>
<!-- <object name="Gallery" meta_type="Dexterity FTI"/> -->
</object>
7 changes: 7 additions & 0 deletions src/operun/gallery/profiles/default/types/Folder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<object name="Folder" meta_type="Dexterity FTI" i18n:domain="plone"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<property name="view_methods" purge="False">
<element value="gallery"/>
</property>
</object>
2 changes: 1 addition & 1 deletion src/operun/gallery/profiles/default/types/Gallery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<property name="allow_discussion">False</property>
<property name="default_view">view</property>
<property name="view_methods">
<element value="view"/>
<element value="view" />
</property>
<property name="default_view_fallback">False</property>
<property name="add_permission">cmf.AddPortalContent</property>
Expand Down

0 comments on commit d0b55ff

Please sign in to comment.