fixed background-contain
This commit is contained in:
parent
c4049bc349
commit
2aaedb8f59
|
@ -1,8 +1,11 @@
|
||||||
{% if form is defined %}
|
{% if form is defined %}
|
||||||
{% form_theme form with [_self, 'form_errors.html.twig'] %}
|
{% form_theme form with [_self, 'form_errors.html.twig'] %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if app.environment == 'dev' %}
|
||||||
|
{% set bucket = '' %}
|
||||||
|
{% else %}
|
||||||
{% set bucket = 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4' %}
|
{% set bucket = 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4' %}
|
||||||
|
{% endif %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en-us">
|
<html lang="en-us">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -37,16 +37,11 @@ monolog:
|
||||||
# type: chromephp
|
# type: chromephp
|
||||||
# level: info
|
# level: info
|
||||||
vich_uploader:
|
vich_uploader:
|
||||||
storage: gaufrette
|
storage: file_system
|
||||||
mappings:
|
mappings:
|
||||||
gallery_image:
|
gallery_image:
|
||||||
upload_destination: cloud
|
uri_prefix: /images/gallery
|
||||||
uri_prefix: /
|
upload_destination: '%kernel.root_dir%/../web/gallery/images/gallery'
|
||||||
#storage: file_system
|
|
||||||
#mappings:
|
|
||||||
# gallery_image:
|
|
||||||
# uri_prefix: /images/gallery
|
|
||||||
# upload_destination: '%kernel.root_dir%/../web/images/gallery'
|
|
||||||
|
|
||||||
swiftmailer:
|
swiftmailer:
|
||||||
transport: null
|
transport: null
|
||||||
|
|
|
@ -57,8 +57,10 @@ services:
|
||||||
arguments: ['@router', '@monolog.logger']
|
arguments: ['@router', '@monolog.logger']
|
||||||
doughnutwedding.uikit.template:
|
doughnutwedding.uikit.template:
|
||||||
class: Sikofitt\DoughnutWeddingBundle\Pager\View\UIkitTemplate
|
class: Sikofitt\DoughnutWeddingBundle\Pager\View\UIkitTemplate
|
||||||
|
arguments: ['@service_container']
|
||||||
pagerfanta.view.default:
|
pagerfanta.view.default:
|
||||||
class: Pagerfanta\View\DefaultView
|
class: Pagerfanta\View\DefaultView
|
||||||
arguments: ['@doughnutwedding.uikit.template']
|
arguments: ['@doughnutwedding.uikit.template']
|
||||||
public: false
|
public: false
|
||||||
tags: [{ name: pagerfanta.view, alias: default }]
|
tags: [{ name: pagerfanta.view, alias: default }]
|
||||||
|
|
||||||
|
|
|
@ -261,9 +261,12 @@ class GalleryController extends Controller
|
||||||
->get('doctrine.orm.entity_manager')
|
->get('doctrine.orm.entity_manager')
|
||||||
->getRepository('SikofittDoughnutWeddingBundle:Image')
|
->getRepository('SikofittDoughnutWeddingBundle:Image')
|
||||||
->findImageByTag($tag);
|
->findImageByTag($tag);
|
||||||
|
|
||||||
|
|
||||||
$adapter = new ArrayAdapter($images);
|
$adapter = new ArrayAdapter($images);
|
||||||
$pager = new Pagerfanta($adapter);
|
$pager = new Pagerfanta($adapter);
|
||||||
$pager->setMaxPerPage(12);
|
$pager->setMaxPerPage(12);
|
||||||
|
$pager->setCurrentPage($number);
|
||||||
$chunks = array_chunk($images, 12);
|
$chunks = array_chunk($images, 12);
|
||||||
|
|
||||||
return $this
|
return $this
|
||||||
|
@ -291,9 +294,11 @@ class GalleryController extends Controller
|
||||||
->getRepository('SikofittDoughnutWeddingBundle:Image')
|
->getRepository('SikofittDoughnutWeddingBundle:Image')
|
||||||
->findImageByCategory($category);
|
->findImageByCategory($category);
|
||||||
|
|
||||||
|
|
||||||
$adapter = new ArrayAdapter($images);
|
$adapter = new ArrayAdapter($images);
|
||||||
$pager = new Pagerfanta($adapter);
|
$pager = new Pagerfanta($adapter);
|
||||||
$pager->setMaxPerPage(12);
|
$pager->setMaxPerPage(12);
|
||||||
|
$pager->setCurrentPage($number);
|
||||||
$chunks = array_chunk($images, 12);
|
$chunks = array_chunk($images, 12);
|
||||||
|
|
||||||
return $this
|
return $this
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
namespace Sikofitt\DoughnutWeddingBundle\Pager\View;
|
namespace Sikofitt\DoughnutWeddingBundle\Pager\View;
|
||||||
|
|
||||||
use Pagerfanta\View\Template\Template;
|
use Pagerfanta\View\Template\Template;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
class UIkitTemplate extends Template
|
class UIkitTemplate extends Template
|
||||||
{
|
{
|
||||||
|
@ -39,6 +40,14 @@ class UIkitTemplate extends Template
|
||||||
'rel_next' => 'next',
|
'rel_next' => 'next',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private $serviceContainer;
|
||||||
|
|
||||||
|
public function __construct(ContainerInterface $serviceContainer)
|
||||||
|
{
|
||||||
|
$this->serviceContainer = $serviceContainer;
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the container for the pagination.
|
* Renders the container for the pagination.
|
||||||
*
|
*
|
||||||
|
@ -51,6 +60,81 @@ class UIkitTemplate extends Template
|
||||||
return sprintf('<ul class="%s" uk-margin>%s</ul>', static::$defaultOptions['css_container_class'], '%pages%');
|
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.
|
* Renders a given page.
|
||||||
*
|
*
|
||||||
|
@ -60,6 +144,14 @@ class UIkitTemplate extends Template
|
||||||
*/
|
*/
|
||||||
public function page($page)
|
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) {
|
if (1 === (int)$page) {
|
||||||
return '<li><a href="/gallery">' . $page . '</a></li>';
|
return '<li><a href="/gallery">' . $page . '</a></li>';
|
||||||
}
|
}
|
||||||
|
@ -67,6 +159,7 @@ class UIkitTemplate extends Template
|
||||||
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.
|
* Renders a given page with a specified text.
|
||||||
*
|
*
|
||||||
|
@ -99,6 +192,14 @@ class UIkitTemplate extends Template
|
||||||
*/
|
*/
|
||||||
public function previousEnabled($page)
|
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) {
|
if (1 === (int) $page) {
|
||||||
return '<li><a href="/gallery"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
|
return '<li><a href="/gallery"><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>';
|
||||||
}
|
}
|
||||||
|
@ -125,6 +226,14 @@ class UIkitTemplate extends Template
|
||||||
*/
|
*/
|
||||||
public function nextEnabled($page)
|
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>';
|
return '<li class=""><a href="/gallery/page/'.$page.'">Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,11 @@
|
||||||
<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>
|
<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 %}
|
{% if images is not null and images is not empty %}
|
||||||
{% for image in images %}
|
{% 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') %}
|
{% set imageUrl = bucket ~ '/gallery/' ~ vich_uploader_asset(image, 'imageFile')|trim('/', 'left') %}
|
||||||
|
{% endif %}
|
||||||
<div class=" uk-height-small uk-overflow-hidden uk-cover-container">
|
<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>
|
<a class="uk-inline-clip uk-background-cover" style="background-image:url({{ imageUrl }})" href="#modal-full-{{ image.id }}" uk-cover uk-toggle></a>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue