Compare commits

..

No commits in common. "0.1" and "master" have entirely different histories.
0.1 ... master

6 changed files with 18 additions and 135 deletions

View File

@ -1,11 +1,8 @@
{% if form is defined %}
{% form_theme form with [_self, 'form_errors.html.twig'] %}
{% endif %}
{% if app.environment == 'dev' %}
{% set bucket = '' %}
{% else %}
{% set bucket = 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4' %}
{% endif %}
<!DOCTYPE html>
<html lang="en-us">
<head>

View File

@ -37,11 +37,16 @@ monolog:
# type: chromephp
# level: info
vich_uploader:
storage: file_system
storage: gaufrette
mappings:
gallery_image:
uri_prefix: /images/gallery
upload_destination: '%kernel.root_dir%/../web/gallery/images/gallery'
upload_destination: cloud
uri_prefix: /
#storage: file_system
#mappings:
# gallery_image:
# uri_prefix: /images/gallery
# upload_destination: '%kernel.root_dir%/../web/images/gallery'
swiftmailer:
transport: null

View File

@ -57,10 +57,8 @@ services:
arguments: ['@router', '@monolog.logger']
doughnutwedding.uikit.template:
class: Sikofitt\DoughnutWeddingBundle\Pager\View\UIkitTemplate
arguments: ['@service_container']
pagerfanta.view.default:
class: Pagerfanta\View\DefaultView
arguments: ['@doughnutwedding.uikit.template']
public: false
tags: [{ name: pagerfanta.view, alias: default }]
tags: [{ name: pagerfanta.view, alias: default }]

View File

@ -261,12 +261,9 @@ class GalleryController extends Controller
->get('doctrine.orm.entity_manager')
->getRepository('SikofittDoughnutWeddingBundle:Image')
->findImageByTag($tag);
$adapter = new ArrayAdapter($images);
$pager = new Pagerfanta($adapter);
$pager->setMaxPerPage(12);
$pager->setCurrentPage($number);
$chunks = array_chunk($images, 12);
return $this
@ -294,11 +291,9 @@ class GalleryController extends Controller
->getRepository('SikofittDoughnutWeddingBundle:Image')
->findImageByCategory($category);
$adapter = new ArrayAdapter($images);
$pager = new Pagerfanta($adapter);
$pager->setMaxPerPage(12);
$pager->setCurrentPage($number);
$chunks = array_chunk($images, 12);
return $this

View File

@ -21,7 +21,6 @@
namespace Sikofitt\DoughnutWeddingBundle\Pager\View;
use Pagerfanta\View\Template\Template;
use Symfony\Component\DependencyInjection\ContainerInterface;
class UIkitTemplate extends Template
{
@ -40,15 +39,7 @@ class UIkitTemplate extends Template
'rel_next' => 'next',
];
private $serviceContainer;
public function __construct(ContainerInterface $serviceContainer)
{
$this->serviceContainer = $serviceContainer;
parent::__construct();
}
/**
/**
* Renders the container for the pagination.
*
* The %pages% placeholder will be replaced by the rendering of pages
@ -60,81 +51,6 @@ class UIkitTemplate extends Template
return sprintf('<ul class="%s" uk-margin>%s</ul>', static::$defaultOptions['css_container_class'], '%pages%');
}
public function categoryPage($page, $path) {
$args = explode('/', $path);
array_shift($args);
if(is_int(count($args)-1)) {
$args[count($args)-1] = $page;
}
if((int)$args[count($args) - 1] === 1) {
array_pop($args);
}
$path = implode('/', $args);
return sprintf('<li><a href="/%s">%s</a></li>', $path, $page);
}
public function categoryPageNext($page, $path) {
$args = explode('/', $path);
array_shift($args);
$args[count($args) - 1] = $page;
$path = implode('/', $args);
return sprintf('<li><a href="/%s">Next <span class="uk-margin-small-right" uk-pagination-next></span></a></li>', $path);
}
public function categoryPagePrevious($page, $path) {
$args = explode('/', $path);
array_shift($args);
if (1 === (int) $page) {
array_pop($args);
$path = implode('/', $args);
return '<li><a href="/'.$path.'"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
}
$args[count($args)-1] = $page;
$path = implode('/', $args);
return '<li><a href="/'.$path.'"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
}
public function tagPage($page, $path) {
$args = explode('/', $path);
array_shift($args);
if(count($args) === 3) {
$args[] = $page;
} elseif(count($args) === 4) {
$args[count($args) -1] = $page;
}
if(1 === $page) {
array_pop($args);
}
$path = implode('/', $args);
return sprintf('<li><a href="/%s">%s</a></li>', $path, $page);
}
public function tagPageNext($page, $path) {
$args = explode('/', $path);
array_shift($args);
if(count($args) === 3) {
$args[] = $page;
} else {
$args[count($args) - 1] = $page;
}
$path = implode('/', $args);
return sprintf('<li><a href="/%s">Next <span class="uk-margin-small-right" uk-pagination-next></span></a></li>', $path);
}
public function tagPagePrevious($page, $path) {
$args = explode('/', $path);
array_shift($args);
if (1 === (int) $page) {
array_pop($args);
$path = implode('/', $args);
return '<li><a href="/'.$path.'"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
}
$args[count($args)-1] = $page;
$path = implode('/', $args);
return '<li><a href="/'.$path.'"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
}
/**
* Renders a given page.
*
@ -144,21 +60,12 @@ class UIkitTemplate extends Template
*/
public function page($page)
{
$path = $this->serviceContainer->get('request_stack')->getCurrentRequest()->getRequestUri();
if(
false !== strpos($path, 'tag') ||
false !== strpos($path, 'category')
) {
return $this->tagPage($page, $path);
}
if (1 === (int)$page) {
return '<li><a href="/gallery">' . $page . '</a></li>';
if (1 === (int) $page) {
return '<li><a href="/gallery">'.$page.'</a></li>';
}
return '<li><a href="/gallery/page/' . $page . '">' . $page . '</a></li>';
}
return '<li><a href="/gallery/page/'.$page.'">'.$page.'</a></li>';
}
/**
* Renders a given page with a specified text.
@ -192,14 +99,6 @@ class UIkitTemplate extends Template
*/
public function previousEnabled($page)
{
$path = $this->serviceContainer->get('request_stack')->getCurrentRequest()->getRequestUri();
if(
false !== strpos($path, 'tag') ||
false !== strpos($path, 'category')
) {
return $this->tagPagePrevious($page, $path);
}
if (1 === (int) $page) {
return '<li><a href="/gallery"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
}
@ -226,14 +125,6 @@ class UIkitTemplate extends Template
*/
public function nextEnabled($page)
{
$path = $this->serviceContainer->get('request_stack')->getCurrentRequest()->getRequestUri();
if(
false !== strpos($path, 'tag') ||
false !== strpos($path, 'category')
) {
return $this->tagPageNext($page, $path);
}
return '<li class=""><a href="/gallery/page/'.$page.'">Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>';
}

View File

@ -15,12 +15,9 @@
<div class="uk-child-width-1-2@s uk-child-width-1-4@m uk-grid-small uk-grid-match uk-flex-middle" uk-grid>
{% if images is not null and images is not empty %}
{% for image in images %}
{% if app.environment == 'dev' %}
{% set imageUrl = '/gallery/' ~ vich_uploader_asset(image, 'imageFile')|trim('/', 'left') %}
{% else %}
{% set imageUrl = bucket ~ '/gallery/' ~ vich_uploader_asset(image, 'imageFile')|trim('/', 'left') %}
{% endif %}
<div class=" uk-height-small uk-overflow-hidden uk-cover-container">
{% set imageUrl = bucket ~ '/gallery/' ~ vich_uploader_asset(image, 'imageFile')|trim('/', 'left') %}
<div class=" uk-height-small uk-overflow-hidden uk-cover-container">
<a class="uk-inline-clip uk-background-cover" style="background-image:url({{ imageUrl }})" href="#modal-full-{{ image.id }}" uk-cover uk-toggle></a>
<div id="modal-full-{{ image.id }}" class="uk-modal-full" uk-modal>