Skip to content

Commit

Permalink
Merge 7b786e2 into 4421e4d
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Jul 21, 2016
2 parents 4421e4d + 7b786e2 commit 4d6a7d5
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 78 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -6,6 +6,12 @@ There's a frood who really knows where his towel is.
1.0b2 (unreleased)
------------------

- Fade in gallery to avoid show big galleries without cycle2 loaded.
[rodfersou]

- Use collective.js.cycle2 Cycle2SlideShow utils class.
[rodfersou]

- Use HTML entities in Unicode Normalization Form C to avoid warnings when validating.
[hvelarde]

Expand Down
1 change: 0 additions & 1 deletion buildout.cfg
Expand Up @@ -42,6 +42,5 @@ eggs = ${test:eggs}
# use latest version of coverage and setuptools
coverage =
setuptools =
collective.js.cycle2 = 1.0b1
# suppress unassociated template warnings for collective.cover on tests
grokcore.view = 2.9
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -37,7 +37,7 @@
include_package_data=True,
zip_safe=False,
install_requires=[
'collective.js.cycle2',
'collective.js.cycle2 >=1.0b2',
'plone.api',
'plone.app.dexterity [grok, relations]',
'plone.app.relationfield',
Expand Down
72 changes: 54 additions & 18 deletions src/sc/photogallery/browser/static/photogallery.css
Expand Up @@ -4,19 +4,25 @@ body.portaltype-photo-gallery .slideshow-container,
width: 100%;
max-width: 748px;
margin: 10px auto;

opacity: 0;

filter: alpha(opacity=0);
}

body.portaltype-photo-gallery .slideshow-description,
body.portaltype-photo-gallery .slideshow-carrossel
{
float: left;

width: 50%;
}

.photogallery-tile .slideshow-description,
.photogallery-tile .slideshow-carrossel
{
float: left;

width: 45%;
}

Expand All @@ -26,16 +32,21 @@ body.portaltype-photo-gallery .slideshow-download,
float: left;
}

.photogallery-tile .photogallery-url
#content .photogallery-tile .photogallery-url
{
font-size: .8rem;
font-weight: bold;
line-height: .8rem;

display: block;
float: left;

width: 10%;
padding: 6px 0;

text-align: center;
color: white;
background-color: #0094cc;

border-bottom: none;
}

body.portaltype-photo-gallery .cycle-slideshow,
Expand All @@ -52,13 +63,17 @@ body.portaltype-photo-gallery .cycle-slideshow,
.photogallery-tile .cycle-slideshow
{
position: relative;

width: 100%;
max-width: 768px;
height: auto;
padding: 0;

background: #f1f1f1;
}
body.portaltype-photo-gallery .cycle-description.cycle-slideshow {
body.portaltype-photo-gallery .cycle-description.cycle-slideshow,
.photogallery-tile .cycle-description.cycle-slideshow
{
background: transparent;
}

Expand All @@ -68,13 +83,15 @@ body.portaltype-photo-gallery .cycle-player img,
position: absolute;
top: 0;
left: 0;

display: block;
width: 100%;

width: auto;
max-width: 100%;
height: auto;
max-height: 100%;
padding: 0;
margin: 0 auto;
padding: 0;
}

body.portaltype-photo-gallery .cycle-player .cycle-slide,
Expand All @@ -84,16 +101,14 @@ body.portaltype-photo-gallery .cycle-player .cycle-slide,
}

body.portaltype-photo-gallery .thumb-itens,
.photogallery-tile .thumb-itens {
max-height: 50px;
.photogallery-tile .thumb-itens
{
overflow: hidden;

max-height: 50px;
margin-right: 5px;
cursor: pointer;
}

body.portaltype-photo-gallery .thumb-itens img,
.photogallery-tile .thumb-itens img {
width: 96px;
cursor: pointer;
}

body.portaltype-photo-gallery .cycle-slideshow img:first-child,
Expand All @@ -115,8 +130,11 @@ body.portaltype-photo-gallery .cycle-pager,
position: absolute;
z-index: 500;
top: 10px;

overflow: hidden;

width: 100%;

text-align: center;
}

Expand All @@ -125,10 +143,14 @@ body.portaltype-photo-gallery .cycle-pager span,
{
font-family: arial;
font-size: 50px;

display: inline-block;

width: 16px;
height: 16px;

cursor: pointer;

color: #ddd;
}

Expand All @@ -151,6 +173,7 @@ body.portaltype-photo-gallery .cycle-caption,
z-index: 700;
right: 15px;
bottom: 15px;

color: white;
}

Expand All @@ -167,15 +190,20 @@ body.portaltype-photo-gallery a.cycle-next,
.photogallery-tile a.cycle-next
{
font-size: 50px;

position: absolute;
z-index: 800;
top: 0;

width: 10%;
height: 87%;

cursor: pointer;
text-align: center;

opacity: 0;
border-bottom: 0 !important;

filter: alpha(opacity=0);
}

