streamlined templates for easy navigation and missing info + handled fr.dbpedia tags
--- a/src/iconolab/models.py Fri Jul 01 15:37:42 2016 +0200
+++ b/src/iconolab/models.py Fri Jul 01 17:40:03 2016 +0200
@@ -242,10 +242,10 @@
def get_tags_json(self):
- def fetch_from_dbpedia(uri, lang):
+ def fetch_from_dbpedia(uri, lang, source):
sparql_template = 'select distinct * where { <<%uri%>> rdfs:label ?l FILTER( langMatches( lang(?l), "<%lang%>" ) ) }'
sparql_query = re.sub("<%uri%>", uri, re.sub("<%lang%>", lang, sparql_template))
- sparql_query_url = "http://dbpedia.org/sparql"
+ sparql_query_url = source+'sparql'
dbpedia_resp = requests.get(
sparql_query_url,
params={
@@ -275,8 +275,8 @@
"http://fr.dbpedia.org/": fetch_from_dbpedia
}
try:
- fetch_label = next(handling_function for base_uri, handling_function in externaL_repos_fetch_dict.items() if tag_link.startswith(base_uri))
- tag_label = fetch_label(tag_link, "fr")
+ (source, fetch_label) = next(item for item in externaL_repos_fetch_dict.items() if tag_link.startswith(item[0]))
+ tag_label = fetch_label(tag_link, "fr", source)
final_list.append({
"tag_label": tag_label,
"tag_link": tag_link,
--- a/src/iconolab/templates/iconolab/detail_annotation.html Fri Jul 01 15:37:42 2016 +0200
+++ b/src/iconolab/templates/iconolab/detail_annotation.html Fri Jul 01 17:40:03 2016 +0200
@@ -30,14 +30,15 @@
</div>
<div id="detail-annotation" class='col-xs-6' style="">
- <h4>Annotation</h4>
+ <h4>Annotation créée par {{ annotation.author.username }}</h4>
+
<p> <strong>Title:</strong> {{ annotation.current_revision.title }}</p>
<p> <strong>Description:</strong> {{ annotation.current_revision.description }}</p>
<p><strong>Tags:</strong></p>
<typeahead :read-only="1" :tags="{{ tags_data }}"></typeahead>
-
- <a href="{% url 'annotation_edit' collection_name image_guid annotation_guid %}">Editer</a> |
- <a href="{% url 'annotation_edit' collection_name image_guid annotation_guid %}">Proposer une révision</a>
+
+ <a href="{% url 'annotation_edit' collection_name image_guid annotation_guid %}">{% if user == annotation.creator %}Editer{% else %}Proposer une révision{% endif %}</a>
+
</div>
</div>
<div class='col-md-12'>
@@ -50,7 +51,14 @@
<p>{{ comment.comment }} </p>
<div style="font-size:0.9em">{{ comment.submit_date }} - <b>{{ comment.name }}</b>
{% if comment.allow_thread %} - <a href="{{ comment.get_reply_url }}">{% trans "Reply" %}</a>{% endif %}</div>
- {% if comment.revision %}<a href="{% url 'revision_detail' collection_name image_guid annotation_guid comment.revision.revision_guid %}"><span class="label label-success">View revision</span></a>{% endif %}
+ {% if comment.revision %}
+ <a href="{% url 'revision_detail' collection_name image_guid annotation_guid comment.revision.revision_guid %}">
+ <span class="label {% if comment.revision.author == annotation.author %}label-success{% else %}label-warning{% endif %}">
+
+ {% if comment.revision.author == annotation.author %}Voir révision{% else %}Voir proposition{% endif %}
+ </span>
+ </a>
+ {% endif %}
{% for metacategory in comment.metacategories.all %}
<span class="label label-info">{{metacategory.label}}</span>
{% endfor %}
--- a/src/iconolab/templates/iconolab/detail_revision.html Fri Jul 01 15:37:42 2016 +0200
+++ b/src/iconolab/templates/iconolab/detail_revision.html Fri Jul 01 17:40:03 2016 +0200
@@ -29,7 +29,7 @@
</div>
</div>
<div id="revision-detail" class='col-xs-6' style="">
- <h4>Annotation</h4>
+ <h4>Annotation révisée par {{ revision.author.username}} </h4>
<p> <strong>Title:</strong> {{ revision.title }}</p>
<p> <strong>Description:</strong> {{ revision.description }}</p>
<p><strong>Tags:</strong></p>
--- a/src/iconolab/templates/iconolab/home.html Fri Jul 01 15:37:42 2016 +0200
+++ b/src/iconolab/templates/iconolab/home.html Fri Jul 01 17:40:03 2016 +0200
@@ -6,4 +6,6 @@
{% load iconolab_tags %}
-{% block content %}globalhome{% endblock %}
\ No newline at end of file
+{% block content %}
+<h1>Fond Ingres <a href="{% url 'collection_home' 'ingres' %}"><span class="glyphicon glyphicon-link" aria-hidden="true"></span></a></h1>
+{% endblock %}
\ No newline at end of file