forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Sylius#67 from TheMadeleine/category-grid
[CJMAX-42] Homepage Categories Grid
- Loading branch information
Showing
30 changed files
with
564 additions
and
164 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
app/Resources/SyliusWebBundle/views/Frontend/Category/_categoriesList.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="col-md-3 col-sm-4"> | ||
<div class="grid-item gi-list"> | ||
{{ sonata_block_render({'name': '/cms/blocks/categoriesList'}) }} | ||
</div> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
app/Resources/SyliusWebBundle/views/Frontend/Category/_categoryGrid.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="same-height-row row grid-items gi-categories"> | ||
{% for categoryGridItem in categoryGridItems %} | ||
{{ include('@SyliusWeb/Frontend/Category/_categoryGridItem.html.twig') }} | ||
{% if 3 == loop.index %} | ||
{{ include('@SyliusWeb/Frontend/Category/_categoriesList.html.twig') }} | ||
{% endif %} | ||
{% endfor %} | ||
</div> |
25 changes: 25 additions & 0 deletions
25
app/Resources/SyliusWebBundle/views/Frontend/Category/_categoryGridItem.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% set category = categoryGridItem.category %} | ||
{% if categoryGridItem.path is not empty %} | ||
{% set itemImagePath = categoryGridItem.path|imagine_filter('sylius_large') %} | ||
{% else %} | ||
{% set itemImagePath = category.path ? category.path|imagine_filter('sylius_large') : 'http://placehold.it/400x400' %} | ||
{% endif %} | ||
|
||
<div class="col-md-3 col-sm-4"> | ||
<div class="grid-item gi-category"> | ||
<div class="image same-height"> | ||
<a href="{{ path(category) }}"> | ||
<img src="{{ itemImagePath }}" alt="" class="img-responsive image1"> | ||
</a> | ||
</div> | ||
<!-- /.image --> | ||
<div class="text"> | ||
<h3> | ||
<a href="{{ path(category) }}"> | ||
{{ categoryGridItem.title ? categoryGridItem.title : category.name }} | ||
</a> | ||
</h3> | ||
</div> | ||
<!-- /.text --> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 0 additions & 160 deletions
160
app/Resources/SyliusWebBundle/views/Frontend/Product/categories.html.twig
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{ form_errors(form) }} | ||
<div class="two field"> | ||
{{ form_row(form.title) }} | ||
{{ form_row(form.position) }} | ||
{{ form_row(form.category) }} | ||
{{ form_row(form.enabled) }} | ||
{{ form_row(form.file) }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
sylius_grid: | ||
grids: | ||
app_admin_category_grid_item: | ||
driver: | ||
name: doctrine/orm | ||
options: | ||
class: %app.model.category_grid_item.class% | ||
sorting: | ||
position: asc | ||
fields: | ||
title: | ||
type: string | ||
label: app.ui.title | ||
position: | ||
type: string | ||
label: app.ui.position | ||
category: | ||
type: string | ||
label: app.ui.category_name | ||
enabled: | ||
type: twig | ||
label: sylius.ui.enabled | ||
options: | ||
template: SyliusAdminBundle:Grid/Field:enabled.html.twig | ||
actions: | ||
main: | ||
create: | ||
type: create | ||
item: | ||
update: | ||
type: update | ||
delete: | ||
type: delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
imports: | ||
- { resource: 'admin/carousel_item.yml' } | ||
- { resource: 'admin/category_grid_item.yml' } | ||
- { resource: 'admin/product_grid_item.yml' } | ||
- { resource: 'shop/product.yml' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
sylius_admin_carousel_item: | ||
resource: 'carousel_item.yml' | ||
|
||
sylius_admin_category_grid_item: | ||
resource: 'category_grid_item.yml' | ||
|
||
sylius_admin_product_grid_item: | ||
resource: 'product_grid_item.yml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
app_admin_category_grid_item: | ||
resource: | | ||
alias: app.category_grid_item | ||
section: admin | ||
templates: SyliusAdminBundle:Crud | ||
except: ['show'] | ||
grid: app_admin_category_grid_item | ||
vars: | ||
all: | ||
subheader: app.ui.category_grid_items | ||
templates: | ||
form: :CategoryGridItem:_form.html.twig | ||
index: | ||
icon: 'square outline' | ||
type: sylius.resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\Migrations; | ||
|
||
use Doctrine\DBAL\Migrations\AbstractMigration; | ||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
class Version20160429094836 extends AbstractMigration | ||
{ | ||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function up(Schema $schema) | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | ||
|
||
$this->addSql('CREATE TABLE category_grid_item (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, path VARCHAR(255) DEFAULT NULL, INDEX IDX_FE495A7C12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); | ||
$this->addSql('ALTER TABLE category_grid_item ADD CONSTRAINT FK_FE495A7C12469DE2 FOREIGN KEY (category_id) REFERENCES sylius_taxon (id)'); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
*/ | ||
public function down(Schema $schema) | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | ||
|
||
$this->addSql('DROP TABLE category_grid_item'); | ||
} | ||
} |
Oops, something went wrong.