Skip to content

Commit ba75be8

Browse files
committed
Surface a button for "duplicate trip"
I recently implemented this functionality, but kept the URL hidden & otherwise undocumented. I was hoping to totally refactor `trip_edit_buttons` so that more code lives in Python (where it can be typechecked and otherwise more robustly tested). However, this is hopefully a step in that direction.
1 parent 3dd90f2 commit ba75be8

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

ws/templates/for_templatetags/trip_edit_buttons.html

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
{% if is_chair or is_creator or is_trip_leader %}
2-
{# Show label that describes all available functions #}
3-
<h4>
4-
{% if is_chair %}
5-
Activity chair
6-
{% elif is_creator %}
7-
Creator
8-
{% elif is_trip_leader %}
9-
Leader
10-
{% endif %}
11-
functions
12-
</h4>
13-
14-
<div class="btn-group" role="group">
1+
<div class="btn-group" role="group">
2+
{% if is_chair or is_creator or is_trip_leader %}
153
<a type="button" class="btn btn-default" href="{% url 'edit_trip' trip.pk %}" ><i class="fas fa-edit" ></i>&nbsp;Edit</a>
164
<a type="button" class="btn btn-default" href="{% url 'trip_medical' trip.pk %}"><i class="fas fa-medkit"></i>&nbsp;WIMP info</a>
175

@@ -51,10 +39,11 @@ <h4>
5139
</button>
5240
{% endif %}
5341
{% endif %}
54-
</div>
55-
56-
{% if is_creator or is_chair %} {# Other trip leaders cannot delete the trip #}
57-
<data-delete class="pull-right" data-api-slug="trips" data-obj-id="{{ trip.pk }}"></data-delete>
5842
{% endif %}
5943

44+
<a type="button" class="btn btn-default" href="{% url 'create_trip' %}?duplicate_trip_id={{ trip.pk }}"><i class="fas fa-copy" ></i>&nbsp;Duplicate</a>
45+
</div>
46+
47+
{% if is_creator or is_chair %} {# Other trip leaders cannot delete the trip #}
48+
<data-delete class="pull-right" data-api-slug="trips" data-obj-id="{{ trip.pk }}"></data-delete>
6049
{% endif %}

ws/templates/trips/view.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
{% endif %}
1414

1515
{% if can_admin or viewing_participant.is_leader %}
16-
{% if can_admin %}
17-
{% trip_edit_buttons trip viewing_participant user %}
18-
{% endif %}
16+
{% trip_edit_buttons trip viewing_participant user %}
1917

2018
<div data-ng-controller="tripTabManager">
2119
<uib-tabset id="admin-trip-tabs">

0 commit comments

Comments
 (0)