calendario: link a modifica audio

pulsanti bottonati

file separato
This commit is contained in:
boyska 2019-07-05 01:49:47 +02:00
parent c7befca9c5
commit a91c0f4eb2
2 changed files with 39 additions and 29 deletions

View file

@ -1,35 +1,8 @@
{% extends "dbadmin_base.html" %}
{%block scripts%}
{{super()}}
<script type="text/javascript">
$(function() {
$('.button').button({
icons: {
primary: 'ui-icon-pencil'
}
});
<script type="text/javascript" src="{{url_for('static', filename='calendar.js')}}"></script>
$('li.alarm').hover( function() {
var sel = 'li.alarm[data-alarmid="' + $(this).data('alarmid') + '"]'
$(sel).closest('div').find('time').toggleClass('soft-highlight');
});
$('li.alarm').click(function() {
var alarmid = $(this).data('alarmid');
var time = $('<p/>').append($('<a/>').text('Modifica orario evento').attr('href', 'edit/time/' + alarmid));
var audio = $('<p/>').append($('<a/>').text('Modifica audio evento').attr('href', 'edit/event/' + alarmid));
$('<div/>').append(time).append(audio).dialog({modal: true, title: "Evento " + $(this).text()});
});
$(document).tooltip({
items: "li.alarm",
content: function() {
var el = $(this);
return el.find('.alarm-actions').html();
}
});
});
</script>
{%endblock%}
{% block styles%}
{{super()}}
@ -54,7 +27,7 @@ li.alarm .alarm-actions { display: none; }
<div>
<ul>
{% for alarm, actions in days[day][t] %}
<li class="alarm" data-alarmid="{{alarm.eid}}">
<li class="alarm" data-alarmid="{{alarm.eid}}" data-actions="{{alarm.actions|join(',')}}">
<time>{{t.time()}}</time>
{{alarm.nick}}
<div class="alarm-actions">{% for a in actions %}{{a.nick}}{%endfor%}</div>

View file

@ -0,0 +1,37 @@
/* global jQuery */
jQuery(function ($) {
$('.button').button({
icons: {
primary: 'ui-icon-pencil'
}
})
$('li.alarm').hover(function () {
var sel = 'li.alarm[data-alarmid="' + $(this).data('alarmid') + '"]'
$(sel).closest('div').find('time').toggleClass('soft-highlight')
})
$('li.alarm').click(function () {
var alarmid = $(this).data('alarmid')
var actions = $(this).data('actions')
var content = $('<div/>').append(
$('<p/>').append($('<a class="btn btn-default"/>').text('Modifica orario evento').attr('href', 'edit/time/' + alarmid))
)
if (Number.isInteger(actions)) { // else, it's a string representing a list
content.append($('<p/>').append(
$('<a class="btn btn-default"/>')
.text('Modifica audio evento')
.attr('href', 'edit/audio/' + actions)))
}
var audio = $('<p/>').append($('<a class="btn btn-default btn-sm"/>').text('Modifica lista di audio evento').attr('href', 'edit/event/' + alarmid))
content.append(audio).dialog({modal: true, title: 'Evento ' + $(this).text()})
})
$(document).tooltip({
items: 'li.alarm',
content: function () {
var el = $(this)
return el.find('.alarm-actions').html()
}
})
})