Skip to content

Commit 4c3400a

Browse files
authored
Merge pull request #358 from BartoszWojdalowicz/fix/publishAt
fix publish at
2 parents c3a4d02 + ce17ccd commit 4c3400a

6 files changed

Lines changed: 50 additions & 34 deletions

File tree

src/Resources/config/doctrine/Page.orm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BitBag\SyliusCmsPlugin\Entity\Page:
3232
on: update
3333
publishAt:
3434
column: publish_at
35-
type: date_immutable
35+
type: datetime_immutable
3636
nullable: true
3737

3838
manyToMany:

src/Resources/translations/messages.en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ bitbag_sylius_cms_plugin:
5757
form_was_submitted_with_errors: "The form was submitted with following errors:"
5858
title: Title
5959
empty_name: Empty name
60+
publish_at: Publish at
61+
page_will_be_publish_at: This page will be publish at

src/Resources/translations/messages.pl.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ bitbag_sylius_cms_plugin:
3636
position: Pozycja
3737
title: Tytuł
3838
empty_name: Brak nazwy
39+
publish_at: Opublikuj
40+
page_will_be_publish_at: Strona zostanie opublikowana

src/Resources/views/Page/Crud/_form.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
{{ form_row(form.products) }}
1414
{{ form_row(form.sections) }}
1515
{{ form_row(form.channels) }}
16+
{{ form_row(form.publishAt) }}
1617

1718
<a href="#" class="ui labeled button icon primary bitbag-cms-resource-preview" data-url="{{ path('bitbag_sylius_cms_plugin_admin_page_preview', {'id': form.vars.data.id}) }}">
1819
<i class="eye icon"></i>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1 class="ui header">
2+
{{ 'bitbag_sylius_cms_plugin.ui.page_will_be_publish_at'|trans }} : {{ publishAt|date('Y/m/d H:i') }}
3+
</h1>
Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,61 @@
11
{% extends '@SyliusShop/layout.html.twig' %}
22

3+
{% set published = (page.publishAt is not null and page.publishAt|date("Y-m-d H:i:s") < "now"|date("Y-m-d H:i:s") or page.publishAt is null) %}
4+
35
{%- block title -%}
4-
{% if page.title is not empty %}
6+
{% if page.title is not empty and published == true %}
57
{{ page.title }}
68
{% else %}
79
{{ parent() }}
810
{% endif %}
911
{%- endblock -%}
1012

1113
{% block metatags %}
12-
{% if page.metaKeywords is not empty %}
13-
<meta name="keywords" content="{{ page.metaKeywords }}"/>
14-
{% endif %}
15-
{% if page.metaDescription is not empty %}
16-
<meta name="description" content="{{ page.metaDescription }}"/>
14+
{% if published == true %}
15+
{% if page.metaKeywords is not empty %}
16+
<meta name="keywords" content="{{ page.metaKeywords }}"/>
17+
{% endif %}
18+
{% if page.metaDescription is not empty %}
19+
<meta name="description" content="{{ page.metaDescription }}"/>
20+
{% endif %}
1721
{% endif %}
1822
{% endblock %}
19-
2023
{% block content %}
21-
<div class="ui breadcrumb">
22-
<a href="{{ path('sylius_shop_homepage') }}" class="section">{{ 'sylius.ui.home'|trans }}</a>
23-
<div class="divider"> /</div>
24-
<div class="active section">{{ page.breadcrumb }}</div>
25-
</div>
26-
<div class="ui segment">
27-
<h1 class="ui dividing header bitbag-page-name">{{ page.name }}</h1>
24+
{% if published == true %}
25+
<div class="ui breadcrumb">
26+
<a href="{{ path('sylius_shop_homepage') }}" class="section">{{ 'sylius.ui.home'|trans }}</a>
27+
<div class="divider"> /</div>
28+
<div class="active section">{{ page.breadcrumb }}</div>
29+
</div>
30+
<div class="ui segment">
31+
<h1 class="ui dividing header bitbag-page-name">{{ page.name }}</h1>
2832

29-
<div class="ui grid center aligned">
30-
<div class="eight wide column">
31-
{% if page.image %}
32-
<img class="page-image ui fluid image" src="{{ page.image.path }}" alt="">
33-
{% endif %}
33+
<div class="ui grid center aligned">
34+
<div class="eight wide column">
35+
{% if page.image %}
36+
<img class="page-image ui fluid image" src="{{ page.image.path }}" alt="">
37+
{% endif %}
38+
</div>
3439
</div>
35-
</div>
3640

37-
<div class="ui hidden divider"></div>
41+
<div class="ui hidden divider"></div>
3842

39-
<div class="bitbag-page-content">{{ bitbag_cms_render_content(page) }}</div>
40-
<div class="ui dividing header"></div>
41-
<div class="bitbag-page-sections">
42-
{% include '@BitBagSyliusCmsPlugin/Shop/Page/Show/_sections.html.twig' %}
43-
</div>
44-
</div>
45-
{% if page.products|length > 0 %}
46-
<h2>
47-
{{ 'bitbag_sylius_cms_plugin.ui.page_related_products'|trans }}
48-
</h2>
49-
<div class="bitbag-page-products">
50-
{% include '@SyliusShop/Product/_horizontalList.html.twig' with {'products': page.products} %}
43+
<div class="bitbag-page-content">{{ bitbag_cms_render_content(page) }}</div>
44+
<div class="ui dividing header"></div>
45+
<div class="bitbag-page-sections">
46+
{% include '@BitBagSyliusCmsPlugin/Shop/Page/Show/_sections.html.twig' %}
47+
</div>
5148
</div>
49+
{% if page.products|length > 0 %}
50+
<h2>
51+
{{ 'bitbag_sylius_cms_plugin.ui.page_related_products'|trans }}
52+
</h2>
53+
<div class="bitbag-page-products">
54+
{% include '@SyliusShop/Product/_horizontalList.html.twig' with {'products': page.products} %}
55+
</div>
56+
{% endif %}
57+
{% else %}
58+
{% include '@BitBagSyliusCmsPlugin/Shop/Page/Error/_notPublished.html.twig' with {'publishAt': page.publishAt} %}
5259
{% endif %}
60+
5361
{% endblock %}

0 commit comments

Comments
 (0)