Skip to content

Commit a28382f

Browse files
Merge pull request #200 from CodeForPhilly/features/event-segments
Event segment editing
2 parents c8763dc + 85bb181 commit a28382f

File tree

12 files changed

+375
-90
lines changed

12 files changed

+375
-90
lines changed

html-templates/designs/site.subtemplates.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
{load_templates subtemplates/forms.tpl}
88
{load_templates subtemplates/projects.tpl}
99
{load_templates subtemplates/buzz.tpl}
10-
{load_templates subtemplates/updates.tpl}
10+
{load_templates subtemplates/updates.tpl}
11+
{load_templates subtemplates/events.tpl}

html-templates/events/event.tpl

Lines changed: 98 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,129 @@
11
{extends "designs/site.tpl"}
22

3-
{block title}{_ 'Event'} — {$dwoo.parent}{/block}
3+
{block title}{$data->Title|escape} — {$dwoo.parent}{/block}
4+
5+
{block css}
6+
{$dwoo.parent}
7+
8+
<style>
9+
.event-description p:last-child {
10+
margin-bottom: 0;
11+
}
12+
13+
.event-details dt {
14+
font-size: 130%;
15+
}
16+
.event-details dd {
17+
margin-bottom: 1em;
18+
}
19+
20+
.event-segments h4 {
21+
margin-top: 0;
22+
}
23+
.event-segments dl {
24+
margin-bottom: 0;
25+
}
26+
.event-segments dd {
27+
margin-bottom: 0.5em;
28+
}
29+
.event-segments .event-location {
30+
display: block;
31+
margin-top: 1em;
32+
margin-bottom: 1em;
33+
}
34+
.event-segments .event-location dt {
35+
font-size: 200%;
36+
}
37+
</style>
38+
{/block}
439

540
{block content}
641
{$Event = $data}
742

843
<div class="page-header">
9-
{*
1044
<ol class="breadcrumb">
1145
<li><a href="/events">{_ "Events"}</a></li>
12-
<li><a href="{$Event->getUrl()}">{$Event->Title|escape}</a></li>
46+
<li>{tif $Event->EndTime > $.now ? 'Upcoming' : 'Past'}</li>
1347
</ol>
14-
*}
1548
<div class="btn-toolbar pull-right">
1649
{if $.User}
17-
<form action="{$Event->getUrl(edit)}">
18-
<button class="btn btn-success" type="submit">{icon "pencil"}&nbsp;{_ "Edit Event&hellip;"}</button>
19-
</form>
50+
<a class="btn btn-success" href="{$Event->getUrl(edit)}">{icon "pencil"}&nbsp;{_ "Edit Event"}</a>
51+
<a class="btn btn-success" href="{$Event->getUrl('segments/*create')}">{icon "plus"}&nbsp;{_ "Add Segment"}</a>
2052
{/if}
2153
</div>
2254
<h1>{$Event->Title|escape}</h1>
2355
</div>
24-
<div class="row">
25-
<div class="col-md-3">
26-
<ul class="row list-unstyled">
27-
{if $Event->Status != 'published'}
28-
<li class="col-sm-3 col-md-12">
29-
<p>
30-
<b>Status</b><br/>
31-
{$Event->Status}
32-
</p>
33-
</li>
34-
{/if}
35-
36-
<li class="col-sm-3 col-md-12">
37-
<p>
38-
<b>Start time</b><br/>
39-
{timestamp $Event->StartTime time=yes}
40-
</p>
41-
</li>
42-
43-
{if $Event->EndTime}
44-
<li class="col-sm-3 col-md-12">
45-
<p>
46-
<b>End time</b><br/>
47-
{timestamp $Event->EndTime time=yes}
48-
</p>
49-
</li>
50-
{/if}
51-
52-
{if $Event->Location}
53-
<li class="col-sm-3 col-md-12">
54-
<p>
55-
<b>Location</b><br/>
56-
<a href="https://www.google.com/maps?q={$Event->Location|escape:url}">{$Event->Location|escape}</a>
57-
</p>
58-
</li>
59-
{/if}
60-
</ul>
61-
</div>
6256

