Clickable tags to easily add tags from rmn and pertimm.
--- a/src/egonomy/models.py Mon Feb 25 17:19:45 2013 +0100
+++ b/src/egonomy/models.py Mon Feb 25 18:32:06 2013 +0100
@@ -39,8 +39,20 @@
thesaurus_pertimm = models.TextField(null=True, blank=True)
@property
- def thesaurus_pertimm_str(self):
- return self.thesaurus_pertimm.replace("|", ",")
+ def mots_cles_list(self):
+ return self.mots_cles.split(",")
+
+ @property
+ def titre_pertimm_list(self):
+ return self.titre_pertimm.split(",")
+
+ @property
+ def description_pertimm_list(self):
+ return self.description_pertimm.split(",")
+
+ @property
+ def thesaurus_pertimm_list(self):
+ return self.thesaurus_pertimm.replace("|", ",").split(",")
class ImageInfo(models.Model):
--- a/src/egonomy/static/egonomy/css/egonomy.css Mon Feb 25 17:19:45 2013 +0100
+++ b/src/egonomy/static/egonomy/css/egonomy.css Mon Feb 25 18:32:06 2013 +0100
@@ -343,7 +343,7 @@
}
/* add tags buttons style */
-.add_tag_btn:hover{
+.clickable:hover{
text-decoration: underline;
cursor: hand; cursor: pointer;
}
--- a/src/egonomy/templates/egonomy_all_fragments.html Mon Feb 25 17:19:45 2013 +0100
+++ b/src/egonomy/templates/egonomy_all_fragments.html Mon Feb 25 18:32:06 2013 +0100
@@ -17,7 +17,7 @@
{% endifequal %}
<span class="right"><a href="{% url 'all_fragments' %}" alt="{% trans "All fragments" %}">{% trans "All fragments" %}</a></span></h2>
{% elif user_fragments %}
- <h2>{% trans "Fragments created by" %} : {{ username }}</h2>
+ <h2>{% trans "Fragments created by" %} : {{ username }}
<span class="right"><a href="{% url 'all_fragments' %}" alt="{% trans "All fragments" %}">{% trans "All fragments" %}</a></span></h2>
{% else %}
<h2>{% trans "All fragments" %}</h2>
--- a/src/egonomy/templates/egonomy_annotate_picture.html Mon Feb 25 17:19:45 2013 +0100
+++ b/src/egonomy/templates/egonomy_annotate_picture.html Mon Feb 25 18:32:06 2013 +0100
@@ -69,7 +69,7 @@
</tr>
<tr>
<th>{% trans "Pertimm thesaurus" %} :</th>
- <td>{{ img.metadata.thesaurus_pertimm_str|default:"" }}</td>
+ <td>{{ img.metadata.thesaurus_pertimm_list|join:","|default:"" }}</td>
</tr>
<!--tr>
<th> </th>
@@ -77,7 +77,7 @@
</tr-->
<tr>
<th>{% trans "Last fragment created" %} :</th>
- <td>{% if last_frg %}<a href="{% url 'view_fragment' fragment_pk=last_frg.pk %}">{{ last_frg.title }}</a>, {{ last_frg.date_saved }} {% trans 'by' %} <strong>{{ last_frg.author }}</strong>{% endif %}</td>
+ <td>{% if last_frg %}<a href="{% url 'view_fragment' fragment_pk=last_frg.pk %}">{{ last_frg.title }}</a>, {{ last_frg.date_saved }} {% trans 'by' %} <strong><a href="{% url 'user_fragments' username=last_frg.author %}">{{ last_frg.author }}</a></strong>{% endif %}</td>
</tr>
</table>
</form>
--- a/src/egonomy/templates/egonomy_base.html Mon Feb 25 17:19:45 2013 +0100
+++ b/src/egonomy/templates/egonomy_base.html Mon Feb 25 18:32:06 2013 +0100
@@ -44,7 +44,7 @@
</form>
<nav class="column column-third">
{% if user.is_authenticated %}
- {{ user.username }} : <a href="{% url 'logout' %}?next={% url 'home' %}">{% trans "Log out" %}</a>
+ <a href="{% url 'user_fragments' username=user %}">{{ user.username }}</a> : <a href="{% url 'logout' %}?next={% url 'home' %}">{% trans "Log out" %}</a>
{% else %}
<a href="{% url 'login' %}">{% trans "Log in" %}</a>
{% endif %}
--- a/src/egonomy/templates/egonomy_create_fragment.html Mon Feb 25 17:19:45 2013 +0100
+++ b/src/egonomy/templates/egonomy_create_fragment.html Mon Feb 25 18:32:06 2013 +0100
@@ -23,24 +23,27 @@
window.onload = function() {
if($("#add_rmn_tags")){
$("#add_rmn_tags").click(function() {
- addTags($("#rmn_tags").html().split(','))
+ addTags($("#rmn_tags").text().split(','))
});
}
if($("#add_pertimm_title")){
$("#add_pertimm_title").click(function() {
- addTags($("#pertimm_title_tags").html().split(','))
+ addTags($("#pertimm_title_tags").text().split(','))
});
}
if($("#add_pertimm_description")){
$("#add_pertimm_description").click(function() {
- addTags($("#pertimm_description_tags").html().split(','))
+ addTags($("#pertimm_description_tags").text().split(','))
});
}
if($("#add_pertimm_thesaurus")){
$("#add_pertimm_thesaurus").click(function() {
- addTags($("#pertimm_thesaurus_tags").html().split(','))
+ addTags($("#pertimm_thesaurus_tags").text().split(','))
});
}
+ $(".addable_tag").click(function() {
+ addTags([$(this).text()])
+ });
};
function addTags(tags){
nt = tags.length;
@@ -106,25 +109,29 @@
{% if img.metadata.mots_cles %}
<tr>
<th>{% trans 'RMN keywords' %} :</th>
- <td><span id="rmn_tags">{{ img.metadata.mots_cles }}</span><br/><span id="add_rmn_tags" class="right add_tag_btn">+ {% trans 'Add RMN keywords to yours' %}</span></td>
+ <td><span id="rmn_tags">{% for t in img.metadata.mots_cles_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
+ <br/><span id="add_rmn_tags" class="right clickable">+ {% trans 'Add all RMN keywords to yours' %}</span></td>
</tr>
{% endif %}
{% if img.metadata.titre_pertimm %}
<tr>
<th>{% trans "Pertimm title" %} :</th>
- <td><span id="pertimm_title_tags">{{ img.metadata.titre_pertimm|default:"" }}</span><br/><span id="add_pertimm_title" class="right add_tag_btn">+ {% trans 'Add Pertimm title keywords to yours' %}</span></td>
+ <td><span id="pertimm_title_tags">{% for t in img.metadata.titre_pertimm_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
+ <br/><span id="add_pertimm_title" class="right clickable">+ {% trans 'Add all Pertimm title keywords to yours' %}</span></td>
</tr>
{% endif %}
{% if img.metadata.description_pertimm %}
<tr>
<th>{% trans "Pertimm description" %} :</th>
- <td><span id="pertimm_description_tags">{{ img.metadata.description_pertimm|default:"" }}</span><br/><span id="add_pertimm_description" class="right add_tag_btn">+ {% trans 'Add Pertimm description keywords to yours' %}</span></td>
+ <td><span id="pertimm_description_tags">{% for t in img.metadata.description_pertimm_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
+ <br/><span id="add_pertimm_description" class="right clickable">+ {% trans 'Add all Pertimm description keywords to yours' %}</span></td>
</tr>
{% endif %}
{% if img.metadata.thesaurus_pertimm %}
<tr>
<th>{% trans "Pertimm thesaurus" %} :</th>
- <td><span id="pertimm_thesaurus_tags">{{ img.metadata.thesaurus_pertimm_str|default:"" }}</span><br/><span id="add_pertimm_thesaurus" class="right add_tag_btn">+ {% trans 'Add Pertimm thesaurus keywords to yours' %}</span></td>
+ <td><span id="pertimm_thesaurus_tags">{% for t in img.metadata.thesaurus_pertimm_list %}<span class="clickable addable_tag">{{ t }}</span>{% if not forloop.last %}, {% endif %}{% endfor %}</span>
+ <br/><span id="add_pertimm_thesaurus" class="right clickable">+ {% trans 'Add all Pertimm thesaurus keywords to yours' %}</span></td>
</tr>
{% endif %}
</table>