1
0
Fork 0

Add hotkeys to observation-new view

merge-requests/438/head
Pierros Papadeas 2017-12-11 00:38:32 +02:00
parent a060c2e1b7
commit 0e6998ba35
No known key found for this signature in database
GPG Key ID: AB1301B4FCDFF5D4
3 changed files with 46 additions and 1 deletions

View File

@ -129,4 +129,15 @@ $(document).ready( function(){
$('#hoverRes').show();
$('#schedule-observation').removeAttr('disabled');
}
// Hotkeys bindings
$(document).bind('keyup', function(event){
if (event.which == 67) {
var link_calculate = $('#calculate-observation');
link_calculate[0].click();
} else if (event.which == 83) {
var link_schedule = $('#schedule-observation');
link_schedule[0].click();
}
});
});

View File

@ -12,13 +12,22 @@
{% block content %}
<div class="row">
<div class="col-md-12">
<div class="col-md-6 col-sm-6">
<h2>New Observation</h2>
<div class="timezone text-muted">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span>
Timeframes are in <a href="#" data-toggle="modal" data-target="#UTCModal">UTC</a>
</div>
</div>
<div class="col-md-6 col-sm-6 text-right hidden-xs">
<h2>
{% if user.is_authenticated %}
<a href="#" class="btn" data-toggle="modal" data-target="#HotkeysModal">
<span class="glyphicon glyphicon-fire" aria-hidden="true" title="Hotkeys"></span>
</a>
{% endif %}
</h2>
</div>
</div>
<form class="form-horizontal" role="form" action="{% url 'base:observation_new' %}"
@ -157,6 +166,9 @@
<!-- UTC Modal -->
{% include 'includes/utc.html' %}
<!-- Hotkeys Modal -->
{% include 'includes/observation-new-hotkeys.html' %}
{% endblock content %}
{% block javascript %}

View File

@ -0,0 +1,22 @@
<div class="modal fade" id="HotkeysModal" tabindex="-1" role="dialog" aria-labelledby="HotkeysModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="HotkeysModalTitle"><span class="glyphicon glyphicon-fire" aria-hidden="true"></span> Hotkeys</h4>
</div>
<div class="modal-body">
<p>
<span class="label label-info" title="Calculate">c</span> Calculate observation</span>
</p>
<p>
<span class="label label-info" title="Schedule">s</span> Schedule observation</span>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>