57+
<div class="row">
6358
<div class="col-md-9">
6459
{if $Event->Description}
65-
<div class="well">
66-
<div class="content-markdown event-description">{$Event->Description|truncate:600|escape|markdown}</div>
67-
</div>
60+
<div class="content-markdown event-description well">{$Event->Description|escape|markdown}</div>
6861
{/if}
6962

7063
{if $Event->Segments}
71-
<h2>Segments</h2>
64+
<section class="event-segments">
65+
<h2>Schedule</h2>
7266

73-
{$lastDate = null}
67+
{$lastDate = null}
68+
{$lastLocationName = null}
69+
{$lastLocationAddress = null}
7470

75-
{foreach item=Segment from=$Event->Segments}
76-
{$thisDate = date("l, F jS", $Segment->StartTime)}
71+
{foreach item=Segment from=$Event->Segments}
72+
{$thisDate = date("l, F jS", $Segment->StartTime)}
7773

78-
{if $lastDate != $thisDate}
79-
{if $lastDate}
80-
</dl>
74+
{if $lastDate != $thisDate}
75+
{if $lastDate}
76+
</dl>
77+
{/if}
78+
<h3>{$thisDate}</h3>
79+
<dl class="dl-horizontal">
80+
{$lastDate = $thisDate}
81+
{$lastLocationName = null}
82+
{$lastLocationAddress = null}
8183
{/if}
82-
<h3>{$thisDate}</h3>
83-
<dl class="dl-horizontal">
84-
{$lastDate = $thisDate}
85-
{/if}
86-
<dt>{time_range $Segment->StartTime $Segment->EndTime}</dt>
87-
<dd>
88-
<a href="{$Event->getUrl("segments/$Segment->Handle")}">{$Segment->Title|escape}</a>
89-
{if $Segment->LocationName || $Segment->LocationAddress}
90-
<p>
91-
<strong>Location</strong>
92-
<a target="_blank" href="https://maps.google.com?q={implode(', ', array_filter(array($Segment->LocationName, $Segment->LocationAddress)))|escape:url}">
93-
{if $Segment->LocationName && $Segment->LocationAddress}
94-
{$Segment->LocationName|escape} ({$Segment->LocationAddress|escape})
95-
{else}
96-
{$Segment->LocationName|default:$Segment->LocationAddress|escape}
97-
{/if}
98-
</a>
99-
</p>
84+
{if
85+
(
86+
$Segment->LocationName != $lastLocationName
87+
|| $Segment->LocationAddress != $lastLocationAddress
88+
)
89+
&& ($Segment->LocationName || $Segment->LocationAddress)
90+
}
91+
<div class="event-location">
92+
<dt>{icon "map-marker"}</dt>
93+
<dd>{eventLocation name=$Segment->LocationName address=$Segment->LocationAddress}</dd>
94+
</div>
10095
{/if}
101-
<div class="content-markdown event-segment-description">{$Segment->Description|escape|markdown}</div>
102-
</dd>
103-
{/foreach}
96+
<dt>{time_range $Segment->StartTime $Segment->EndTime}</dt>
97+
<dd>
98+
<h4><a href="{$Segment->getUrl()}">{$Segment->Title|escape}</a></h4>
99+
<div class="content-markdown event-segment-description">{$Segment->Description|escape|markdown}</div>
100+
</dd>
101+
102+
{$lastLocationName = $Segment->LocationName}
103+
{$lastLocationAddress = $Segment->LocationAddress}
104+
{/foreach}
105+
</foreach>
104106
{/if}
105107
</div>
108+
109+
<dl class="event-details col-md-3">
110+
{if $Event->Status != 'published'}
111+
<dt>Status</dt>
112+
<dd>{$Event->Status}</dd>
113+
{/if}
114+
115+
<dt>Starts</dt>
116+
<dd>{timestamp $Event->StartTime time='auto'}</dd>
117+
118+
{if $Event->EndTime}
119+
<dt>Ends</dt>
120+
<dd>{timestamp $Event->EndTime time='auto'}</dd>
121+
{/if}
122+
123+
{if $Event->LocationName || $Event->LocationAddress}
124+
<dt>Location</dt>
125+
<dd>{eventLocation name=$Event->LocationName address=$Event->LocationAddress}</dd>
126+
{/if}
127+
</dl>
106128
</div>
107129
{/block}

