| author | cavaliet |
| Wed, 27 Feb 2013 18:42:19 +0100 | |
| changeset 74 | 5a3d8a3eb34d |
| parent 71 | 14c40542dfbb |
| child 78 | 67d3fb0e54a6 |
| permissions | -rw-r--r-- |
| 15 | 1 |
{% extends "egonomy_base.html" %} |
2 |
{% load static %} |
|
3 |
{% load i18n %} |
|
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
4 |
{% load thumbnail %} |
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
5 |
{% load egonomy_thumbnail %} |
| 15 | 6 |
|
7 |
{% block title %}{% trans "View a fragment" %}{% endblock %} |
|
8 |
||
9 |
{% block content %} |
|
10 |
<div class="fullwidth"> |
|
11 |
<div class="column column-half"> |
|
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
12 |
<h2>{{ fragment.title }}</h2> |
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
13 |
<div class="center-image"> |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
14 |
<div class="image-and-fragment"> |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
15 |
{% with fragment.image.info.image_file as image %} |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
16 |
{% if image|ratio > 0.8 %} |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
17 |
{% thumbnail image "476" format="PNG" crop="center" as im %} |
| 74 | 18 |
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" class="sub_svg_image"/> |
19 |
<svg preserveAspectRatio="none" width="{{ im.width }}" height="{{ im.height }}" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
|
20 |
<defs> |
|
21 |
<clipPath id="fragment-clip{{ fragment.pk }}"> |
|
22 |
<path d="{{ fragment.coordinates }}" /> |
|
23 |
</clipPath> |
|
24 |
</defs> |
|
25 |
<image xlink:href="{{ im.url }}" x="0" y="0" preserveAspectRatio="none" width="1" height="1" clip-path="url(#fragment-clip{{ fragment.pk }})"/> |
|
26 |
</svg> |
|
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
27 |
{% empty %} |
| 74 | 28 |
<img src="{% static 'egonomy/img/empty.gif' %}" width="476" height="476" class="placeholder sub_svg_image" /> |
29 |
<svg preserveAspectRatio="none" width="476" height="476" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
|
30 |
<defs> |
|
31 |
<clipPath id="fragment-clip{{ fragment.pk }}"> |
|
32 |
<path d="{{ fragment.coordinates }}" /> |
|
33 |
</clipPath> |
|
34 |
</defs> |
|
35 |
<image xlink:href="{% static 'egonomy/img/empty.gif' %}" x="0" y="0" preserveAspectRatio="none" width="1" height="1" clip-path="url(#fragment-clip{{ fragment.pk }})"/> |
|
36 |
</svg> |
|
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
37 |
{% endthumbnail %} |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
38 |
{% else %} |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
39 |
{% thumbnail image "x600" format="PNG" crop="center" as im %} |
| 74 | 40 |
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" class="sub_svg_image sub_svg_image"/> |
41 |
<svg preserveAspectRatio="none" width="{{ im.width }}" height="{{ im.height }}" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
|
42 |
<defs> |
|
43 |
<clipPath id="fragment-clip{{ fragment.pk }}"> |
|
44 |
<path d="{{ fragment.coordinates }}" /> |
|
45 |
</clipPath> |
|
46 |
</defs> |
|
47 |
<image xlink:href="{{ im.url }}" x="0" y="0" preserveAspectRatio="none" width="1" height="1" clip-path="url(#fragment-clip{{ fragment.pk }})"/> |
|
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
48 |
{% empty %} |
| 74 | 49 |
<img src="{% static 'egonomy/img/empty.gif' %}" width="476" height="476" class="placeholder sub_svg_image" /> |
50 |
<svg preserveAspectRatio="none" width="476" height="476" viewBox="0 0 1 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
|
51 |
<defs> |
|
52 |
<clipPath id="fragment-clip{{ fragment.pk }}"> |
|
53 |
<path d="{{ fragment.coordinates }}" /> |
|
54 |
</clipPath> |
|
55 |
</defs> |
|
56 |
<image xlink:href="{% static 'egonomy/img/empty.gif' %}" x="0" y="0" preserveAspectRatio="none" width="1" height="1" clip-path="url(#fragment-clip{{ fragment.pk }})"/> |
|
57 |
</svg> |
|
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
58 |
{% endthumbnail %} |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
59 |
{% endif %} |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
60 |
{% endwith %} |
| 74 | 61 |
<!--svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none"> |
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
62 |
<path d="{{ fragment.coordinates }}" stroke="red" stroke-width=".002" fill="red" fill-opacity=".3" /> |
| 74 | 63 |
</svg--> |
|
48
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
64 |
</div> |
|
4c0838a3a8b6
add limit 600px height limit in template. Create templatetag to get image ratio.
cavaliet
parents:
27
diff
changeset
|
65 |
</div> |
| 15 | 66 |
</div> |
67 |
<div class="column column-half"> |
|
68 |
<form action="#"> |
|
69 |
<table class="image-metadata"> |
|
70 |
<tr> |
|
71 |
<th>{% trans "Source picture" %} :</th> |
|
| 51 | 72 |
<td><a href="{% url 'annotate_picture' image_id=fragment.image.id %}">{{ fragment.image.metadata.titre|default:_("No title") }}</a></td> |
| 15 | 73 |
</tr> |
74 |
<tr> |
|
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
75 |
<th>{% trans "Fragment's description" %} :</th> |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
76 |
<td>{{ fragment.description }}</td> |
| 15 | 77 |
</tr> |
78 |
<tr> |
|
79 |
<th>{% trans "Users keywords" %}</th> |
|
|
27
daaafc916dc4
Debug in templates. All fragments page added. Language files updated.
cavaliet
parents:
25
diff
changeset
|
80 |
<td>{{ fragment.tags }}</td> |
| 15 | 81 |
</tr> |
82 |
<tr> |
|
83 |
<th>{% trans "Last modification" %} :</th> |
|
| 71 | 84 |
<td>{{ fragment.date_saved }} {% trans 'by' %} <strong><a href="{% url 'user_fragments' username=fragment.author %}">{{ fragment.author }}</a></strong></td> |
| 15 | 85 |
</tr> |
| 71 | 86 |
{% ifequal user fragment.author %} |
87 |
<tr> |
|
88 |
<th> </th> |
|
89 |
<td><a href="{% url 'create_fragment' image_id=fragment.image.id fragment_pk=fragment.pk %}" class="big-button">{% trans "Modify this fragment" %}</a></td> |
|
90 |
</tr> |
|
91 |
{% endifequal %} |
|
| 15 | 92 |
</table> |
93 |
</form> |
|
|
25
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
94 |
<div class="fullwidth"> |
|
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
95 |
<a href="{% url 'create_fragment' image_id=fragment.image.id %}" class="big-button">{% trans "Create a fragment" %}</a> |
|
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
96 |
</div> |
| 15 | 97 |
</div> |
98 |
</div> |
|
99 |
<div class="fullwidth"> |
|
100 |
<div class="column column-full"> |
|
101 |
<h2>{% trans "Fragments from this picture" %}</h2> |
|
102 |
<ul class="fullwidth"> |
|
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
103 |
{% for frg in fragment_list %} |
| 15 | 104 |
<li class="subcol subcol-eighth"> |
|
27
daaafc916dc4
Debug in templates. All fragments page added. Language files updated.
cavaliet
parents:
25
diff
changeset
|
105 |
<a href="{% url 'view_fragment' fragment_pk=frg.pk %}"> |
| 15 | 106 |
<div class="center-image"> |
107 |
<div class="image-and-fragment"> |
|
|
25
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
108 |
{% with frg.image.info.image_file as image %} |
|
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
109 |
{% if image %} |
|
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
110 |
{% if image|is_portrait %} |
|
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
111 |
{% thumbnail image "x110" format="PNG" crop="center" as im %} |
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
112 |
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/> |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
113 |
{% empty %} |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
114 |
<img src="{% static 'egonomy/img/empty.gif' %}" width="110" height="110" class="placeholder" /> |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
115 |
{% endthumbnail %} |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
116 |
{% else %} |
|
25
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
117 |
{% thumbnail image "110" format="PNG" crop="center" as im %} |
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
118 |
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/> |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
119 |
{% empty %} |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
120 |
<img src="{% static 'egonomy/img/empty.gif' %}" width=110" height="110" class="placeholder" /> |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
121 |
{% endthumbnail %} |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
122 |
{% endif %} |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
123 |
{% else %} |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
124 |
<img src="{% static 'egonomy/img/empty.gif' %}" width=110" height="110" class="placeholder" /> |
|
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
125 |
{% endif %} |
|
25
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
126 |
{% endwith %} |
| 15 | 127 |
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none"> |
|
25
48614929b87a
Real sort on home. Real pict's fragment on other pages. Real links on intelligent pagination.
cavaliet
parents:
23
diff
changeset
|
128 |
<path d="{{ frg.coordinates }}" stroke="red" stroke-width=".02" fill="red" fill-opacity=".3" /> |
| 15 | 129 |
</svg> |
130 |
</div> |
|
131 |
</div> |
|
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
132 |
<h3>{{ frg.title }}</h3></a> |
| 67 | 133 |
<p>{% trans "Annotated by" %} <strong><a href="{% url 'user_fragments' username=frg.author %}">{{ frg.author }}</a></strong></p> |
| 15 | 134 |
</li> |
|
18
ffd106d9b8e1
Prepare template for real datas. Some fake datas temporary generated in views.
cavaliet
parents:
15
diff
changeset
|
135 |
{% endfor %} |
| 15 | 136 |
</ul> |
137 |
</div> |
|
138 |
</div> |
|
139 |
{% endblock %} |
|
140 |