view.j2 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {% extends "layout/public.j2" %}
  2. {% block head %}
  3. <title>{{ ballot.name }} - Democratic Assembly</title>
  4. {% endblock %}
  5. {% block content %}
  6. {% with messages = get_flashed_messages(with_categories=true) %}
  7. {% if messages %}
  8. {% for category, message in messages %}
  9. <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
  10. {{ message }}
  11. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  12. <span aria-hidden="true">&times;</span>
  13. </button>
  14. </div>
  15. {% endfor %}
  16. {% endif %}
  17. {% endwith %}
  18. <h1>{{ ballot.name }}</h1>
  19. <table class="table table-sm">
  20. {% if ballot.description %}
  21. <tr>
  22. <th scope="row">Description</th>
  23. <td>{{ ballot.description }}</td>
  24. </tr>
  25. {% endif %}
  26. <tr>
  27. <th scope="row">Start</th>
  28. <td>{{ ballot.start_at }}</td>
  29. </tr>
  30. <tr>
  31. <th scope="row">Eindigt</th>
  32. <td>{{ ballot.end_at }}</td>
  33. </tr>
  34. {% if ballot.active() %}
  35. <tr>
  36. <th scope="row">Te gaan</th>
  37. <td class="countdown" date="{{ ballot.end_at }}"><span class="hours">00</span>:<span class="minutes">00</span>:<span class="seconds">00</span></td>
  38. </tr>
  39. {% endif %}
  40. <tr>
  41. <th scope="row">Aangemaakt door</th>
  42. <td>{{ ballot.user.name }}</td>
  43. </tr>
  44. {% if ballot.priority %}
  45. <tr>
  46. <th scope="row">Priority</th>
  47. <td>{{ ballot.priority.name }}</td>
  48. </tr>
  49. {% endif %}
  50. </table>
  51. {% if ballot.active() %}
  52. <form method="post">
  53. <div class="card mb-4">
  54. <div class="card-body">
  55. <h5 class="card-title">Controle code</h5>
  56. <input type="text" class="form-control" name="security_code" placeholder="code" required>
  57. </div>
  58. </div>
  59. {% for question in ballot.questions %}
  60. <div class="card mb-4">
  61. <div class="card-body">
  62. <h5 class="card-title">{{ question.name }}</h5>
  63. {% if question.description %}
  64. <p class="card-text">{{ question.description }}</p>
  65. {% endif %}
  66. {% for option in question.options %}
  67. <div class="form-check">
  68. <input class="form-check-input" type="radio" name="{{ question.id }}" id="{{ "option_%s" % option.id }}" value="{{ option.id }}">
  69. <label class="form-check-label" for="{{ "option_%s" % option.id }}">
  70. {{ option.name }}
  71. </label>
  72. </div>
  73. {% endfor %}
  74. </div>
  75. </div>
  76. {% endfor %}
  77. <div class="form-group pull-right">
  78. <button class="btn btn-primary" type="submit">Opslaan</button>
  79. </div>
  80. </form>
  81. {% else %}
  82. {% for question in ballot.questions %}
  83. <div class="card mb-4">
  84. <div class="card-body">
  85. <h5 class="card-title">{{ question.name }}</h5>
  86. {% if question.description %}
  87. <p class="card-text">{{ question.description }}</p>
  88. {% endif %}
  89. {% if question.combined_approval_voting %}
  90. <p class="card-text">Score: {{ question.score() }}</p>
  91. {% else %}
  92. <p class="card-text">Meeste stemmen: {{ question.score() }}</p>
  93. {% endif %}
  94. </div>
  95. <ul class="list-group list-group-flush">
  96. {% for option in question.options %}
  97. <li class="list-group-item d-flex justify-content-between align-items-center">
  98. {{ option.name }}
  99. <span class="badge badge-primary badge-pill">{{ option.votes.all() | count }}</span>
  100. </li>
  101. {% endfor %}
  102. </ul>
  103. </div>
  104. {% endfor %}
  105. {% endif %}
  106. {% endblock %}