Skip to content

Commit

Permalink
feature Sylius#60 Update demo + add version switcher (pamil, bartoszp…
Browse files Browse the repository at this point in the history
…ietrzak1994)

This PR was merged into the 1.3 branch.

Discussion
----------

![screenshot 2019-01-30 at 16 02 14](https://user-images.githubusercontent.com/1897953/51990024-76568c80-24a8-11e9-9a96-28a92ec1bfd3.png)
![screenshot 2019-01-30 at 16 02 22](https://user-images.githubusercontent.com/1897953/51990025-76568c80-24a8-11e9-9f9e-aea9d7fca51f.png)


Commits
-------

0f0cd1f Update demo + add version switcher
0daa637 Missing .gitignore file in image directory
5c9f101 Missing test routing
  • Loading branch information
Zales0123 committed Jan 31, 2019
2 parents 7d62f0a + 5c9f101 commit 1da9699
Show file tree
Hide file tree
Showing 14 changed files with 1,411 additions and 902 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,6 +6,7 @@
/public/css
/public/js
/public/media
!/public/media/image/.gitignore

/vendor
/node_modules
Expand Down
1,591 changes: 959 additions & 632 deletions composer.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions config/bundles.php
Expand Up @@ -58,4 +58,5 @@
Sonata\DatagridBundle\SonataDatagridBundle::class => ['all' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true],
Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true],
];
5 changes: 5 additions & 0 deletions config/routes/test/routing.yaml
@@ -0,0 +1,5 @@
sylius_test_plugin_main:
path: /test/main
controller: FrameworkBundle:Template:template
defaults:
template: "@SyliusTestPlugin/main.html.twig"
5 changes: 5 additions & 0 deletions config/routes/test_cached/routing.yaml
@@ -0,0 +1,5 @@
sylius_test_plugin_main:
path: /test/main
controller: FrameworkBundle:Template:template
defaults:
template: "@SyliusTestPlugin/main.html.twig"
Empty file added public/media/image/.gitignore
Empty file.
12 changes: 12 additions & 0 deletions symfony.lock
Expand Up @@ -410,6 +410,9 @@
"psr/simple-cache": {
"version": "1.0.1"
},
"ralouphie/getallheaders": {
"version": "2.0.5"
},
"ramsey/uuid": {
"version": "3.8.0"
},
Expand Down Expand Up @@ -479,6 +482,9 @@
"sonata-project/datagrid-bundle": {
"version": "2.3.1"
},
"sonata-project/doctrine-extensions": {
"version": "1.1.5"
},
"sonata-project/intl-bundle": {
"version": "2.5.0"
},
Expand Down Expand Up @@ -539,6 +545,9 @@
"ref": "e3868d2f4a5104f19f844fe551099a00c6562527"
}
},
"symfony/contracts": {
"version": "v1.0.2"
},
"symfony/css-selector": {
"version": "v3.4.16"
},
Expand Down Expand Up @@ -722,6 +731,9 @@
"symfony/var-dumper": {
"version": "v4.1.5"
},
"symfony/var-exporter": {
"version": "v4.2.2"
},
"symfony/web-profiler-bundle": {
"version": "3.3",
"recipe": {
Expand Down
50 changes: 50 additions & 0 deletions templates/_version_switcher.html.twig
@@ -0,0 +1,50 @@
{% set is_stable = 'DEV' not in sylius_meta.version %}
{% set version_descriptor = ' (v' ~ sylius_meta.version ~ ')' %}

<style>
.version-switch {
position: fixed;
bottom: 0;
right: 30px;
display: flex;
align-items: center;
background: #333;
padding: 10px 10px;
border-radius: 5px 5px 0 0;
color: #fff;
z-index: 9999;
}
.version-switch label {
display: inline-block;
padding: 0 10px;
font-size: 13px;
color: #999;
}
.version-switch select {
display: inline-block;
height: 30px;
border: 1px solid #5a5a5a;
background: #333;
color: #fff;
font-size: 13px;
}
</style>

<div class="version-switch">
<label for="version-switch">Sylius version:</label>
{# Remove "disabled" when the second demo is published #}
<select id="version-switch" disabled>
<option value="//demo.sylius.com"{% if is_stable %} selected{% endif %}>stable{{ is_stable ? version_descriptor : '' }}</option>
<option value="//master.demo.sylius.com"{% if not is_stable %} selected{% endif %}>master{{ is_stable ? '' : version_descriptor }}</option>
</select>
</div>

<script type="text/javascript">
const versionSelect = document.getElementById('version-switch');
versionSelect.addEventListener('change', (e) => {
window.location.href = e.target.value;
});
</script>
84 changes: 84 additions & 0 deletions templates/bundles/SyliusShopBundle/layout.html.twig
@@ -0,0 +1,84 @@
<!DOCTYPE html>

<html lang="{{ app.request.locale|slice(0, 2) }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>{% block title %}Sylius{% endblock %}</title>

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

{% block metatags %}
{% endblock %}

{% block stylesheets %}
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/shop/css/style.css'} %}

{{ sonata_block_render_event('sylius.shop.layout.stylesheets') }}
{% endblock %}

{{ sonata_block_render_event('sylius.shop.layout.head') }}
</head>

<body class="pushable">
{{ sonata_block_render_event('sylius.shop.layout.before_body') }}
<div class="pusher">
{% block top %}
<div id="menu" class="ui large sticky inverted stackable menu">
{{ sonata_block_render_event('sylius.shop.layout.before_currency_switcher') }}

{{ render(controller('sylius.controller.shop.currency_switch:renderAction')) }}
{{ render(controller('sylius.controller.shop.locale_switch:renderAction')) }}

{{ sonata_block_render_event('sylius.shop.layout.before_security_widget') }}

{{ render(controller('sylius.controller.shop.security_widget:renderAction')) }}

{{ sonata_block_render_event('sylius.shop.layout.after_security_widget') }}
</div>
{% endblock %}

<div class="ui container">
{% block header %}
<header>
{% include '@SyliusShop/_header.html.twig' %}

{{ sonata_block_render_event('sylius.shop.layout.after_header') }}

{{ render(url('sylius_shop_partial_taxon_index_by_code', {'code': 'category', 'template': '@SyliusShop/Taxon/_horizontalMenu.html.twig'})) }}
</header>
{% endblock %}

{% include '@SyliusShop/_flashes.html.twig' %}

{{ sonata_block_render_event('sylius.shop.layout.before_content') }}

{% block content %}
{% endblock %}

{{ sonata_block_render_event('sylius.shop.layout.after_content') }}
</div>

{% block footer %}
{% include '@SyliusShop/_footer.html.twig' %}

{% include '/_version_switcher.html.twig' %}
{% endblock %}
</div>

{% block javascripts %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/shop/js/app.js'} %}

{{ sonata_block_render_event('sylius.shop.layout.javascripts') }}
{% endblock %}

{% include '@SyliusUi/Modal/_confirmation.html.twig' %}
{{ sonata_block_render_event('sylius.shop.layout.after_body') }}
</body>
</html>
58 changes: 58 additions & 0 deletions templates/bundles/SyliusUiBundle/Layout/sidebar.html.twig
@@ -0,0 +1,58 @@
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>{% block title %}Sylius{% endblock %}</title>

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

{% block metatags %}
{% endblock %}

{% block stylesheets %}
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
{% endblock %}
</head>

<body class="pushable">
<div class="ui sidebar vertical inverted menu visible left" id="sidebar">
{% block sidebar %}
{% endblock %}
</div>
<div class="ui fixed inverted menu">
{% block topbar %}
{% endblock %}
</div>
<div class="pusher">
<div class="full height" id="wrapper">
<div id="content">
{% block flash_messages %}
{% include '@SyliusUi/_flashes.html.twig' %}
{% endblock %}

{% block pre_content %}
{% endblock %}

{% block content %}
{% endblock %}

{% block post_content %}
{% endblock %}
</div>
</div>
</div>

{% include '/_version_switcher.html.twig' %}

{% include '@SyliusUi/Modal/_confirmation.html.twig' %}

{% block javascripts %}
{% endblock %}
</body>
</html>

0 comments on commit 1da9699

Please sign in to comment.