Expand Down Expand Up @@ -239,23 +267,31 @@ body.portaltype-photo-gallery .disabled,
filter: alpha(opacity=50);
}

body.portaltype-photo-gallery .slideshow-download .cycle-slideshow {
body.portaltype-photo-gallery .slideshow-download .cycle-slideshow
{
background: transparent;
}
body.portaltype-photo-gallery .slideshow-download {
body.portaltype-photo-gallery .slideshow-download
{
position: relative;

clear: both;
}
body.portaltype-photo-gallery .download.album,
body.portaltype-photo-gallery .slideshow-download a {
body.portaltype-photo-gallery .slideshow-download a
{
display: inline-block;

margin-top: 10px;

border: none;
}
body.portaltype-photo-gallery .slideshow-container {
body.portaltype-photo-gallery .slideshow-container
{
margin: 10px auto 50px auto;
}
body.portaltype-photo-gallery .download.album {
body.portaltype-photo-gallery .download.album
{
margin-left: 25px;
}

Expand Down
54 changes: 1 addition & 53 deletions src/sc/photogallery/browser/static/photogallery.js
@@ -1,60 +1,8 @@
var PhotoGallery = (function() {
function PhotoGallery(el) {
var self = this;
self.$el = $(el);
self.proportion = 3 / 2;
self.bind_events();
self.fix_image_size();
}
PhotoGallery.prototype.$ = function(selector) {
var self = this;
return $(selector, self.$el);
};
PhotoGallery.prototype.bind_events = function() {
var self = this;
self.$('.cycle-player').on('cycle-next cycle-prev', self, self.sync_slideshows);
self.$('.cycle-carrossel .thumb-itens').on('click', self, self.thumbs_click);
};
PhotoGallery.prototype.fix_image_size = function() {
var self, max_height, max_width, $player, $imgs;
self = this;

// Calc max_with and max_height
$player = self.$('.cycle-player');
max_width = $player.width();
max_height = max_width / self.proportion;
// Calc max_with and max_height

$imgs = self.$('.cycle-player img');
$imgs.css({
'max-width': max_width,
'max-height': max_height
});
};

PhotoGallery.prototype.sync_slideshows = function(e, opts) {
var self, index, $player, $slideshows;
self = e.data;
$slideshows = self.$('.cycle-slideshow');
$slideshows.cycle('goto', opts.currSlide);
};

PhotoGallery.prototype.thumbs_click = function(e) {
var self, index, $thumbs, $slideshows;
self = e.data;
e.preventDefault();
$thumbs = self.$('.cycle-carrossel');
index = $thumbs.data('cycle.API').getSlideIndex(this);
$slideshows = self.$('.cycle-slideshow');
$slideshows.cycle('goto', index);
};
return PhotoGallery;
})();
$(window).load(function() {
var i, len, ref, slideshow;
ref = $('.slideshow-container');
for (i = 0, len = ref.length; i < len; i++) {
slideshow = ref[i];
new PhotoGallery(slideshow);
new cycle2SlideShow(slideshow);
}
});
1 change: 1 addition & 0 deletions src/sc/photogallery/config.py
Expand Up @@ -9,6 +9,7 @@
'++resource++collective.js.cycle2/jquery.cycle2.min.js',
'++resource++collective.js.cycle2/jquery.cycle2.carousel.min.js',
'++resource++collective.js.cycle2/jquery.cycle2.swipe.min.js',
'++resource++collective.js.cycle2/utils.min.js',
)

HAS_ZIPEXPORT = True
Expand Down
7 changes: 7 additions & 0 deletions src/sc/photogallery/logger.py
@@ -0,0 +1,7 @@
# -*- coding:utf-8 -*-
from sc.photogallery.config import PROJECTNAME

import logging


logger = logging.getLogger(PROJECTNAME)
16 changes: 16 additions & 0 deletions src/sc/photogallery/upgrades/__init__.py
@@ -1 +1,17 @@
# -*- coding: utf-8 -*-
from plone import api
from sc.photogallery.logger import logger


def cook_css_resources(context): # pragma: no cover
"""Cook CSS resources."""
css_tool = api.portal.get_tool('portal_css')
css_tool.cookResources()
logger.info('CSS resources were cooked')


def cook_javascript_resources(context): # pragma: no cover
"""Cook JavaScript resources."""
js_tool = api.portal.get_tool('portal_javascripts')
js_tool.cookResources()
logger.info('JavaScript resources were cooked')
6 changes: 1 addition & 5 deletions src/sc/photogallery/upgrades/v1001/__init__.py
Expand Up @@ -3,11 +3,7 @@
from plone.app.upgrade.utils import loadMigrationProfile
from sc.photogallery.config import PROJECTNAME
from sc.photogallery.interfaces import IPhotoGallery

import logging


logger = logging.getLogger(PROJECTNAME)
from sc.photogallery.logger import logger


def apply_profile(context):
Expand Down

0 comments on commit 4d6a7d5

Please sign in to comment.