calendar.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {% extends "dbadmin_base.html" %}
  2. {%block scripts%}
  3. {{super()}}
  4. <script type="text/javascript">
  5. $(function() {
  6. $('.button').button({
  7. icons: {
  8. primary: 'ui-icon-pencil'
  9. }
  10. });
  11. $('li.alarm').hover( function() {
  12. var sel = 'li.alarm[data-alarmid="' + $(this).data('alarmid') + '"]'
  13. $(sel).closest('div').find('time').toggleClass('soft-highlight');
  14. });
  15. $('li.alarm').click(function() {
  16. var alarmid = $(this).data('alarmid');
  17. var time = $('<p/>').append($('<a/>').text('Modifica orario evento').attr('href', 'edit/time/' + alarmid));
  18. var audio = $('<p/>').append($('<a/>').text('Modifica audio evento').attr('href', 'edit/event/' + alarmid));
  19. $('<div/>').append(time).append(audio).dialog({modal: true, title: "Evento " + $(this).text()});
  20. });
  21. $(document).tooltip({
  22. items: "li.alarm",
  23. content: function() {
  24. var el = $(this);
  25. return el.find('.alarm-actions').html();
  26. }
  27. });
  28. });
  29. </script>
  30. {%endblock%}
  31. {% block styles%}
  32. {{super()}}
  33. <style>
  34. .soft-highlight { background-color: rgba(230, 230, 118, 0.36); }
  35. time { transition: background-color 500ms; font-weight: bold; }
  36. li.alarm .alarm-actions { display: none; }
  37. </style>
  38. {% endblock %}
  39. {% block title %}Larigira - Calendar{%endblock%}
  40. {% block content %}
  41. <div class="container-fluid">
  42. {% for week, weekdays in weeks|dictsort %}
  43. <div class="week row" id="week-{{week[0]}}-{{week[1]}}">
  44. {% for day in weeks[week] %}
  45. <div class="day col-lg-2 col-md-3 col-sm-6 col-xs-12">
  46. <h2><time datetime="{{day}}">{{day|dateformat(config.UI_CALENDAR_DATE_FMT)}}</time></h2>
  47. {% for t in days[day]|sort %}
  48. <div>
  49. <ul>
  50. {% for alarm, actions in days[day][t] %}
  51. <li class="alarm" data-alarmid="{{alarm.eid}}">
  52. <time>{{t.time()}}</time>
  53. {{alarm.nick}}
  54. <div class="alarm-actions">{% for a in actions %}{{a.nick}}{%endfor%}</div>
  55. </li>
  56. {% endfor %}
  57. </ul>
  58. </div>
  59. {%endfor %}
  60. </div><!-- day {{day}} -->
  61. {% endfor %}
  62. </div><!-- week {{week}} -->
  63. <hr/>
  64. {%endfor %}
  65. </div><!-- container -->
  66. {% endblock content %}
  67. {# vim: set ts=2 sw=2 noet: #}