Fix schedule edit

Use main base template instead of intermediate base.
Remove references to Bootstrap 3 and update to Bootstrap 4.
Add edit button to standard grid/mobile view instead of duplicating.
This commit is contained in:
Joel Addison 2019-12-15 14:45:00 +10:00
parent ecea304d8b
commit 0faf935653
6 changed files with 81 additions and 125 deletions

View file

@ -1,39 +0,0 @@
<table class="calendar table table-bordered">
<thead>
<tr>
<th class="time">&nbsp;</th>
{% for room in timetable.rooms %}
<th>{{ room.name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in timetable %}
<tr>
<td class="time">{{ row.time|date:"h:iA" }}</td>
{% for slot in row.slots %}
<td class="slot slot-{{ slot.kind.label }}" colspan="{{ slot.colspan }}" rowspan="{{ slot.rowspan }}">
{% if slot.kind.label == "talk" or slot.kind.label == "tutorial" %}
{% if not slot.content %}
<a class="btn btn-xs edit-slot" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">+</a>
{% else %}
<span class="title"><a class="edit-slot" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">{{ slot.content.title }}</a></span>
<span class="speaker">{{ slot.content.speaker }}</span>
{% endif %}
{% else %}
{% if slot.content_override.raw %}
{{ slot.content_override.rendered|safe }}
{% else %}
{{ slot.kind.label }}
{% endif %}
&mdash; <a class="edit-slot" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">edit</a>
{% endif %}
</td>
{% endfor %}
{% if forloop.last %}
<td colspan="{{ timetable.rooms|length }}"></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -28,44 +28,45 @@
<tr class="calendar-row">
<th scope="row" class="time"><p>{{ row.time|date:"h:iA" }}</p></th>
{% for slot in row.slots %}
<td class="slot slot-{{ slot.kind.label }}" colspan="{{ slot.colspan }}" rowspan="{% if slot.rowspan > 1%}{{ slot.rowspan|add:-1 }}{% else %}1{% endif %}" >
<td class="slot slot-{{ slot.kind.label }}" colspan="{{ slot.colspan }}" rowspan="{{ slot.rowspan }}">
{% with slot.kind.label.lower as label %}
{% if label == "talk" or label == "tutorial" %}
{% if slot.content %}
<div>
{% if slot.content %}
<p>
<a href="{% url "schedule_presentation_detail" slot.content.pk %}">{{ slot.content.title }}</a>
<br />
{{ slot.content.speakers|join:", " }}
</p>
</div>
{% flag "session_chair" %}
{% if slot.sessions %}
<div>
{% for session in slot.sessions.all %}
<em>Session chair:
{% if not session.chair %}
<a href="{% url "schedule_session_detail" session.id %}">Volunteer! 🙋</a>
{% else %}
<a href="{% url "schedule_session_detail" session.id %}">{{ session.chair.user.attendee.attendeeprofilebase.attendeeprofile.name }}</a>
{% endif %}
</em>
{% endfor %}
</div>
{% endif %}
{% endflag %}
{% endif %}
{% flag "session_chair" %}
{% if slot.sessions and not edit_schedule %}
<div>
{% for session in slot.sessions.all %}
<em>Session chair:
{% if not session.chair %}
<a href="{% url "schedule_session_detail" session.id %}">Volunteer! 🙋</a>
{% else %}
<a href="{% url "schedule_session_detail" session.id %}">{{ session.chair.user.attendee.attendeeprofilebase.attendeeprofile.name }}</a>
{% endif %}
</em>
{% endfor %}
</div>
{% endif %}
{% endflag %}
{% endif %}
{% elif label == "shortbreak" %}
{% else %}
{% if slot.content_override %}
{{ slot.content_override_html|safe }}
{% else %}
<div class="d-flex align-items-center">
<p>{{ slot.kind.label }}</p>
</div>
{% endif %}
{% if slot.content_override %}
{{ slot.content_override_html|safe }}
{% else %}
<div class="d-flex align-items-center">
<p>{{ slot.kind.label }}</p>
</div>
{% endif %}
{% endif %}
{% endwith %}
{% if edit_schedule %}
<a class="btn btn-secondary btn-sm edit-slot" role="button" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">Edit</a>
{% endif %}
</td>
{% endfor %}
{% if forloop.last %}

View file

@ -22,10 +22,21 @@
{% listlookup timetable.rooms forloop.counter0 as room_names %}
<p><em>{{ room_names }}<br />ends {{ slot.end }}</em></p>
{% endif %}
{% elif label == "shortbreak" %}
{% else %}
{% if slot.content_override %}
{{ slot.content_override_html|safe }}
{% else %}
<div class="d-flex align-items-center">
<p>{{ slot.kind.label }}</p>
</div>
{% endif %}
{% endif %}
{% endwith %}
{% if edit_schedule %}
<a class="btn btn-secondary btn-sm edit-slot" role="button" data-action="{% url "schedule_slot_edit" schedule.section.slug slot.pk %}" href="#">Edit</a>
{% endif %}
</div>
{% endfor %}
{% endif %}

View file

@ -1,14 +1,22 @@
{% load i18n bootstrap %}
<form class="form-horizontal" id="slotEditForm" class="modal-form" method="POST" action="{% url "schedule_slot_edit" slug slot.pk %}">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<a class="close" data-dismiss="modal">&times;</a>
<h3>{% trans "Edit Slot" %}</h3>
<h5 class="modal-title">{% trans "Edit Slot" %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="height:350px">
<div class="modal-body">
<form class="form-horizontal" id="slotEditForm" class="modal-form" method="POST" action="{% url "schedule_slot_edit" slug slot.pk %}">
{% csrf_token %}
{{ form|bootstrap }}
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</form>
</div>

View file

@ -1,29 +0,0 @@
{% extends "site_base.html" %}
{% load staticfiles %}
{% block extra_style %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'css/site-0a247b924d.css' %}">
{% endblock %}
{% block body_base %}
<div style="height: 100px;" />
<main role="main">
{% include "_messages.html" %}
{% block body %}
{% block content %}
{% endblock %}
{% endblock %}
</main>
{% endblock %}
{% block scripts %}
<script src="{{ STATIC_URL }}/js/app.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="{{ STATIC_URL }}/js/bootstrap.min.js" type="text/javascript"></script>
{% block extra_script %}{% endblock %}
{% endblock %}
{% block extra_body_base %}
{% block extra_body %}{% endblock %}
{% endblock %}

View file

@ -1,35 +1,40 @@
{% extends "symposion/schedule/base.html" %}
{% extends "site_base.html" %}
{% load i18n %}
{% block head_title %}Conference Schedule Edit{% endblock %}
{% block body_class %}full{% endblock %}
{% block right %}
{% endblock %}
{% block extra_head %}
{% endblock %}
{% block page_title %}Conference Schedule Edit{% endblock %}
{% block content %}
<div class="l-content-page">
<div class="l-content-page--richtext">
<div class="rich-text">
<h1>Schedule Edit</h1>
{% for timetable in days %}
<h2>{{ timetable.day.date }}</h2>
{% include "symposion/schedule/_edit_grid.html" %}
{% endfor %}
<form class="form-horizontal" id="schedule-builder" action="." method="post" enctype="multipart/form-data">{% csrf_token %}
<div class="row">
<div class="col-12">
<h2>Schedule Admin</h2>
<form class="form-horizontal" id="schedule-builder" action="." method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="submit" value="Submit" />
<input type="submit" id="delete" name="delete" value="Delete Schedule" />
</form>
<div class="modal fade in" style="background-color:#fff;" id="slotEditModal"></div>
</div></div></div>
</form>
</div>
</div>
{% for timetable in days %}
<div class="row">
<div class="col-12">
<h2 class="my-4">
{{ timetable.day.date|date:"l" }}, {{ timetable.day.date }}
</h2>
<div class="table-responsive d-none d-md-block">
{% include "symposion/schedule/_grid.html" with edit_schedule=True %}
</div>
<div class="mobile-schedule d-sm-block d-md-none">
{% include "symposion/schedule/_mobile.html" with edit_schedule=True %}
</div>
</div>
</div>
{% endfor %}
<div class="modal fade" id="slotEditModal"></div>
{% endblock %}
{% block extra_script %}
@ -55,6 +60,5 @@
}
});
});
</script>
{% endblock %}