html-templates/events/eventEdit.tpl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{block js-bottom}
66
{$dwoo.parent}
7-
{jsmin "epiceditor.js"}
7+
{jsmin "lib/epiceditor.js"}
88
{jsmin "pages/event-edit.js"}
99
{/block}
1010

@@ -54,16 +54,20 @@
5454
</select>
5555
</div>
5656
<div class="form-group">
57-
<label for="field-time-start">{_ "StartTime"}:</label>
58-
<input type="date" name="StartTime" id="field-time-start" class="form-control" value="{refill field=StartTime default=$Event->StartTime}"/>
57+
<label for="field-time-start">{_ "Start time"}:</label>
58+
<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))}"/>
5959
</div>
6060
<div class="form-group">
61-
<label for="field-time-end">{_ "EndTime"}:</label>
62-
<input type="date" name="EndTime" id="field-time-end" class="form-control" value="{refill field=EndTime default=$Event->EndTime}"/>
61+
<label for="field-time-end">{_ "End time"}:</label>
62+
<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))}"/>
6363
</div>
6464
<div class="form-group">
65-
<label for="field-location">{_ "Location"}:</label>
66-
<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}"/>
65+
<label for="field-location-name">{_ "Location name"}:</label>
66+
<input type="text" name="LocationName" id="field-location-name" class="form-control" placeholder="Localhost" value="{refill field=LocationName default=$Event->LocationName}"/>
67+
</div>
68+
<div class="form-group">
69+
<label for="field-location-address">{_ "Location address"}:</label>
70+
<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}"/>
6771
</div>
6872

6973
<div class="form-group">

html-templates/events/eventSaved.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{capture assign=eventLink}<a href="{$Event->getUrl()|escape}">{$Event->getTitle()|escape}</a>{/capture}
99

1010
<div class="page-header">
11-
<h1>Event Created</h1>
11+
<h1>Event Saved</h1>
1212
</div>
1313
{if $Event->isNew}
1414
<p>{_("Your event has been created: %s")|sprintf:$eventLink}</p>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{extends "designs/site.tpl"}
2+
3+
{block title}{$data->Title|escape} @ {$data->Event->Title|escape} &mdash; {$dwoo.parent}{/block}
4+
5+
{block css}
6+
{$dwoo.parent}
7+
8+
<style>
9+
.event-segment-description p:last-child {
10+
margin-bottom: 0;
11+
}
12+
13+
.event-segment-details dt {
14+
font-size: 130%;
15+
}
16+
.event-segment-details dd {
17+
margin-bottom: 1em;
18+
}
19+
</style>
20+
{/block}
21+
22+
{block content}
23+
{$Segment = $data}
24+
{$Event = $Segment->Event}
25+
26+
<div class="page-header">
27+
<ol class="breadcrumb">
28+
<li><a href="/events">{_ "Events"}</a></li>
29+
<li><a href="{$Event->getUrl()}">{$Event->Title|escape}</a></li>
30+
<li>Schedule</li>
31+
</ol>
32+
<div class="btn-toolbar pull-right">
33+
{if $.User}
34+
<a class="btn btn-success" href="{$Segment->getUrl(edit)}">{icon "pencil"}&nbsp;{_ "Edit Segment"}</a>
35+
{/if}
36+
</div>
37+
<h1>{$Segment->Title|escape}</h1>
38+
</div>
39+
40+
<div class="row">
41+
<div class="col-md-9">
42+
{if $Segment->Description}
43+
<div class="content-markdown event-segment-description well">{$Segment->Description|escape|markdown}</div>
44+
{/if}
45+
</div>
46+
47+
<dl class="event-segment-details col-md-3">
48+
<dt>Starts</dt>
49+
<dd>{timestamp $Segment->StartTime time='auto'}</dd>
50+
51+
{if $Segment->EndTime}
52+
<dt>Ends</dt>
53+
<dd>{timestamp $Segment->EndTime time='auto'}</dd>
54+
{/if}
55+
56+
{if $Segment->LocationName || $Segment->LocationAddress}
57+
<dt>Location</dt>
58+
<dd>{eventLocation name=$Segment->LocationName address=$Segment->LocationAddress}</dd>
59+
{/if}
60+
</dl>
61+
</div>
62+
{/block}

0 commit comments

Comments
 (0)