Permalink
Browse files

Update events feature and add full schedule CRUD

  • Loading branch information...
themightychris committed Apr 11, 2018
1 parent c899763 commit 26aa7aac5764c0cbe816a45adfd258232e979ef2
@@ -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"}&nbsp;{_ "Edit Event&hellip;"}</button>
</form>
<a class="btn btn-success" href="{$Event->getUrl(edit)}">{glyph "pencil"}&nbsp;{_ "Edit Event"}</a>
<a class="btn btn-success" href="{$Event->getUrl('segments/*create')}">{glyph "plus"}&nbsp;{_ "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}
@@ -54,16 +54,20 @@
</select>
</div>
<div class="form-group">
<label for="field-time-start">{_ "StartTime"}:</label>
<input type="date" name="StartTime" id="field-time-start" class="form-control" value="{refill field=StartTime default=$Event->StartTime}"/>
<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($Event->StartTime, date('Y-m-d\TH:i', $Event->StartTime))}"/>
</div>
<div class="form-group">
<label for="field-time-end">{_ "EndTime"}:</label>
<input type="date" name="EndTime" id="field-time-end" class="form-control" value="{refill field=EndTime default=$Event->EndTime}"/>
<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($Event->EndTime, date('Y-m-d\TH:i', $Event->EndTime))}"/>
</div>
<div class="form-group">
<label for="field-location">{_ "Location"}:</label>
<input type="text" name="Location" id="field-location" class="form-control" placeholder="908 N 3rd St, Philadelphia PA" value="{refill field=Location default=$Event->Location}"/>
<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=$Event->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=$Event->LocationAddress}"/>
</div>
<div class="form-group">
@@ -8,7 +8,7 @@
{capture assign=eventLink}<a href="{$Event->getUrl()|escape}">{$Event->getTitle()|escape}</a>{/capture}
<div class="page-header">
<h1>Event Created</h1>
<h1>Event Saved</h1>
</div>
{if $Event->isNew}
<p>{_("Your event has been created: %s")|sprintf:$eventLink}</p>
@@ -0,0 +1,63 @@
{extends "designs/site.tpl"}
{block title}{$data->Title|escape} @ {$data->Event->Title|escape} &mdash; {$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"}&nbsp;{_ "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}
@@ -0,0 +1,85 @@
{extends designs/site.tpl}
{block title}{if $data->isPhantom}{_ 'Create'}{else}{_('Edit %s')|sprintf:$data->Title|escape}{/if} &mdash; {_ 'Events'} &mdash; {$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 &mdash; 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.

0 comments on commit 26aa7aa

Please sign in to comment.