Private
Public Access
1
0

alertowners

This commit is contained in:
Sander Roosendaal
2019-10-02 17:25:05 +02:00
parent 20f2d2cbe0
commit 2631419265
5 changed files with 52 additions and 4 deletions

View File

@@ -53,9 +53,11 @@
</li> </li>
</ul> </ul>
</form> </form>
{% endblock %}
{% block scripts %}
<!-- Include formset plugin - including jQuery dependency --> <!-- Include formset plugin - including jQuery dependency -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/static/js/jquery.formset.js"></script> <script src="/static/js/jquery.formset.js"></script>
<script> <script>
$('.fav-formset').formset({ $('.fav-formset').formset({
@@ -64,9 +66,30 @@
}); });
</script> </script>
<script>
$( document ).ready(function() {
$('#id_workouttype').on('change', function(){
if (
$(this).val() == 'water'
|| $(this).val() == 'coastal'
|| $(this).val() == 'c-boat'
|| $(this).val() == 'churchboat'
) {
$('#id_boattype').toggle(true);
} else {
$('#id_boattype').toggle(false);
$('#id_boattype').val('1x');
}
});
$('#id_workouttype').change();
});
</script>
{% endblock %} {% endblock %}
{% block sidebar %} {% block sidebar %}
{% include 'menu_analytics.html' %} {% include 'menu_analytics.html' %}
{% endblock %} {% endblock %}

View File

@@ -29,6 +29,7 @@
<ul class="main-content"> <ul class="main-content">
<li class="grid_2"> <li class="grid_2">
<h2>Alert {{ alert.name }} for {{ alert.rower.user.first_name }}</h2> <h2>Alert {{ alert.name }} for {{ alert.rower.user.first_name }}</h2>
<p>Alert managed by {{ alert.manager.first_name }} {{ alert.manager.last_name }}</p>
<p> <p>
{{ formset.management_form }} {{ formset.management_form }}
{% csrf_token %} {% csrf_token %}
@@ -51,9 +52,11 @@
</li> </li>
</ul> </ul>
</form> </form>
{% endblock %}
{% block scripts %}
<!-- Include formset plugin - including jQuery dependency --> <!-- Include formset plugin - including jQuery dependency -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/static/js/jquery.formset.js"></script> <script src="/static/js/jquery.formset.js"></script>
<script> <script>
$('.fav-formset').formset({ $('.fav-formset').formset({
@@ -61,10 +64,29 @@
deleteText: '<div><p>&nbsp;</p></div><div>remove</div>' deleteText: '<div><p>&nbsp;</p></div><div>remove</div>'
}); });
</script> </script>
<script>
$( document ).ready(function() {
$('#id_workouttype').on('change', function(){
if (
$(this).val() == 'water'
|| $(this).val() == 'coastal'
|| $(this).val() == 'c-boat'
|| $(this).val() == 'churchboat'
) {
$('#id_boattype').toggle(true);
} else {
$('#id_boattype').toggle(false);
$('#id_boattype').val('1x');
}
});
$('#id_workouttype').change();
});
</script>
{% endblock %} {% endblock %}
{% block sidebar %} {% block sidebar %}
{% include 'menu_analytics.html' %} {% include 'menu_analytics.html' %}
{% endblock %} {% endblock %}

View File

@@ -22,6 +22,7 @@
<h2>{{ alert.name }}</h2> <h2>{{ alert.name }}</h2>
<p>{{ alert }}</p> <p>{{ alert }}</p>
<p>{{ alert.description }}</p> <p>{{ alert.description }}</p>
<p>Managed by {{ alert.manager.first_name }} {{ alert.manager.last_name }}</p>
</li> </li>
<li class="rounder"> <li class="rounder">
<h2>Score</h2> <h2>Score</h2>

View File

@@ -15,9 +15,11 @@
{% for alert in alerts %} {% for alert in alerts %}
<li class="rounder" id="alert_{{ alert.id }}"> <li class="rounder" id="alert_{{ alert.id }}">
<h2>{{ alert.name }}</h2> <h2>{{ alert.name }}</h2>
{% if alert.manager == request.user %}
<a class="small" href="/rowers/alerts/{{ alert.id }}/edit/" title="Edit"> <a class="small" href="/rowers/alerts/{{ alert.id }}/edit/" title="Edit">
<i class="fas fa-pencil-alt fa-fw"></i> <i class="fas fa-pencil-alt fa-fw"></i>
</a> </a>
{% endif %}
<a class="small" href="/rowers/alerts/{{ alert.id }}/delete/" <a class="small" href="/rowers/alerts/{{ alert.id }}/delete/"
title="Delete"> title="Delete">
<i class="fas fa-trash-alt fa-fw"></i> <i class="fas fa-trash-alt fa-fw"></i>

View File

@@ -21,7 +21,7 @@
<script> <script>
$( document ).ready(function() { $( document ).ready(function() {
$('#id_workouttype').on('change', function(){ $('#id_workouttype').on('change', function(){
if ( if (
$(this).val() == 'water' $(this).val() == 'water'
|| $(this).val() == 'coastal' || $(this).val() == 'coastal'