Binary file src/egonomy/locale/en/LC_MESSAGES/django.mo has changed
--- a/src/egonomy/locale/en/LC_MESSAGES/django.po Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/locale/en/LC_MESSAGES/django.po Fri Jul 12 13:42:06 2013 +0200
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-07-10 08:16-0500\n"
+"POT-Creation-Date: 2013-07-12 05:48-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -47,7 +47,7 @@
msgid "No title"
msgstr ""
-#: views.py:654 views.py:709
+#: views.py:654 views.py:708 views.py:743
msgid "You are not allowed to modify this collection."
msgstr ""
@@ -74,14 +74,16 @@
#: templates/egonomy_all_collections.html:34 templates/egonomy_newbase.html:48
#: templates/egonomy_view_collection.html:85
+#: templates/egonomy_view_collection.html:103
msgid "Cancel"
msgstr ""
#: templates/egonomy_all_collections.html:35 templates/egonomy_newbase.html:49
#: templates/egonomy_view_collection.html:86
+#: templates/egonomy_view_collection.html:104
#: templates/registration/password_change_form.html:9
#: templates/registration/password_reset_confirm.html:10
-#: templates/registration/password_reset_form.html:10
+#: templates/registration/password_reset_form.html:9
#: templates/registration/registration_form.html:9
msgid "Submit"
msgstr ""
@@ -204,7 +206,7 @@
msgstr ""
#: templates/egonomy_base.html:38 templates/egonomy_newbase.html:74
-#: templates/egonomy_view_collection.html:159
+#: templates/egonomy_view_collection.html:183
msgid "Search"
msgstr ""
@@ -214,6 +216,7 @@
#: templates/egonomy_base.html:49 templates/egonomy_newbase.html:90
#: templates/registration/activate.html:8
+#: templates/registration/activation_complete.html:8
#: templates/registration/password_reset_complete.html:7
msgid "Log in"
msgstr ""
@@ -292,7 +295,7 @@
msgid "Add to"
msgstr ""
-#: templates/egonomy_newbase.html:44
+#: templates/egonomy_newbase.html:44 templates/egonomy_view_collection.html:99
msgid "Image comment"
msgstr ""
@@ -301,6 +304,7 @@
msgstr ""
#: templates/egonomy_newbase.html:58
+#: templates/egonomy_view_collection.html:113
msgid "See the collection"
msgstr ""
@@ -364,29 +368,37 @@
msgid "Visible for everyone"
msgstr ""
-#: templates/egonomy_view_collection.html:114
+#: templates/egonomy_view_collection.html:93
+msgid "Modify the item's comment"
+msgstr ""
+
+#: templates/egonomy_view_collection.html:112
+msgid "The item was successfully modified"
+msgstr ""
+
+#: templates/egonomy_view_collection.html:138
msgid "Display"
msgstr ""
-#: templates/egonomy_view_collection.html:115
+#: templates/egonomy_view_collection.html:139
msgid "Hide"
msgstr ""
-#: templates/egonomy_view_collection.html:115
+#: templates/egonomy_view_collection.html:139
msgid "the comments"
msgstr ""
-#: templates/egonomy_view_collection.html:123
+#: templates/egonomy_view_collection.html:147
msgid ""
"Do you really want to delete this collection ? Warning : this action est "
"irreversible."
msgstr ""
-#: templates/egonomy_view_collection.html:123
+#: templates/egonomy_view_collection.html:147
msgid "Delete this collection"
msgstr ""
-#: templates/egonomy_view_collection.html:125
+#: templates/egonomy_view_collection.html:149
msgid "Collection parameters"
msgstr ""
@@ -502,7 +514,7 @@
msgid "Login"
msgstr ""
-#: templates/registration/login.html:9
+#: templates/registration/login.html:10
msgid "Sorry, that's not a valid username or password."
msgstr ""
@@ -510,11 +522,11 @@
msgid "login"
msgstr ""
-#: templates/registration/login.html:18
+#: templates/registration/login.html:19
msgid "Still not a user ? Create an account"
msgstr ""
-#: templates/registration/login.html:19
+#: templates/registration/login.html:20
msgid "Forgot password ?"
msgstr ""
Binary file src/egonomy/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/egonomy/locale/fr/LC_MESSAGES/django.po Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/locale/fr/LC_MESSAGES/django.po Fri Jul 12 13:42:06 2013 +0200
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-07-10 08:16-0500\n"
+"POT-Creation-Date: 2013-07-12 05:48-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -51,7 +51,8 @@
msgstr "Sans titre"
#: views.py:654
-#: views.py:709
+#: views.py:708
+#: views.py:743
msgid "You are not allowed to modify this collection."
msgstr "Vous n'êtes pas autorisé à modifier cette collection."
@@ -79,15 +80,17 @@
#: templates/egonomy_all_collections.html:34
#: templates/egonomy_newbase.html:48
#: templates/egonomy_view_collection.html:85
+#: templates/egonomy_view_collection.html:103
msgid "Cancel"
msgstr "Annuler"
#: templates/egonomy_all_collections.html:35
#: templates/egonomy_newbase.html:49
#: templates/egonomy_view_collection.html:86
+#: templates/egonomy_view_collection.html:104
#: templates/registration/password_change_form.html:9
#: templates/registration/password_reset_confirm.html:10
-#: templates/registration/password_reset_form.html:10
+#: templates/registration/password_reset_form.html:9
#: templates/registration/registration_form.html:9
msgid "Submit"
msgstr "Envoyer"
@@ -214,7 +217,7 @@
#: templates/egonomy_base.html:38
#: templates/egonomy_newbase.html:74
-#: templates/egonomy_view_collection.html:159
+#: templates/egonomy_view_collection.html:183
msgid "Search"
msgstr "Rechercher"
@@ -226,6 +229,7 @@
#: templates/egonomy_base.html:49
#: templates/egonomy_newbase.html:90
#: templates/registration/activate.html:8
+#: templates/registration/activation_complete.html:8
#: templates/registration/password_reset_complete.html:7
msgid "Log in"
msgstr "Se connecter"
@@ -305,6 +309,7 @@
msgstr "Ajouter à"
#: templates/egonomy_newbase.html:44
+#: templates/egonomy_view_collection.html:99
msgid "Image comment"
msgstr "Commentaire de l'image"
@@ -313,6 +318,7 @@
msgstr "L'élément a été ajouté avec succès à la collection"
#: templates/egonomy_newbase.html:58
+#: templates/egonomy_view_collection.html:113
msgid "See the collection"
msgstr "Voir la collection"
@@ -376,30 +382,38 @@
msgid "Visible for everyone"
msgstr "Visible pour tout le monde"
-#: templates/egonomy_view_collection.html:114
+#: templates/egonomy_view_collection.html:93
+msgid "Modify the item's comment"
+msgstr "Modifier le commentaire de cet élément"
+
+#: templates/egonomy_view_collection.html:112
+msgid "The item was successfully modified"
+msgstr "L'élément a été modifié avec succès"
+
+#: templates/egonomy_view_collection.html:138
msgid "Display"
msgstr "Afficher"
-#: templates/egonomy_view_collection.html:115
+#: templates/egonomy_view_collection.html:139
msgid "Hide"
msgstr "Masquer"
-#: templates/egonomy_view_collection.html:115
+#: templates/egonomy_view_collection.html:139
msgid "the comments"
msgstr "les commentaires"
-#: templates/egonomy_view_collection.html:123
+#: templates/egonomy_view_collection.html:147
msgid ""
"Do you really want to delete this collection ? Warning : this action est "
"irreversible."
msgstr "Voulez-vous vraiment supprimer cette collection ? Attention : cette action "
"est irréversible."
-#: templates/egonomy_view_collection.html:123
+#: templates/egonomy_view_collection.html:147
msgid "Delete this collection"
msgstr "Supprimer cette collection"
-#: templates/egonomy_view_collection.html:125
+#: templates/egonomy_view_collection.html:149
msgid "Collection parameters"
msgstr "Paramètres de la collection"
@@ -517,7 +531,7 @@
msgid "Login"
msgstr "Se connecter"
-#: templates/registration/login.html:9
+#: templates/registration/login.html:10
msgid "Sorry, that's not a valid username or password."
msgstr "Désolé, ce n'est pas un nom d'utilisateur ou un mot de passe valide."
@@ -525,11 +539,11 @@
msgid "login"
msgstr "Se connecter"
-#: templates/registration/login.html:18
+#: templates/registration/login.html:19
msgid "Still not a user ? Create an account"
msgstr "Vous n'avez pas de compte ? Créez un compte"
-#: templates/registration/login.html:19
+#: templates/registration/login.html:20
msgid "Forgot password ?"
msgstr "Mot de passe oublié ?"
@@ -547,7 +561,8 @@
#: templates/registration/password_reset_done.html:6
msgid "Email with password reset instructions has been sent."
-msgstr "L'email avec les instructions pour réinitialiser votre mot de passe a été envoyé."
+msgstr "L'email avec les instructions pour réinitialiser votre mot de passe a été "
+"envoyé."
#: templates/registration/password_reset_email.html:2
#, python-format
--- a/src/egonomy/static/egonomy/js/main.js Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/static/egonomy/js/main.js Fri Jul 12 13:42:06 2013 +0200
@@ -55,6 +55,11 @@
$('#add-to-collection .item-type').val($(this).attr('data-type'));
$('#add-to-collection .item-id').val($(this).attr('data-id'));
});
+ // modify item in collection behaviour
+ $('.modifyitemincollection').bind('click', function(e){
+ $('#modify-item .item-pk').val($(this).attr('data-pk'));
+ $('#modify-item .item-description').val($(this).attr('data-description'));
+ });
$(".ajax-form").submit(function(e) { // On submit Ajax Form
@@ -64,11 +69,25 @@
type: formel.attr("method"),
data: formel.serialize(),
success: function(text) {
- $('.popin-wrap').fadeIn(function(){
- $(".additem-success").show();
- });
- //console.log("received : " + text);
- $(".additem-success .collection-url").attr("href", text);
+ // different behaviour if we add or modify an item
+ if(text=="modifyok"){
+ // modify
+ $('.popin-wrap').fadeIn(function(){
+ $(".modifyitem-success").show();
+ });
+ // update text. $("item{{ item.pk }}") is the <div> with the text as <p> and <a data-description>
+ var item_pk = $('#modify-item .item-pk').val();
+ var item_desc = $('#modify-item .item-description').val();
+ $("#item" + item_pk).find("a").attr("data-description", item_desc);
+ $("#item" + item_pk).find("p").html(item_desc.replace(/\n/g, '<br />'));
+ }
+ else{
+ // add
+ $('.popin-wrap').fadeIn(function(){
+ $(".additem-success").show();
+ });
+ $(".additem-success .collection-url").attr("href", text);
+ }
},
error: function() {
$('.popin-wrap').fadeIn(function(){
--- a/src/egonomy/templates/egonomy_view_collection.html Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/templates/egonomy_view_collection.html Fri Jul 12 13:42:06 2013 +0200
@@ -88,6 +88,30 @@
</form>
</section>
</div>
+ <div id="modify-item" class="popin popin-modify-item box-shadow">
+ <header>
+ <h2>{% trans "Modify the item's comment" %}</h2>
+ <a href="#" class="close-popin"></a>
+ </header>
+ <section>
+ <form class="ajax-form" action="{% url 'modify_item' %}" method="POST">
+ <p>
+ <label class="block" for="item-description">{% trans "Image comment" %} :</label>
+ <textarea name="item-description" class="item-description"></textarea>
+ </p>
+ <div class="buttons">
+ <a href="#" class="btn close-popin">{% trans "Cancel" %}</a>
+ <input class="btn" type="submit" value="{% trans 'Submit' %}">
+ </div>
+ <input name="collection_pk" type="hidden" value="{{ col.pk }}">
+ <input class="item-pk" name="item-pk" type="hidden" value="">{% csrf_token %}
+ </form>
+ </section>
+ </div>
+ <div class="popin modifyitem-success box-shadow">
+ <h2>{% trans "The item was successfully modified" %}</h2>
+ <!--h2><a class="collection-url" href="#">{% trans "See the collection" %}</a></h2-->
+ </div>
{% endifequal %}
{% endif %}
{% endblock %}
--- a/src/egonomy/templates/partial/item_in_collection_list.html Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/templates/partial/item_in_collection_list.html Fri Jul 12 13:42:06 2013 +0200
@@ -30,13 +30,13 @@
</ul>
</div>
</div>
- <div class="col-right">
+ <div id="item{{ item.pk }}" class="col-right">
<div class="project-title">
- {% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
+ {% if col.author == user %}<a class="tool edit toggle open-popin modifyitemincollection" data-pk="{{ item.pk }}" data-description="{{ item.description }}" href="#modify-item" title="{% trans "Modify the item's comment" %}"></a>{% endif %}
<h3>{{ fragment.title }}</h3>
<h4>{{ fragment.author }}</h4>
</div>
- <p>{{ item.description }}</p>
+ <p>{{ item.description|linebreaksbr }}</p>
</div>
{% endwith %}
</li>
@@ -68,7 +68,7 @@
{% else %}
<li class="clearfix horizontal item-masonry">
<div class="col-left">
- <a href="{% url 'annotate_picture' image_id=img.id %}">>
+ <a href="{% url 'annotate_picture' image_id=img.id %}">
<img src="{% static 'egonomy/img/empty.gif' %}" width=225" height="225" class="placeholder" />
</a>
{% endif %}
@@ -88,13 +88,13 @@
</ul>
</div>
</div>
- <div class="col-right">
+ <div id="item{{ item.pk }}" class="col-right">
<div class="project-title">
- {% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
+ {% if col.author == user %}<a class="tool edit toggle open-popin modifyitemincollection" data-pk="{{ item.pk }}" data-description="{{ item.description }}" href="#modify-item" title="{% trans "Modify the item's comment" %}"></a>{% endif %}
<h3>{{ img.metadata.titre }}</h3>
<h4>{{ img.metadata.auteur|default:"" }}</h4>
</div>
- <p>{{ item.description }}</p>
+ <p>{{ item.description|linebreaksbr }}</p>
</div>
</li>
{% endwith %}
--- a/src/egonomy/templates/partial/item_in_collection_mosaic.html Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/templates/partial/item_in_collection_mosaic.html Fri Jul 12 13:42:06 2013 +0200
@@ -34,13 +34,13 @@
{% endifequal %}{% endif %}
</ul>
</div>
- <div class="content-project">
+ <div id="item{{ item.pk }}" class="content-project">
<div class="project-title">
- {% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
+ {% if col.author == user %}<a class="tool edit toggle open-popin modifyitemincollection" data-pk="{{ item.pk }}" data-description="{{ item.description }}" href="#modify-item" title="{% trans "Modify the item's comment" %}"></a>{% endif %}
<h3>{{ fragment.title }}</h3>
<h4>{{ fragment.author }}</h4>
</div>
- <p>{{ item.description }}</p>
+ <p>{{ item.description|linebreaksbr }}</p>
</div>
{% endwith %}
{% else %}
@@ -76,13 +76,13 @@
{% endifequal %}{% endif %}
</ul>
</div>
- <div class="content-project">
+ <div id="item{{ item.pk }}" class="content-project">
<div class="project-title">
- {% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
+ {% if col.author == user %}<a class="tool edit toggle open-popin modifyitemincollection" data-pk="{{ item.pk }}" data-description="{{ item.description }}" href="#modify-item" title="{% trans "Modify the item's comment" %}"></a>{% endif %}
<h3>{{ img.metadata.titre }}</h3>
<h4>{{ img.metadata.auteur }}</h4>
</div>
- <p>{{ item.description }}</p>
+ <p>{{ item.description|linebreaksbr }}</p>
</div>
{% endwith %}
{% endwith %}
--- a/src/egonomy/urls.py Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/urls.py Fri Jul 12 13:42:06 2013 +0200
@@ -26,6 +26,7 @@
url(r'^viewcollection/(?P<collection_pk>.*)/$', 'egonomy.views.view_collection', name='view_collection'),
url(r'^additem/$', 'egonomy.views.add_item_to_collection', name='add_item'),
url(r'^removeitem/$', 'egonomy.views.remove_item_from_collection', name='remove_item'),
+ url(r'^modifyitem/$', 'egonomy.views.modify_item_in_collection', name='modify_item'),
url(r'^embedslideshow/(?P<collection_pk>.*)/$', 'egonomy.views.embed_slideshow', name='embed_slideshow'),
url(r'^picturebysearch/$', 'egonomy.views.picture_by_search', name='picture_by_search'),
url(r'^fragmentbysearch/$', 'egonomy.views.fragment_by_search', name='fragment_by_search'),
--- a/src/egonomy/views.py Wed Jul 10 19:06:54 2013 +0200
+++ b/src/egonomy/views.py Fri Jul 12 13:42:06 2013 +0200
@@ -688,7 +688,6 @@
-
def remove_item_from_collection(request):
col_pk = request.GET["collection_pk"] or None
@@ -707,13 +706,13 @@
# We check if the current user is the collection's author
if col.author != request.user:
return HttpResponseForbidden(_("You are not allowed to modify this collection."))
- # We update the collection's modification date because by create an item we don't really touch the collection objet
+ # We update the collection's modification date because by creating an item we don't touch the collection object
col.modification = datetime.now()
col.save()
# Test item's pk
if not item_pk:
- return HttpResponse("item-id must be set.", status_code=400)
+ return HttpResponse("item_pk must be set.", status_code=400)
# Get item
item = get_object_or_404(CollectionItem, pk=item_pk)
# Everything has been checked, we can delete the item
@@ -724,3 +723,41 @@
# It is an ajax call, everything is saved and we return the collection's url
#return HttpResponse(reverse("view_collection", args=[col_pk]))
+
+
+@login_required
+def modify_item_in_collection(request):
+
+ item_pk = request.POST["item-pk"] or None
+ col_pk = request.POST["collection_pk"] or None
+ description = request.POST["item-description"] or None
+
+ # Test collection
+ try:
+ col_pk = int(col_pk)
+ except:
+ return HttpResponse("Collection number invalid.", status_code=400)
+ col = get_object_or_404(Collection.objects.select_related('author'), pk=col_pk)
+ # We check if the current user is the collection's author
+ if col.author != request.user:
+ return HttpResponseForbidden(_("You are not allowed to modify this collection."))
+ # We update the collection's modification date because by modifying an item we don't touch the collection object
+ col.modification = datetime.now()
+ col.save()
+
+ # Test item's pk
+ if not item_pk:
+ return HttpResponse("item_pk must be set.", status_code=400)
+ # Get item
+ item = get_object_or_404(CollectionItem, pk=item_pk)
+ if item.collection != col:
+ return HttpResponse("Item and collection are not related.", status_code=400)
+ # Everything has been checked, we can modify and save the item
+ item.description = description
+ item.save()
+
+ # It is an ajax call, we juste return "ok"
+ return HttpResponse("modifyok")
+
+
+