-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_create.html
More file actions
404 lines (354 loc) · 16.7 KB
/
event_create.html
File metadata and controls
404 lines (354 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
{% extends "./wrapper.html" %}
{% load actionkit_tags %}
{% block content %}
<form class="ak-form norecognize" name="act" method="POST" action="{% if update %}/update_action/{% else %}/act/{% endif %}" accept-charset="utf-8">
<input type="hidden" name="page" value="{{ page.name }}">
<div class="ak-grid-row">
<div class="ak-grid-col ak-grid-col-12-of-12">
{% if not update %}
<h2>{{ page.title }}</h2>
{% else %}
<h2>Update Event Information</h2>
{% endif %}
</div>
</div>
<div class="ak-grid-row ak-grid-row-inverted">
{% if page.custom_fields.featured_image %}
<div class="ak-grid-col ak-grid-col-3-of-12">
<img class="ak-featured-img" src="{{page.custom_fields.featured_image}}">
</div>
{% endif %}
<div class="ak-grid-col {% if page.custom_fields.featured_image %}ak-grid-col-9-of-12{% else %}ak-grid-col-12-of-12{% endif %}">
{% if not update and form.host_text %}
<div class="ak-page-content">
{% include_tmpl form.host_text %}
</div>
{% endif %}
<div id="event-create-form" class="ak-styled-fields ak-labels-before {{templateset.custom_fields.field_errors_class|default:"ak-errs-below"}}">
<ul class="compact" id="ak-errors"></ul>
<div id="ak-user-info">
<h3>Your contact information</h3>
{% include "./user_form_wrapper.html" %}
<input type="hidden" name="never_recognize" value="1">
</div>
<div id="ak-event-info">
<h3>Event information</h3>
<div>
{% if campaign.use_title %}
<div>
<label for="id_event_title">Event name<span class="ak-required-flag">*</span></label>
<input id="id_event_title" type="text" name="event_title" value="{{ campaign.default_title }}">
</div>
{% endif %}
{% with event_starts_at as date_field %}
<div id="id_event_starts_at_row">
<label for="id_event_starts_at">Start date/time<span class="ak-required-flag">*</span></label>
{% include "./date_picker.html" %}
</div>
<script type="text/javascript">
// Replace animation w/instant show, because anim
// breaks tabbing quickly past the date field.
jQuery.fn.showFast = function(speed, callback) {
this.show()
callback()
}
// Removing datepicker doesn't break anything, and
// it might even be useful -- I can imagine users
// being confused when the picker covers up other
// key form fields.
$(function() {
$("#id_event_starts_at_date").datepicker( {
minDate: 0, showAnim: 'showFast'
} )
} );
</script>
{% endwith %}
{% if campaign.use_ends_at %}
{% with event_ends_at as date_field %}
<div>
<label for="id_event_ends_at">End time</label>
{% include "./date_picker.html" %}
</div>
{% endwith %}
{% endif %}
{% if campaign.allow_private %}
<div id="id_event_is_private_row" class="ak-checkbox-field">
<input id="id_event_is_private" type="checkbox" class="checkbox" name="event_is_private" value="1">
<label class="ak-checkbox-label" for="id_event_is_private">
Make event private
</label>
</div>
{% endif %}
<div>
<label for="id_event_max_attendees">Max. signups</label>
<input id="id_event_max_attendees" type="text" name="event_max_attendees" value="{{ campaign.default_event_size|default:"" }}" size=3>
</div>
{% include_tmpl form.custom_field_html %}
</div>
</div>
<div id="event-info">
<h3>Event location</h3>
<div class="unknown_user">
<!--
This only shows if the user form includes all of the
event fields (e.g., address1, country if you use it)
-->
<input id="id_at_my_house" type="checkbox" class="checkbox" name="at_my_house" value="1">
<label class="ak-checkbox-label" for="id_at_my_house">
Use my home address
</label>
</div>
<div>
{% with "event_" as input_name_prefix %}
<div>
<label for="id_event_venue">Venue<span class="ak-required-flag">*</span></label>
<input id="id_event_venue" type="text" if-at-my-house="Home" name="event_venue">
</div>
<div>
<label for="event_country">Country</label>
{% include "./country_select.html" %}
</div>
<div>
<label for="id_event_address1">Street address<span class="ak-required-flag">*</span></label>
<input id="id_event_address1" type="text" name="event_address1">
</div>
<div>
<label for="id_event_city">City</label>
<input id="id_event_city" type="text" name="event_city">
</div>
<div>
<label for="id_event_state">State</label>
{% include "./state_select.html" %}
</div>
<div>
<label for="id_event_postal">Postal</label>
<input id="id_event_postal" type="text" name="event_postal">
</div>
<div>
<label for="id_event_zip">ZIP</label>
<input id="id_event_zip" type="text" name="event_zip">
</div>
<!-- <div><label for="id_event_phone">Contact phone:</label> <input id="id_event_phone" type="tel" name="event_phone" size="12"></div> -->
{% if campaign.show_address1 %}
<div class="strong">
NOTE: Event addresses are public.
</div>
{% endif %}
{% endwith %}
<p>
Double-check date, time, and location before you submit!
</p>
</div>
</div>
<div id="event-info">
<h3>Event description</h3>
<div class="ak-errs-below">
<label for="id_event_public_description">
Public description<span class="ak-required-flag">*</span>
<br><span class="ak-normal">
{% if campaign.allow_private %}
For public events, people
{% else %}
People
{% endif %}
will see this text before signing up
</span>
</label>
<textarea id="id_event_public_description" name="event_public_description"></textarea>
</div>
<div>
<label for="id_event_directions">Directions to event</label>
<textarea id="id_event_directions" name="event_directions"></textarea>
</div>
<div>
<label for="id_event_note_to_attenddees">Note to attendees
</label>
<textarea id="id_event_note_to_attenddees" name="event_note_to_attendees"></textarea>
</div>
</div>
</div><!--9-of-12-->
</div>
</div>
<div class="ak-grid-row">
<div class="ak-grid-col ak-grid-col-12-of-12">
{% if not update %}
{% if form.host_requirements|is_nonblank or form.ground_rules|is_nonblank %}
<div id="ground-rules">
<h3>Event rules</h3>
{% if form.host_requirements %}
<p>Here are the basic requirements for event hosts:</p>
<div class="ak-signoff-box ak-errs-below">
<blockquote>
{% include_tmpl form.host_requirements %}
</blockquote>
<div>
<input id="id_event_host_requirements" type="checkbox" name="event_host_requirements" value="1">
<label class="ak-checkbox-label" for="id_event_host_requirements">
<strong>Required:</strong>
I can meet the requirements for hosting an event.
</label>
</div>
</div>
{% else %}
<input type="hidden" name="event_host_requirements" value="1">
{% endif %}
{% if form.ground_rules|is_nonblank %}
<p>Here are the rules for hosting events:</p>
<div class="ak-signoff-box ak-errs-below">
<blockquote>
{% include_tmpl form.ground_rules %}
</blockquote>
<div>
<input id="id_event_host_ground_rules" type="checkbox" name="event_host_ground_rules" value="1">
<label class="ak-checkbox-label" for="id_event_host_ground_rules">
<strong>Required:</strong>
I agree to the rules for hosting an event.
</label>
</div>
</div>
{% else %}
<input type="hidden" name="event_host_ground_rules" value="1">
{% endif %}
</div>
{% else %}
<input type="hidden" name="event_host_requirements" value="1">
<input type="hidden" name="event_host_ground_rules" value="1">
{% endif %}
{% else %}
<input type="hidden" name="event_host_requirements" value="1">
<input type="hidden" name="event_host_ground_rules" value="1">
{% endif %}
{% if not update %}
<p>
Next, we'll email you a link to confirm your event.
</p>
{% endif %}
<input id="id_submit" type="submit" value="{% if update %}Update event{% else %}Continue to next step: Confirm event{% endif %}" class="ak-submit-button">
</div>
</div>
</form>
{% endblock %}
{% block script_additions %}
{% include "includes/jquery_ui.html" %}
<script type="text/javascript">
isEventUnitedStates = function () {
var country = actionkit.form && actionkit.form.event_country
&& actionkit.utils.val(actionkit.form.event_country)
return country == 'United States' || country == 'US' || !country;
};
reflectEventCountryChange = function() {
var is_us = isEventUnitedStates();
var event_zip = actionkit.form.event_zip,
event_postal = actionkit.form.event_postal,
event_state = actionkit.form.event_state;
if ( event_zip && event_postal ) {
if ( is_us ) actionkit.forms.showAndHide(event_zip, event_postal);
else actionkit.forms.showAndHide(event_postal,event_zip);
}
if ( event_state ) {
if ( is_us ) {
$(event_state).removeAttr('disabled');
var shownRow = actionkit.forms.getRowForElement(event_state);
shownRow.show();
}
else {
$(event_state).attr('disabled', true);
$(event_state).val('');
$(event_state).change();
var hiddenRow = actionkit.forms.getRowForElement(event_state);
hiddenRow.hide();
}
}
};
actionkitFormReady = function() {
if ( (actionkit.form.event_zip && actionkit.form.event_postal)
|| (actionkit.form.event_state && actionkit.form.event_region) ) {
if (actionkit.context.prefill_data) {
var event_zip_val = actionkit.context.prefill_data.event_zip,
event_postal_val = actionkit.context.prefill_data.event_postal;
}
reflectEventCountryChange();
if (actionkit.context.prefill_data) {
var is_us = isEventUnitedStates();
if (is_us) {
actionkit.form.event_zip.value = event_zip_val;
$(actionkit.form.event_zip).change();
}
else {
actionkit.form.event_postal.value = event_postal_val;
$(actionkit.form.event_postal).change();
}
}
}
};
$(document).ready( function() {
var prev_is_us, now_is_us;
$(actionkit.form.event_country).focus(function() {
prev_is_us = isEventUnitedStates();
}).change(function() {
now_is_us = isEventUnitedStates();
if ( prev_is_us != now_is_us ) {
reflectEventCountryChange();
}
});
});
$(function() {
if ( ( ! $('#id_event_starts_at_date[type="text"]').length ) && ! $('#id_event_starts_at_time[type="text"]').length ) {
$('#id_event_starts_at_row .ak-datetime').wrap('<div class="ak-readonly-value">' );
}
$('.ak-signoff-box input[type="checkbox"]').on('change', function() {
if ($(this).is(':checked')) {
$(this).next('label.ak-checkbox-label').removeClass('ak-error');
}
});
});
</script>
{% if update %}
<script type="text/javascript">
$( function() {
$('#user-info input[name=email]').attr('disabled','disabled')
} );
</script>
{% endif %}
<script type="text/javascript">
var address_fields = [
'address1', 'address2', 'city', 'state', 'zip', 'postal', 'country'
];
function copyEventAddress() {
for (var i=0; i<address_fields.length; ++i)
$('#id_event_' + address_fields[i]).val(
$('#id_' + address_fields[i]).val() || ''
).change();
// handle inconsistent id="state" in user_form and
// id="event_country" from country_select.html
$('#id_event_state').val($('#state').val() || $('#id_state').val() || '').change();
$('#event_country').val($('#country').val() || $('#id_country').val() || '').change();
if ( !$('#id_event_venue').val() )
$('#id_event_venue').val($('#id_event_venue').attr('if-at-my-house') || '').change()
}
function clearEventAddress() {
for (var i=0; i<address_fields.length; ++i)
$('#id_event_' + address_fields[i]).val('').change();
if ( $('#id_event_venue').val() == $('#id_event_venue').attr('if-at-my-house') )
$('#id_event_venue').val('').change();
}
$('#id_at_my_house').click(function() {
this.checked ? copyEventAddress() : clearEventAddress();
})
$( function () {
// check whether "Use my home address" even makes sense
for ( var i = 0; i < address_fields.length; ++i ) {
var fieldName = address_fields[i];
// if no #event_city, we don't care if user form has a #id_city
if (!$('#id_event_' + fieldName + ', #event_' + fieldName).length)
continue;
// if no #id_address1 or #address1 to match #event_address1,
// hide the checkbox since it won't work
if (!$('#id_' + fieldName + ', #' + fieldName).length) {
$('#id_at_my_house').parent().remove();
break;
}
}
} );
</script>
{% endblock %}