-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update events feature and add full schedule CRUD
- Loading branch information
1 parent
c899763
commit 26aa7aa
Showing
11 changed files
with
374 additions
and
88 deletions.
There are no files selected for viewing
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,107 +1,130 @@ | ||
{extends "designs/site.tpl"} | ||
|
||
{block title}{_ 'Event'} — {$dwoo.parent}{/block} | ||
{block title}{$data->Title|escape} — {$dwoo.parent}{/block} | ||
|
||
{block css} | ||
{$dwoo.parent} | ||
|
||
<style> | ||
.event-description p:last-child { | ||
margin-bottom: 0; | ||
} | ||
.event-details dt { | ||
font-size: 130%; | ||
} | ||
.event-details dd { | ||
margin-bottom: 1em; | ||
} | ||
.event-segments h4 { | ||
margin-top: 0; | ||
} | ||
.event-segments dl { | ||
margin-bottom: 0; | ||
} | ||
.event-segments dd { | ||
margin-bottom: 0.5em; | ||
} | ||
.event-segments .event-location { | ||
display: block; | ||
margin-top: 1em; | ||
margin-bottom: 1em; | ||
} | ||
.event-segments .event-location dt { | ||
font-size: 200%; | ||
} | ||
</style> | ||
{/block} | ||
|
||
{block content} | ||
{$Event = $data} | ||
{load_templates "subtemplates.tpl"} | ||
|
||
<div class="page-header"> | ||
{* | ||
<ol class="breadcrumb"> | ||
<li><a href="/events">{_ "Events"}</a></li> | ||
<li><a href="{$Event->getUrl()}">{$Event->Title|escape}</a></li> | ||
<li>{tif $Event->EndTime > $.now ? 'Upcoming' : 'Past'}</li> | ||
</ol> | ||
*} | ||
<div class="btn-toolbar pull-right"> | ||
{if $.User} | ||
<form action="{$Event->getUrl(edit)}"> | ||
<button class="btn btn-success" type="submit">{glyph "pencil"} {_ "Edit Event…"}</button> | ||
</form> | ||
<a class="btn btn-success" href="{$Event->getUrl(edit)}">{glyph "pencil"} {_ "Edit Event"}</a> | ||
<a class="btn btn-success" href="{$Event->getUrl('segments/*create')}">{glyph "plus"} {_ "Add Segment"}</a> | ||
{/if} | ||
</div> | ||
<h1>{$Event->Title|escape}</h1> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-3"> | ||
<ul class="row list-unstyled"> | ||
{if $Event->Status != 'published'} | ||
<li class="col-sm-3 col-md-12"> | ||
<p> | ||
<b>Status</b><br/> | ||
{$Event->Status} | ||
</p> | ||
</li> | ||
{/if} | ||
|
||
<li class="col-sm-3 col-md-12"> | ||
<p> | ||
<b>Start time</b><br/> | ||
{timestamp $Event->StartTime time=yes} | ||
</p> | ||
</li> | ||
|
||
{if $Event->EndTime} | ||
<li class="col-sm-3 col-md-12"> | ||
<p> | ||
<b>End time</b><br/> | ||
{timestamp $Event->EndTime time=yes} | ||
</p> | ||
</li> | ||
{/if} | ||
|
||
{if $Event->Location} | ||
<li class="col-sm-3 col-md-12"> | ||
<p> | ||
<b>Location</b><br/> | ||
<a href="https://www.google.com/maps?q={$Event->Location|escape:url}">{$Event->Location|escape}</a> | ||
</p> | ||
</li> | ||
{/if} | ||
</ul> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-9"> | ||
{if $Event->Description} | ||
<div class="well"> | ||
<div class="content-markdown event-description">{$Event->Description|truncate:600|escape|markdown}</div> | ||
</div> | ||
<div class="content-markdown event-description well">{$Event->Description|escape|markdown}</div> | ||
{/if} | ||
|
||
{if $Event->Segments} | ||
<h2>Segments</h2> | ||
<section class="event-segments"> | ||
<h2>Schedule</h2> | ||
|
||
{$lastDate = null} | ||
{$lastDate = null} | ||
{$lastLocationName = null} | ||
{$lastLocationAddress = null} | ||
|
||
{foreach item=Segment from=$Event->Segments} | ||
{$thisDate = date("l, F jS", $Segment->StartTime)} | ||
{foreach item=Segment from=$Event->Segments} | ||
{$thisDate = date("l, F jS", $Segment->StartTime)} | ||
|
||
{if $lastDate != $thisDate} | ||
{if $lastDate} | ||
</dl> | ||
{if $lastDate != $thisDate} | ||
{if $lastDate} | ||
</dl> | ||
{/if} | ||
<h3>{$thisDate}</h3> | ||
<dl class="dl-horizontal"> | ||
{$lastDate = $thisDate} | ||
{$lastLocationName = null} | ||
{$lastLocationAddress = null} | ||
{/if} | ||
<h3>{$thisDate}</h3> | ||
<dl class="dl-horizontal"> | ||
{$lastDate = $thisDate} | ||
{/if} | ||
<dt>{time_range $Segment->StartTime $Segment->EndTime}</dt> | ||
<dd> | ||
<a href="{$Event->getUrl("segments/$Segment->Handle")}">{$Segment->Title|escape}</a> | ||
{if $Segment->LocationName || $Segment->LocationAddress} | ||
<p> | ||
<strong>Location</strong> | ||
<a target="_blank" href="https://maps.google.com?q={implode(', ', array_filter(array($Segment->LocationName, $Segment->LocationAddress)))|escape:url}"> | ||
{if $Segment->LocationName && $Segment->LocationAddress} | ||
{$Segment->LocationName|escape} ({$Segment->LocationAddress|escape}) | ||
{else} | ||
{$Segment->LocationName|default:$Segment->LocationAddress|escape} | ||
{/if} | ||
</a> | ||
</p> | ||
{if | ||
( | ||
$Segment->LocationName != $lastLocationName | ||
|| $Segment->LocationAddress != $lastLocationAddress | ||
) | ||
&& ($Segment->LocationName || $Segment->LocationAddress) | ||
} | ||
<div class="event-location"> | ||
<dt>{icon "map-marker"}</dt> | ||
<dd>{eventLocation name=$Segment->LocationName address=$Segment->LocationAddress}</dd> | ||
</div> | ||
{/if} | ||
<div class="content-markdown event-segment-description">{$Segment->Description|escape|markdown}</div> | ||
</dd> | ||
{/foreach} | ||
<dt>{time_range $Segment->StartTime $Segment->EndTime}</dt> | ||
<dd> | ||
<h4><a href="{$Segment->getUrl()}">{$Segment->Title|escape}</a></h4> | ||
<div class="content-markdown event-segment-description">{$Segment->Description|escape|markdown}</div> | ||
</dd> | ||
|
||
{$lastLocationName = $Segment->LocationName} | ||
{$lastLocationAddress = $Segment->LocationAddress} | ||
{/foreach} | ||
</foreach> | ||
{/if} | ||
</div> | ||
|
||
<dl class="event-details col-md-3"> | ||
{if $Event->Status != 'published'} | ||
<dt>Status</dt> | ||
<dd>{$Event->Status}</dd> | ||
{/if} | ||
|
||
<dt>Starts</dt> | ||
<dd>{timestamp $Event->StartTime time='auto'}</dd> | ||
|
||
{if $Event->EndTime} | ||
<dt>Ends</dt> | ||
<dd>{timestamp $Event->EndTime time='auto'}</dd> | ||
{/if} | ||
|
||
{if $Event->LocationName || $Event->LocationAddress} | ||
<dt>Location</dt> | ||
<dd>{eventLocation name=$Event->LocationName address=$Event->LocationAddress}</dd> | ||
{/if} | ||
</dl> | ||
</div> | ||
{/block} |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{extends "designs/site.tpl"} | ||
|
||
{block title}{$data->Title|escape} @ {$data->Event->Title|escape} — {$dwoo.parent}{/block} | ||
|
||
{block css} | ||
{$dwoo.parent} | ||
|
||
<style> | ||
.event-segment-description p:last-child { | ||
margin-bottom: 0; | ||
} | ||
.event-segment-details dt { | ||
font-size: 130%; | ||
} | ||
.event-segment-details dd { | ||
margin-bottom: 1em; | ||
} | ||
</style> | ||
{/block} | ||
|
||
{block content} | ||
{$Segment = $data} | ||
{$Event = $Segment->Event} | ||
{load_templates "subtemplates.tpl"} | ||
|
||
<div class="page-header"> | ||
<ol class="breadcrumb"> | ||
<li><a href="/events">{_ "Events"}</a></li> | ||
<li><a href="{$Event->getUrl()}">{$Event->Title|escape}</a></li> | ||
<li>Schedule</li> | ||
</ol> | ||
<div class="btn-toolbar pull-right"> | ||
{if $.User} | ||
<a class="btn btn-success" href="{$Segment->getUrl(edit)}">{glyph "pencil"} {_ "Edit Segment"}</a> | ||
{/if} | ||
</div> | ||
<h1>{$Segment->Title|escape}</h1> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-9"> | ||
{if $Segment->Description} | ||
<div class="content-markdown event-segment-description well">{$Segment->Description|escape|markdown}</div> | ||
{/if} | ||
</div> | ||
|
||
<dl class="event-segment-details col-md-3"> | ||
<dt>Starts</dt> | ||
<dd>{timestamp $Segment->StartTime time='auto'}</dd> | ||
|
||
{if $Segment->EndTime} | ||
<dt>Ends</dt> | ||
<dd>{timestamp $Segment->EndTime time='auto'}</dd> | ||
{/if} | ||
|
||
{if $Segment->LocationName || $Segment->LocationAddress} | ||
<dt>Location</dt> | ||
<dd>{eventLocation name=$Segment->LocationName address=$Segment->LocationAddress}</dd> | ||
{/if} | ||
</dl> | ||
</div> | ||
{/block} |
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,85 @@ | ||
{extends designs/site.tpl} | ||
|
||
{block title}{if $data->isPhantom}{_ 'Create'}{else}{_('Edit %s')|sprintf:$data->Title|escape}{/if} — {_ 'Events'} — {$dwoo.parent}{/block} | ||
|
||
{block js-bottom} | ||
{$dwoo.parent} | ||
{jsmin "epiceditor.js"} | ||
{jsmin "pages/event-edit.js"} | ||
{/block} | ||
|
||
{block content} | ||
{$Segment = $data} | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3"> | ||
<div class="page-header"> | ||
<h1> | ||
{if $Segment->isPhantom} | ||
{_ "Create new event segment"} | ||
{else} | ||
{_("Edit event segment %s")|sprintf:$Segment->Title|escape} | ||
{/if} | ||
</h1> | ||
</div> | ||
|
||
{if !$Segment->isValid} | ||
<div class="error well"> | ||
<strong>{_ "There were problems with your entry:"}</strong> | ||
<ul class="errors"> | ||
{foreach item=error key=field from=$Segment->validationErrors} | ||
<li>{$error}</li> | ||
{/foreach} | ||
</ul> | ||
</div> | ||
{/if} | ||
|
||
<form method="POST"> | ||
<div class="form-group"> | ||
<label for="field-event">{_ "Event"}:</label> | ||
<select name="EventID" id="field-event" class="form-control"> | ||
{foreach item=Event from=Emergence\Events\Event::getAll(array(Order=StartTime))} | ||
<option value="{$Event->ID}" {refill field=EventID default=$Segment->EventID selected=$Event->ID}>{date('Y-m-d', $Event->StartTime)}: {$Event->Title|escape}</option> | ||
{/foreach} | ||
</select> | ||
</div> | ||
<div class="form-group"> | ||
<label for="field-title">{_ "Title"}:</label> | ||
<input name="Title" id="field-title" class="form-control" placeholder="{_ 'Opening Remarks'}" value="{refill field=Title default=$Segment->Title}" /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="field-handle">{_ "Handle"} ({_ "optional"}):</label> | ||
<input name="Handle" id="field-handle" class="form-control" placeholder="{_ 'opening-remarks'}" value="{refill field=Handle default=$Segment->Handle}" /> | ||
<p class="help-block">Must be unique — leave blank to auto-generate</p> | ||
</div> | ||
<div class="form-group"> | ||
<label for="field-time-start">{_ "Start time"}:</label> | ||
<input type="datetime-local" name="StartTime" id="field-time-start" class="form-control" value="{refill field=StartTime default=tif($Segment->StartTime, date('Y-m-d\TH:i', $Segment->StartTime))}"/> | ||
</div> | ||
<div class="form-group"> | ||
<label for="field-time-end">{_ "End time"}:</label> | ||
<input type="datetime-local" name="EndTime" id="field-time-end" class="form-control" value="{refill field=EndTime default=tif($Segment->EndTime, date('Y-m-d\TH:i', $Segment->EndTime))}"/> | ||
</div> | ||
<div class="form-group"> | ||
<label for="field-location-name">{_ "Location name"}:</label> | ||
<input type="text" name="LocationName" id="field-location-name" class="form-control" placeholder="Localhost" value="{refill field=LocationName default=$Segment->LocationName}"/> | ||
</div> | ||
<div class="form-group"> | ||
<label for="field-location-address">{_ "Location address"}:</label> | ||
<input type="text" name="LocationAddress" id="field-location-address" class="form-control" placeholder="908 N 3rd St, Philadelphia PA" value="{refill field=LocationAddress default=$Segment->LocationAddress}"/> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="field-description">{_ 'Description(.md)'}</label> | ||
<div class="controls"> | ||
<textarea name="Description" class="input-block-level" rows="10">{refill field=Description default=$Segment->Description}</textarea> | ||
</div> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary">{if $Segment->isPhantom}{_ 'Create Event Segment'}{else}{_ 'Save Changes'}{/if}</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
{/block} |
Oops, something went wrong.