mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
[IMPR] Openning Hours
This commit is contained in:
parent
25cdb138a8
commit
66aa60a76a
@ -63,7 +63,7 @@ class OpenningHoursExtension extends DataExtension
|
|||||||
{
|
{
|
||||||
$tab = $fields->findOrMakeTab('Root.OpeningHours');
|
$tab = $fields->findOrMakeTab('Root.OpeningHours');
|
||||||
|
|
||||||
if(!$this->owner->exists()) {
|
if (!$this->owner->exists()) {
|
||||||
$tab->push(LiteralField::create(
|
$tab->push(LiteralField::create(
|
||||||
'OpeningHoursNotice',
|
'OpeningHoursNotice',
|
||||||
'<p class="message notice">The object must be saved before opening hours can be added</p>'
|
'<p class="message notice">The object must be saved before opening hours can be added</p>'
|
||||||
@ -84,12 +84,12 @@ class OpenningHoursExtension extends DataExtension
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$tab->setChildren(FieldList::create(
|
$tab->setChildren(FieldList::create(
|
||||||
HeaderField::create('OpeningHours','Opening Hours'),
|
HeaderField::create('OpeningHours', 'Opening Hours'),
|
||||||
LiteralField::create(
|
LiteralField::create(
|
||||||
'CurrentOpeningHour',
|
'CurrentOpeningHour',
|
||||||
'<b>Today:</b>'
|
'<b>Today:</b>'
|
||||||
.'<p class="message notice">'
|
.'<p class="message notice">'
|
||||||
.$this->owner->renderWith('App\\Objects\\OpeningHoursList')
|
.$this->owner->renderWith('A2nt\\CMSNiceties\\Objects\\OpeningHoursList')
|
||||||
.'</p>'
|
.'</p>'
|
||||||
),
|
),
|
||||||
CheckboxField::create('ShowOpeningHours'),
|
CheckboxField::create('ShowOpeningHours'),
|
||||||
@ -98,7 +98,7 @@ class OpenningHoursExtension extends DataExtension
|
|||||||
'Opening Hours Page',
|
'Opening Hours Page',
|
||||||
SiteTree::get()->map()->toArray()
|
SiteTree::get()->map()->toArray()
|
||||||
),
|
),
|
||||||
/*TextareaField::create('OpenningHoursNote'),
|
TextareaField::create('OpenningHoursNoteText'),
|
||||||
LiteralField::create(
|
LiteralField::create(
|
||||||
'OpeningHoursNote',
|
'OpeningHoursNote',
|
||||||
'<p><b>Please, specify time ranges. For example:</b><br/>'
|
'<p><b>Please, specify time ranges. For example:</b><br/>'
|
||||||
@ -110,7 +110,7 @@ class OpenningHoursExtension extends DataExtension
|
|||||||
.'<b>Short day example durring holidays:</b><br/>'
|
.'<b>Short day example durring holidays:</b><br/>'
|
||||||
.'Monday 12:00 AM - 2:00 PM 12/31/2018 - 01/06/2019'
|
.'Monday 12:00 AM - 2:00 PM 12/31/2018 - 01/06/2019'
|
||||||
.'</p>'
|
.'</p>'
|
||||||
),*/
|
),
|
||||||
GridField::create(
|
GridField::create(
|
||||||
'OpeningHours',
|
'OpeningHours',
|
||||||
'Opening Hours',
|
'Opening Hours',
|
||||||
|
1
templates/A2nt/CMSNiceties/Models/OpeningHour.ss
Executable file
1
templates/A2nt/CMSNiceties/Models/OpeningHour.ss
Executable file
@ -0,0 +1 @@
|
|||||||
|
<b>$Day:</b> $From.Nice - $Till.Nice
|
7
templates/A2nt/CMSNiceties/Objects/OpeningHoursList.ss
Executable file
7
templates/A2nt/CMSNiceties/Objects/OpeningHoursList.ss
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
<% if $OpeningHoursToday %>
|
||||||
|
<% loop $OpeningHoursToday %>
|
||||||
|
$forTemplate<br/>
|
||||||
|
<% end_loop %>
|
||||||
|
<% else %>
|
||||||
|
<b class="hours hous-closed">Closed</b>
|
||||||
|
<% end_if %>
|
Loading…
Reference in New Issue
Block a user