root/admin/events/edit_event.tt
[%- meta.wrapper = 'admin/wrapper.tt';
IF event.id;
meta.title = 'Edit event';
ELSE;
meta.title = 'Add event';
END;
-%]
<script type="text/javascript">
$(document).ready(
function() {
$("#start_pick").datepicker({
dateFormat: 'dd M yy',
altFormat: 'yy-mm-dd',
altField: '#start_date'
}
);
});
$(document).ready(
function() {
$("#end_pick").datepicker({
dateFormat: 'dd M yy',
altFormat: 'yy-mm-dd',
altField: '#end_date'
}
);
});
</script>
[%- IF event.id %]
<form id="edit_event" action="[% c.uri_for( 'edit-event-do', event.id ) %]" method="post">
[%- ELSE %]
<form id="add_event" action="add-event-do" method="post">
[%- END %]
<p>
<label for="name">Name</label>
<br><input class="textshort" type="text" id="name" name="name" value="[% event.name | html %]">
[%- IF event.id %]
<span class="small">
<a class="action" href="[% c.uri_for( '/events', event.start_date.year, event.start_date.month, event.url_name ) %]">View event</a>
</span>
[%- END %]
</p>
<p>
<label for="url_name">URL name</label>
<br><input class="textshort" type="text" id="url_name" name="url_name" value="[% event.url_name | html %]">
</p>
<p>
<label for="start_pick">Start date and time</label>
<br><input id="start_pick" class="textveryshort" type="text" value="[% event.start_date.day %] [% event.start_date.month_abbr %] [% event.start_date.year %]">
<input id="start_time" class="textveryshort" type="text" name="start_time" value="[% event.start_date.strftime('%H:%M') || '09:00' %]">
<input id="start_date" type="hidden" name="start_date" value="[% event.start_date.ymd %]">
</p>
<p>
<label for="end_pick">Finish date and time</label>
<br><input id="end_pick" class="textveryshort" type="text" value="[% event.end_date.day %] [% event.end_date.month_abbr %] [% event.end_date.year %]">
<input id="end_time" class="textveryshort" type="text" name="end_time" value="[% event.end_date.strftime('%H:%M') || '17:00' %]">
<input id="end_date" type="hidden" name="end_date" value="[% event.end_date.ymd %]">
</p>
<p>
<label for="body">Description</label>
<br><textarea id="description" name="description" cols="60" rows="4">[% event.description | html %]</textarea>
</p>
<p>
<label for="image">Image (optional)</label>
<br><select id="image" name="image">
<option value="">None</option>
[%- FOREACH image IN images %]
[%- IF image == event.image %]
<option value="[% image %]" selected="selected">[% image %]</option>
[%- ELSE %]
<option value="[% image %]">[% image %]</option>
[%- END %]
[%- END %]
</select>
</p>
<p>
<label for="address">Address (optional)</label>
<br><input class="textlong" type="text" id="address" name="address" value="[% event.address | html %]">
</p>
<p>
<label for="postcode">Postcode (optional)</label>
<br><input class="textshort" type="text" id="postcode" name="postcode" value="[% event.postcode | html %]">
</p>
<p>
<label for="link">Email (optional)</label>
<br><input class="textshort" type="text" id="email" name="email" value="[% event.email | url %]">
</p>
<p>
<label for="link">External link (optional)</label>
<br><input class="textshort" type="text" id="link" name="link" value="[% event.link | url %]">
</p>
<p>
<label for="link">Booking link (optional)</label>
<br><input class="textshort" type="text" id="booking_link" name="booking_link" value="[% event.booking_link | url %]">
</p>
<p>
[%- IF event.id %]
<input type="hidden" name="event_id" value="[% event.id %]">
<input type="submit" value="Update">
[%- ELSE %]
<input type="submit" value="Create">
[%- END %]
<input type="reset" value="Reset">
[%- IF event.id %]
<input name="delete" type="submit" value="Delete" onclick="javascript:return confirm('Are you sure you want to delete this event?')">
[%- END %]
</p>
</form>