commit
f870a75119
@ -13,6 +13,8 @@ Agenda:
|
||||
- Added CSV import.
|
||||
Assignment:
|
||||
- Coupled assignment candidates with list of speakers.
|
||||
Dashboard:
|
||||
- Shortcuts for the countdown.
|
||||
Participants:
|
||||
- Disabled widgets by default.
|
||||
- Added form field for multiple creation of new participants.
|
||||
|
@ -137,3 +137,22 @@
|
||||
-moz-margin-start: 4px !important;
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* style for countdown shortcuts
|
||||
*
|
||||
* TODO: move to projector app or merge projector with core
|
||||
*/
|
||||
|
||||
#countdown_shortcut_storage .countdown_shortcut_time {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
#countdown_shortcut_storage .countdown_shortcut_time span {
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
#countdown_shortcut_dummy {
|
||||
display: none;
|
||||
}
|
||||
|
@ -86,6 +86,8 @@ $(function() {
|
||||
});
|
||||
|
||||
// control countdown
|
||||
// TODO: Move Countdown-code into the projector app, or merge the projector
|
||||
// app with the core app.
|
||||
$('.countdown_control').click(function(event) {
|
||||
event.preventDefault();
|
||||
var link = $(this);
|
||||
@ -111,6 +113,69 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$('#countdown_set').click(function(event) {
|
||||
// Create a shortcut from the value in the form
|
||||
event.preventDefault();
|
||||
var times = get_times();
|
||||
times.push($("#countdown_time" ).val());
|
||||
localStorage.setItem('countdown_shortcut', times.join());
|
||||
build_countdown_shortcuts();
|
||||
});
|
||||
|
||||
get_times = function() {
|
||||
// Loads the time values from the local storages. Converts all values
|
||||
// to integers and removes doubles.
|
||||
// Returns an empty array if an error occurs
|
||||
try {
|
||||
return localStorage.getItem('countdown_shortcut').split(',')
|
||||
.map(function(value) {
|
||||
// converts times into int
|
||||
return parseInt(value);
|
||||
}).filter(function(value, index, self) {
|
||||
// filters doubles
|
||||
return self.indexOf(value) === index;
|
||||
});
|
||||
} catch(err) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
$('.countdown_shortcut_time').click(function(event) {
|
||||
// click on a shortcut. Set the form value and simulate a click event.
|
||||
event.preventDefault();
|
||||
var time = $(this).children('span').html();
|
||||
$('#countdown_time').val(time);
|
||||
$('#countdown_set').click();
|
||||
});
|
||||
|
||||
$('.countdown_shortcut_time .close').click(function(event) {
|
||||
// Removes a shortcut.
|
||||
event.preventDefault();
|
||||
var time = $(this).parent().parent().children('span').html();
|
||||
var times = get_times().filter(
|
||||
function(value) {
|
||||
return value !== parseInt(time);
|
||||
}
|
||||
);
|
||||
localStorage.setItem('countdown_shortcut', times);
|
||||
build_countdown_shortcuts();
|
||||
});
|
||||
|
||||
build_countdown_shortcuts = function() {
|
||||
// Recreates the countdown shortcuts
|
||||
var times = get_times();
|
||||
$('#countdown_shortcut_storage').empty();
|
||||
$.each(times, function(index, time) {
|
||||
var element = $('#countdown_shortcut_dummy').clone(withDataAndEvents=true);
|
||||
element.attr('id', '');
|
||||
$('span', element).html(time);
|
||||
element.appendTo('#countdown_shortcut_storage');
|
||||
});
|
||||
};
|
||||
|
||||
// build shortcuts at start time.
|
||||
build_countdown_shortcuts();
|
||||
|
||||
// activate/deactivate overlay
|
||||
$('.overlay_activate_link').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
@ -7,8 +7,8 @@
|
||||
<input class="projector_countdown_spinval" id="countdown_time" name="countdown_time" type="number" min="0" value="{{ countdown_time }}">
|
||||
<span class="add-on">{% trans "s" context "seconds" %}</span>
|
||||
<button id="countdown_set" class="countdown_control btn tooltip-bottom" href="{% url 'countdown_set_default' %}"
|
||||
rel="tooltip" data-original-title="{% trans 'Save time as default' %}">
|
||||
<i class="icon-refresh"></i>
|
||||
rel="tooltip" data-original-title="{% trans 'Add time to favourits' %}">
|
||||
<i class="icon-star"></i>
|
||||
</button>
|
||||
</div>
|
||||
<a id="countdown_reset" class="countdown_control btn" href="{% url 'countdown_reset' %}"
|
||||
@ -25,5 +25,14 @@
|
||||
{% if countdown_state == 'inactive' or countdown_state == 'paused' or countdown_state == 'expired' %} style="display:none"{% endif %}>
|
||||
<i class="icon-pause"></i>
|
||||
</a>
|
||||
|
||||
<!-- countdown_shortcut -->
|
||||
<span id="countdown_shortcut_dummy" class="countdown_shortcut_time btn btn-default">
|
||||
<span></span>
|
||||
<a class="countdown_shortcut_remove" href="#">
|
||||
<button type="button" class="close" aria-hidden="true">×</button>
|
||||
</a>
|
||||
</span>
|
||||
<div id="countdown_shortcut_storage"></div>
|
||||
</div>
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user