bgneal@704
|
1 {% extends 'base.html' %}
|
bgneal@704
|
2 {% load bio_tags %}
|
bgneal@704
|
3 {% block title %}Photo Gallery for {{ gallery_owner.username }}{% endblock %}
|
bgneal@717
|
4 {% block custom_css %}
|
bgneal@717
|
5 <link rel="stylesheet" href="{{ STATIC_URL }}css/user_photos.css" />
|
bgneal@717
|
6 {% endblock %}
|
bgneal@718
|
7 {% block custom_js %}
|
bgneal@718
|
8 {% if user == gallery_owner %}
|
bgneal@718
|
9 <script>
|
bgneal@718
|
10 function confirmPhotoDelete(submit)
|
bgneal@718
|
11 {
|
bgneal@718
|
12 var n = $("#photo-delete input[type='checkbox']:checked").length;
|
bgneal@718
|
13 if (n == 0)
|
bgneal@718
|
14 {
|
bgneal@718
|
15 alert("Please select some photos to delete.");
|
bgneal@718
|
16 return false;
|
bgneal@718
|
17 }
|
bgneal@718
|
18
|
bgneal@718
|
19 var msg = [
|
bgneal@718
|
20 "Are you sure you want to delete these photos?\n",
|
bgneal@718
|
21 "This will cause broken images in any posts you pasted them in. ",
|
bgneal@718
|
22 "To fix this you can edit the posts."
|
bgneal@718
|
23 ].join("");
|
bgneal@718
|
24 var result = confirm(msg);
|
bgneal@718
|
25 if (result)
|
bgneal@718
|
26 {
|
bgneal@718
|
27 submit.disabled = true;
|
bgneal@718
|
28 submit.value = "Please wait...";
|
bgneal@718
|
29 }
|
bgneal@718
|
30 return result;
|
bgneal@718
|
31 }
|
bgneal@718
|
32 </script>
|
bgneal@718
|
33 {% endif %}
|
bgneal@718
|
34 {% endblock %}
|
bgneal@704
|
35 {% block content %}
|
bgneal@704
|
36
|
bgneal@704
|
37 <h2>Photo Gallery for {{ gallery_owner.username }}</h2>
|
bgneal@704
|
38
|
bgneal@704
|
39 {% if user == gallery_owner %}
|
bgneal@710
|
40 {% if messages %}
|
bgneal@710
|
41 <ul class="user-messages">
|
bgneal@710
|
42 {% for message in messages %}
|
bgneal@710
|
43 <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
bgneal@710
|
44 {% endfor %}
|
bgneal@710
|
45 {% endif %}
|
bgneal@704
|
46 <p>
|
bgneal@704
|
47 You have uploaded {{ paginator.count }} photo{{ paginator.count|pluralize }}.
|
bgneal@704
|
48 Would you like to <a href="{% url 'user_photos-upload' %}">upload a photo</a>?
|
bgneal@704
|
49 </p>
|
bgneal@704
|
50 {% else %}
|
bgneal@704
|
51 <p>
|
bgneal@704
|
52 {% profile_link gallery_owner.username %} has uploaded {{ paginator.count }} photo{{ paginator.count|pluralize }}.
|
bgneal@704
|
53 </p>
|
bgneal@704
|
54 {% endif %}
|
bgneal@704
|
55
|
bgneal@704
|
56 {% if photos %}
|
bgneal@710
|
57 {% if user == gallery_owner %}
|
bgneal@718
|
58 <form id="photo-delete" action="{% url 'user_photos-delete' %}" method="post"
|
bgneal@718
|
59 onsubmit="return confirmPhotoDelete(submit);" >{% csrf_token %}
|
bgneal@710
|
60 {% for photo in photos %}
|
bgneal@717
|
61 <div class="user_photo owner_photo">
|
bgneal@710
|
62 <a href="{{ photo.get_absolute_url }}">
|
bgneal@710
|
63 <img src="{{ photo.thumb_url }}" alt="thumbnail"
|
bgneal@717
|
64 title="{{ photo.upload_date|date }}" /></a>
|
bgneal@710
|
65 <br />
|
bgneal@710
|
66 <div class="centered">
|
bgneal@710
|
67 <input type="checkbox" name="photo_id" value="{{ photo.id }}"></input>
|
bgneal@710
|
68 </div>
|
bgneal@710
|
69 </div>
|
bgneal@710
|
70 {% endfor %}
|
bgneal@710
|
71 <br />
|
bgneal@710
|
72 <input type="submit" name="submit" value="Delete Checked Photos" />
|
bgneal@710
|
73 </form>
|
bgneal@710
|
74 {% else %}
|
bgneal@710
|
75 {% for photo in photos %}
|
bgneal@717
|
76 <div class="user_photo">
|
bgneal@710
|
77 <a href="{{ photo.get_absolute_url }}">
|
bgneal@710
|
78 <img src="{{ photo.thumb_url }}" alt="thumbnail"
|
bgneal@710
|
79 title="{{ photo.upload_date|date }}" /></a>
|
bgneal@710
|
80 </div>
|
bgneal@710
|
81 {% endfor %}
|
bgneal@710
|
82 {% endif %}
|
bgneal@704
|
83
|
bgneal@704
|
84 {% if page_obj %}
|
bgneal@717
|
85 <hr class="footer_divider" />
|
bgneal@704
|
86 {% include 'core/django_pagination.html' %}
|
bgneal@704
|
87 {% endif %}
|
bgneal@704
|
88 {% endif %}
|
bgneal@704
|
89
|
bgneal@704
|
90 {% endblock %}
|