Added options to ical interface - issue #80

This commit is contained in:
David Taylor
2015-06-30 14:31:28 +01:00
parent e935e3bf8c
commit 36c3a5da35
2 changed files with 100 additions and 8 deletions

View File

@@ -2,6 +2,29 @@
{% block title %}RIGS Profile {{object.pk}}{% endblock %}
{% block js %}
<script>
$(document).ready(function() {
$('#urlParamForm').change(function(){
url = "?";
$('#urlParamForm *').filter(':input').each(function(index, value){
param = $(value).val();
val = $(value).prop('checked');
url = url+param+"="+val+"&";
});
ics_url = $('#cal-url').data('url') + url.substring(0, url.length - 1);
$('#cal-url').text(ics_url);
gcal_url = $('#gcal-link').data('url') + encodeURIComponent(url.substring(0, url.length - 1));
$('#gcal-link').attr('href',gcal_url);
});
$('#urlParamForm').change(); //Do the initial setting
});
</script>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-10 col-md-offset-1">
@@ -68,16 +91,42 @@
{% endif %}
</dd>
<dt>Calendar Options</dt>
<dd>
<div class="well well-sm text-center">
<form class="form-inline" id="urlParamForm">
<div class="form-group">
<label class="checkbox-inline">
<input type="checkbox" value="rig" checked> Rigs
</label>
<label class="checkbox-inline">
<input type="checkbox" value="non-rig" checked> Non-Rigs
</label>
<label class="checkbox-inline">
<input type="checkbox" value="dry-hire" checked> Dry-Hires
</label>
<label class="checkbox-inline">
<input type="checkbox" value="cancelled"> Cancelled
</label>
<label class="checkbox-inline">
<input type="checkbox" value="provisional" checked> Provisional
</label>
<label class="checkbox-inline">
<input type="checkbox" value="confirmed" checked> Confirmed/Booked
</label>
</div>
</form>
</div>
</dd>
<dt>Calendar URL</dt>
<dd>
{% if user.api_key %}
<pre>http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}</pre>
<small><a href="http://www.google.com/calendar/render?cid=http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}">Click here</a> to add to google calendar.<br/>
<pre id="cal-url" data-url="http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}"></pre>
<small><a id="gcal-link" data-url="http://www.google.com/calendar/render?cid=http{{ request.is_secure|yesno:"s,"}}://{{ request.get_host }}{% url 'ics_calendar' api_pk=user.pk api_key=user.api_key %}" href="">Click here</a> to add to google calendar.<br/>
To sync from google calendar to mobile device, visit <a href="https://www.google.com/calendar/syncselect" target="_blank">this page</a> on your device and tick "RIGS Calendar".</small>
{% else %}
<pre>No API Key Generated</pre>
{% endif %}
</dd>
</dl>
{% endif %}