summaryrefslogtreecommitdiff
path: root/views/partials/neweventform.handlebars
blob: 51d16958d73df0e74bb4204d287480ee4b5a4103 (plain)
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
<form id="newEventForm" action="/newevent" method="post" enctype="multipart/form-data">
 	<input type="text" hidden class="form-control" id="eventType" name="eventType" value="{{eventType}}">
  <div class="form-group row">
    <label for="eventName" class="col-sm-2 col-form-label">Event name</label>
    <div class="form-group col-sm-10">
      <input type="text" class="form-control" id="eventName" name="eventName" placeholder="Make it snappy." value="{{data.eventName}}" data-validation="required length" data-validation-length="3-60">
    </div>
  </div>
  <div class="form-group row">
    <label for="eventLocation" class="col-sm-2 col-form-label">Location</label>
    <div class="form-group col-sm-10">
      <input type="text" class="form-control" id="eventLocation" name="eventLocation" placeholder="Be specific." value="{{data.eventLocation}}" data-validation="required length"  data-validation-length="3-60">
    </div>
  </div>
  <div class="form-group row">
    <label for="eventStart" class="col-sm-2 col-form-label">Starts</label>
    <div class="form-group col-sm-10">
      <input readonly type="text" class="form-control" id="eventStart" name="eventStart" placeholder="Click me!" value="{{data.eventStart}}" data-validation="required">
    </div>
  </div>
  <div class="form-group row">
    <label for="eventEnd" class="col-sm-2 col-form-label">Ends</label>
    <div class="form-group col-sm-10">
      <input readonly type="text" class="form-control" id="eventEnd" name="eventEnd"  placeholder="Click me!" value="{{data.eventEnd}}" data-validation="required">
    </div>
  </div>
  <div class="form-group row">
    <label for="timezone" class="col-sm-2 col-form-label">Timezone</label>
    <div class="form-group col-sm-10">
      <select class="select2" id="timezone" name="timezone"></select>
    </div>
  </div>
  <div class="form-group row">
    <label for="eventDescription" class="col-sm-2 col-form-label">Description</label>
    <div class="form-group col-sm-10">
			<textarea class="form-control expand" id="eventDescription" name="eventDescription" data-validation="required" placeholder="You can always edit it later."></textarea>
			<small class="form-text"><a href="https://commonmark.org/help/">Markdown</a> formatting supported.</small>
    </div>
  </div>
  <div class="form-group row">
    <label for="eventURL" class="col-sm-2 col-form-label">Link</label>
    <div class="form-group col-sm-10">
      <input type="url" class="form-control" id="eventURL" name="eventURL" placeholder="For tickets or another event page (optional)." data-validation="url" data-validation-optional="true">
    </div>
  </div>
  <div class="form-group row">
    <label for="eventImage" class="col-sm-2 col-form-label">Cover image</label>
    <div class="form-group col-sm-10">
			<div id="image-preview">
				<label for="image-upload" id="image-label">Choose file</label>
				<input type="file" name="imageUpload" id="image-upload" />
			</div>
			<small class="form-text">Recommended dimensions (w x h): 920px by 300px.</small>
    </div>
  </div>
  {{#unless isPublic}}
  <div class="form-group row">
    <label for="eventPassword" class="col-sm-2 col-form-label">Event password</label>
    <div class="form-group col-sm-10">
      <input type="password" class="form-control" id="eventPassword" name="eventPassword" placeholder="Don't forget it!" data-validation="required">
    </div>
    <div class="form-group col-sm-10 offset-sm-2">
      <div class="" id="passwordStrengthBar"></div>
    </div>
  </div>
  {{/unless}}
  <div class="form-group row">
    <label for="hostName" class="col-sm-2 col-form-label">Host name</label>
    <div class="form-group col-sm-10">
      <input type="text" class="form-control" id="hostName" name="hostName" placeholder="Will be shown on the event page (optional)." data-validation="length" data-validation-length="2-60" data-validation-optional="true">
    </div>
  </div>
  <div class="form-group row">
    <label for="creatorEmail" class="col-sm-2 col-form-label">Your email</label>
    <div class="form-group col-sm-10">
      <input type="email" class="form-control" id="creatorEmail" name="creatorEmail" placeholder="We won't spam you <3" data-validation="email required">
      <small class="form-text">We will send your secret editing link to this email address.</small>
    </div>
  </div>
  <div class="form-group row">
    <div class="col-sm-2">Options</div>
    <div class="col-sm-10">
      <div class="form-check">
        <input class="form-check-input" type="checkbox" id="interactionCheckbox" name="interactionCheckbox">
        <label class="form-check-label" for="interactionCheckbox">
          Users can post comments on this event
        </label>
      </div>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" id="joinCheckbox" name="joinCheckbox">
        <label class="form-check-label" for="joinCheckbox">
          Users can mark themselves as attending this event
        </label>
      </div>
      <div class="form-check" id="maxAttendeesCheckboxContainer">
        <input class="form-check-input" type="checkbox" id="maxAttendeesCheckbox" name="maxAttendeesCheckbox">
        <label class="form-check-label" for="maxAttendeesCheckbox">
          Set a limit on the maximum number of attendees
        </label>
      </div>
    </div>
  </div>
  <div class="form-group row" id="maxAttendeesContainer">
    <label for="maxAttendees" class="col-sm-2 col-form-label">Attendee limit</label>
    <div class="form-group col-sm-10">
      <input type="number" class="form-control" id="maxAttendees" name="maxAttendees" placeholder="Enter a number." data-validation="number" data-validation-optional="true">
    </div>
  </div>
  <div class="form-group row">
    <div class="col-sm-12 pt-3 pb-3 text-center">
      <button type="submit" class="btn btn-primary w-50">Create</button>
    </div>
  </div>
</form>

<script type="text/javascript" src="/js/generate-timezones.js"></script>

<script>
	$(document).ready(function() {
		$.uploadPreview({
			input_field: "#image-upload",
			preview_box: "#image-preview",
			label_field: "#image-label",
			label_default: "Choose file",
			label_selected: "Change file",
			no_label: false
		});
		autosize($('textarea'));
        $("#maxAttendeesCheckbox").on("click", function() {
            if ($(this).is(':checked')) {
                $("#maxAttendeesContainer").slideDown('fast').css("display","flex");
                $("#maxAttendees").attr("data-validation-optional","false");
            }
            else {
                $("#maxAttendeesContainer").slideUp('fast');
                $("#maxAttendees").attr("data-validation-optional","true").val("").removeClass('is-valid is-invalid');
            }
        });
        $("#joinCheckbox").on("click", function() {
            if ($(this).is(':checked')) {
                $("#maxAttendeesCheckboxContainer").slideDown('fast').css("display","flex");
            }
            else {
                $("#maxAttendeesCheckboxContainer").slideUp('fast');
                $("#maxAttendeesCheckbox").prop("checked",false);
                $("#maxAttendeesContainer").slideUp('fast');
                $("#maxAttendees").attr("data-validation-optional","true").val("").removeClass('is-valid is-invalid');
            }
        });
	});
</script>