Last active
August 29, 2015 14:09
-
-
Save majornorth/d110094abf8474be346a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="written-lesson-modal hidden"> | |
<div class="modal-header"> | |
<h3>Request a Written Lesson</h3> | |
</div> | |
<div class="modal-body"> | |
<form id="new-proposal" class="proposal-form form-horizontal" method="POST" action=""> | |
{% load tags %} | |
{% csrf_token %} | |
{% if is_parent or is_tutor %} | |
<div class="control-group"> | |
<label class="control-label chosen-label" for="id_student">Student:</label> | |
<div class="controls"> | |
<select id="id_student" name="student"> | |
<option value="">---------</option> | |
{% if is_parent %} | |
{% for s in students %} | |
<option value="{{ s.id }}"{% if default_user == s.id %} selected="selected"{% endif %} data-name="{{ s.first_name_or_default }}" data-offset="{{ s.timezone_offset_minutes|default_if_none:'' }}"> | |
{% unique_name s False %}</option> | |
{% endfor %} | |
{% else %} | |
{% for s in other_party %} | |
<option value="{{ s.id }}"{% if default_user == s.id %} selected="selected"{% endif %} data-name="{{ s.first_name_or_default }}" data-offset="{{ s.timezone_offset_minutes|default_if_none:'' }}"> | |
{% unique_name s False %}</option> | |
{% endfor %} | |
{% endif %} | |
</select> | |
{{ proposal_form.student.errors }} | |
</div> | |
</div> | |
{% endif %} | |
{% if is_parent or not is_tutor %} | |
<div class="control-group"> | |
<label class="control-label chosen-label" for="id_tutor">Tutor:</label> | |
<div class="controls"> | |
<select id="id_tutor" name="tutor"> | |
<option value="">---------</option> | |
{% for s in other_party %} | |
<option value="{{ s.id }}" | |
{% if default_user == s.id %} selected="selected"{% endif %} | |
data-name="{{ s.first_name_or_default }}" | |
data-offset="{{ s.timezone_offset_minutes|default_if_none:'' }}"> | |
{% unique_name s True %}</option> | |
{% endfor %} | |
</select> | |
{{ proposal_form.tutor.errors }} | |
</div> | |
</div> | |
{% endif %} | |
<div class="control-group"> | |
<label class="control-label">Start time:</label> | |
<div class="controls controls-row"> | |
<input type="text" class="datepicker"> | |
<input type="text" class="timepicker"> | |
<span class="timezone-abbr">{{ timezone_abbr }}</span> | |
<span class="timezone-abbr-edit"><a href="{% url 'edit_account' %}" class="tooltip-target" data-toggle="tooltip" data-trigger="hover" data-title="Change your timezone" target="_blank">Edit</a></span> | |
<div id="timezone-tip"></div> | |
{{ proposal_form.scheduled_time.errors }} | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="{{ proposal_form.duration.auto_id }}">Duration:</label> | |
<div class="controls"> | |
{{ proposal_form.duration }} | |
{{ proposal_form.duration.errors }} | |
</div> | |
</div> | |
{% if has_agreement %} | |
<div class="control-group"> | |
<label class="control-label" for="id_agreement">Package:</label> | |
<div class="controls"> | |
{{ proposal_form.agreement }} | |
{{ proposal_form.agreement.errors }} | |
</div> | |
</div> | |
{% endif %} | |
<div class="control-group"> | |
<label class="control-label chosen-label" for="id_subject">Subject:</label> | |
<div class="controls"> | |
{{ proposal_form.subject }} | |
{{ proposal_form.subject.errors }} | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label">Repeats:</label> | |
<div class="controls recurring-field"> | |
<label> | |
<input type="radio" name="recurring_type" value="" checked="checked"> Single lesson | |
</label> | |
<label> | |
<input type="radio" name="recurring_type" value="1"> Daily | |
</label> | |
<label> | |
<input type="radio" name="recurring_type" value="2"> Weekly | |
</label> | |
{{ proposal_form.recurring_type.errors }} | |
<div class="recurring-details"> | |
<span>Every</span> | |
<span class="day-weekly hidden-content"><strong>{{ proposal_form.scheduled_time|date:"l" }}</strong></span> | |
<span class="day-daily">day</span> | |
<span> for</span> | |
{{ proposal_form.recurring_days }} | |
<span class="type-text">days</span> | |
</div> | |
{{ proposal_form.recurring_days.errors }} | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="id_note">Note:</label> | |
<div class="controls"> | |
<textarea id="id_note" name="note" | |
placeholder="If you haven't already discussed this lesson, it's helpful to suggest alternative meeting times."></textarea> | |
</div> | |
</div> | |
<input type="hidden" name="scheduled_time" id="scheduled_time"> | |
{% if not is_parent %} | |
{% if is_tutor %} | |
<input type="hidden" name="tutor" id="id_tutor" value="{{ user_id }}"> | |
{% else %} | |
<input type="hidden" name="student" id="id_student" value="{{ user_id }}"> | |
{% endif %} | |
{% endif %} | |
<input type="hidden" name="proposer" id="id_proposer" value="{{ user_id }}"> | |
<input type="hidden" name="offset" id="offset"> | |
<input type="hidden" name="parent" value="{{ parent_id }}"> | |
<input type="hidden" name="meetNow" id="meetNow" value="0"> | |
</form> | |
</div> | |
<div class="modal-footer"> | |
<a class="btn" href="#" data-dismiss="modal">Cancel</a> | |
<a id="submit-proposal" class="btn btn-primary" href="#">Submit</a> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var UpcomingLessonTable = SchedulingView.extend({ | |
events: { | |
'click #open-proposal-form': 'addNewLesson', | |
'click .new-written-lesson': 'newWrittenLesson' | |
}, | |
addNewLesson: function(event) { | |
var $target = $(event.target), | |
uniqueUrl = $target.data('name'); | |
if (!redirectIfParentWithoutStudent(uniqueUrl)) { | |
this.$modal | |
.setModel(new models.Proposal(uniqueUrl)) | |
.showAddLesson(); | |
} | |
}, | |
newWrittenLesson: function(event) { | |
this.$('.written-lesson-modal').modal('show'); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment