# HG changeset patch # User cavaliet # Date 1367498359 -7200 # Node ID 4732fcfd3a7661988eb612074d68965e985639ea # Parent d528dd349be77e10e1ef7bf9526f5784c7057ed7 new feature : delete fragment. diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/locale/fr/LC_MESSAGES/django.mo Binary file src/egonomy/locale/fr/LC_MESSAGES/django.mo has changed diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/locale/fr/LC_MESSAGES/django.po --- a/src/egonomy/locale/fr/LC_MESSAGES/django.po Tue Apr 23 11:42:35 2013 +0200 +++ b/src/egonomy/locale/fr/LC_MESSAGES/django.po Thu May 02 14:39:19 2013 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-03-05 03:24-0600\n" +"POT-Creation-Date: 2013-05-02 07:27-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,18 +18,22 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" -#: settings.py:138 +#: settings.py:149 msgid "French" msgstr "Français" -#: settings.py:139 +#: settings.py:150 msgid "English" msgstr "Anglais" -#: views.py:72 -#: views.py:96 +#: views.py:79 +#: views.py:103 msgid "You are not allowed to modify this fragment." -msgstr "Vous n'être pas autorisé à modifier ce fragment." +msgstr "Vous n'êtes pas autorisé à modifier ce fragment." + +#: views.py:230 +msgid "You are not allowed to delete this fragment." +msgstr "Vous n'êtes pas autorisé à supprimer ce fragment." #: templates/egonomy_all_fragments.html:7 #: templates/egonomy_all_fragments.html:18 @@ -55,12 +59,24 @@ #: templates/egonomy_all_fragments.html:40 #: templates/egonomy_annotate_picture.html:102 -#: templates/egonomy_create_fragment.html:220 +#: templates/egonomy_create_fragment.html:279 #: templates/egonomy_home.html:62 -#: templates/egonomy_view_fragment.html:107 +#: templates/egonomy_view_fragment.html:111 msgid "Annotated by" msgstr "Annoté par" +#: templates/egonomy_all_fragments.html:41 +#: templates/egonomy_view_fragment.html:59 +msgid "" +"Do you really want to delete this fragment ? Warning : this action est " +"irreversible." +msgstr "Voulez-vous vraiment supprimer ce fragment ? Attention : cette action est irréversible." + +#: templates/egonomy_all_fragments.html:41 +#: templates/egonomy_view_fragment.html:59 +msgid "Delete this fragment" +msgstr "Supprimer ce fragment" + #: templates/egonomy_all_pictures.html:7 #: templates/egonomy_all_pictures.html:18 #: templates/egonomy_all_pictures.html:20 @@ -70,7 +86,7 @@ #: templates/egonomy_all_pictures.html:48 #: templates/egonomy_annotate_picture.html:12 -#: templates/egonomy_create_fragment.html:154 +#: templates/egonomy_create_fragment.html:213 #: templates/egonomy_home.html:39 #: templates/egonomy_home.html.py:61 #: templates/egonomy_view_fragment.html:38 @@ -109,22 +125,22 @@ msgstr "Localisation" #: templates/egonomy_annotate_picture.html:55 -#: templates/egonomy_create_fragment.html:170 +#: templates/egonomy_create_fragment.html:229 msgid "RMN keywords" msgstr "Mots-clés RMN" #: templates/egonomy_annotate_picture.html:63 -#: templates/egonomy_create_fragment.html:177 +#: templates/egonomy_create_fragment.html:236 msgid "Pertimm title" msgstr "Titre Pertimm" #: templates/egonomy_annotate_picture.html:67 -#: templates/egonomy_create_fragment.html:184 +#: templates/egonomy_create_fragment.html:243 msgid "Pertimm description" msgstr "Description Pertimm" #: templates/egonomy_annotate_picture.html:71 -#: templates/egonomy_create_fragment.html:191 +#: templates/egonomy_create_fragment.html:250 msgid "Pertimm thesaurus" msgstr "Thésaurus Pertimm" @@ -143,13 +159,13 @@ msgstr "par" #: templates/egonomy_annotate_picture.html:85 -#: templates/egonomy_view_fragment.html:65 +#: templates/egonomy_view_fragment.html:69 msgid "Create a fragment" msgstr "Créer un fragment" #: templates/egonomy_annotate_picture.html:91 -#: templates/egonomy_create_fragment.html:209 -#: templates/egonomy_view_fragment.html:96 +#: templates/egonomy_create_fragment.html:268 +#: templates/egonomy_view_fragment.html:100 msgid "Fragments from this picture" msgstr "Fragments issus de cette image" @@ -169,67 +185,68 @@ msgid "Create or edit a fragment" msgstr "Créer ou modifier un fragment" -#: templates/egonomy_create_fragment.html:89 +#: templates/egonomy_create_fragment.html:58 msgid "Add all Senseetive keywords to yours" msgstr "Ajouter tous les mots-clés Senseetive aux votres" -#: templates/egonomy_create_fragment.html:122 +#: templates/egonomy_create_fragment.html:140 +#: templates/egonomy_create_fragment.html:257 +msgid "Request keywords from Senseetive API" +msgstr "Demander les mots-clés à l'API Senseetive" + +#: templates/egonomy_create_fragment.html:181 msgid "Erase the drawing" msgstr "Effacer le tracé" -#: templates/egonomy_create_fragment.html:123 +#: templates/egonomy_create_fragment.html:182 msgid "Back to the original drawing" msgstr "Revenir au tracé d'origine" -#: templates/egonomy_create_fragment.html:124 +#: templates/egonomy_create_fragment.html:183 msgid "New fragment" msgstr "Nouveau fragment" -#: templates/egonomy_create_fragment.html:153 +#: templates/egonomy_create_fragment.html:212 #: templates/egonomy_view_fragment.html:37 msgid "Source picture" msgstr "Image source" -#: templates/egonomy_create_fragment.html:157 -#: templates/egonomy_create_fragment.html:158 +#: templates/egonomy_create_fragment.html:216 +#: templates/egonomy_create_fragment.html:217 msgid "Fragment's title" msgstr "Titre du fragment" -#: templates/egonomy_create_fragment.html:161 +#: templates/egonomy_create_fragment.html:220 #: templates/egonomy_view_fragment.html:41 msgid "Fragment's description" msgstr "Description du fragment" -#: templates/egonomy_create_fragment.html:165 +#: templates/egonomy_create_fragment.html:224 #: templates/egonomy_view_fragment.html:45 msgid "Users keywords" msgstr "Mots-clés Utilisateurs" -#: templates/egonomy_create_fragment.html:172 +#: templates/egonomy_create_fragment.html:231 msgid "Add all RMN keywords to yours" msgstr "Ajouter tous les mots-clés RMN aux votres" -#: templates/egonomy_create_fragment.html:179 +#: templates/egonomy_create_fragment.html:238 msgid "Add all Pertimm title keywords to yours" msgstr "Ajouter tous les mots-clés du titre Pertimm aux votres" -#: templates/egonomy_create_fragment.html:186 +#: templates/egonomy_create_fragment.html:245 msgid "Add all Pertimm description keywords to yours" msgstr "Ajouter tous les mots-clés de la description Pertimm aux votres" -#: templates/egonomy_create_fragment.html:193 +#: templates/egonomy_create_fragment.html:252 msgid "Add all Pertimm thesaurus keywords to yours" msgstr "Ajouter les mots-clés du thésaurus Pertimm aux votres" -#: templates/egonomy_create_fragment.html:197 +#: templates/egonomy_create_fragment.html:256 msgid "Senseetive keywords" msgstr "Mots-clés Senseetive" -#: templates/egonomy_create_fragment.html:198 -msgid "Request keywords from Senseetive API" -msgstr "Demander les mots-clés à l'API Senseetive" - -#: templates/egonomy_create_fragment.html:202 +#: templates/egonomy_create_fragment.html:261 msgid "Save the fragment" msgstr "Enregistrer le fragment" @@ -261,15 +278,15 @@ msgid "Modify this fragment" msgstr "Modifier ce fragment" -#: templates/egonomy_view_fragment.html:60 +#: templates/egonomy_view_fragment.html:64 msgid "Duplicate this fragment" msgstr "Dupliquer ce fragment" -#: templates/egonomy_view_fragment.html:70 +#: templates/egonomy_view_fragment.html:74 msgid "See the fragment in its full picture" msgstr "Voir le fragment dans l'image entière" -#: templates/egonomy_view_fragment.html:83 +#: templates/egonomy_view_fragment.html:87 msgid "See the fragment only" msgstr "Voir le fragment seul" diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/static/egonomy/css/egonomy.css --- a/src/egonomy/static/egonomy/css/egonomy.css Tue Apr 23 11:42:35 2013 +0200 +++ b/src/egonomy/static/egonomy/css/egonomy.css Thu May 02 14:39:19 2013 +0200 @@ -372,6 +372,29 @@ cursor: hand; cursor: pointer; } +/* red cross on top right corner */ +.options_on_hover{ + position: relative; +} +.options_on_hover:hover > a > .top_right_options{ + display: block; +} +.top_right_options{ + background-image: url("images/ui-icons_454545_256x240.png"); + background-position: -34px -194px; + background-repeat: no-repeat; + cursor: pointer; + display: none; + height: 12px; + position: absolute; + right: -5px; + top: -5px; + width: 12px; +} +.top_right_options:hover{ + background-image: url("images/ui-icons_cd0a0a_256x240.png"); +} + /* Seeseetive api responses */ .senapi_li { margin: 0 0 5px 0; diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/templates/egonomy_all_fragments.html --- a/src/egonomy/templates/egonomy_all_fragments.html Tue Apr 23 11:42:35 2013 +0200 +++ b/src/egonomy/templates/egonomy_all_fragments.html Thu May 02 14:39:19 2013 +0200 @@ -25,7 +25,7 @@ {% if nb_pages %}

{% build_pagination nb_pages cur_page_nb url_pagination "contents_page clickable" %}

{% endif %} diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/templates/egonomy_view_fragment.html --- a/src/egonomy/templates/egonomy_view_fragment.html Tue Apr 23 11:42:35 2013 +0200 +++ b/src/egonomy/templates/egonomy_view_fragment.html Thu May 02 14:39:19 2013 +0200 @@ -54,6 +54,10 @@   {% trans "Modify this fragment" %} + +   + {% trans "Delete this fragment" %} + {% endifequal %}   diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/urls.py --- a/src/egonomy/urls.py Tue Apr 23 11:42:35 2013 +0200 +++ b/src/egonomy/urls.py Thu May 02 14:39:19 2013 +0200 @@ -18,6 +18,7 @@ url(r'^allfragments/$', 'egonomy.views.all_fragments', name='all_fragments'), url(r'^userfragments/(?P.*)/$', 'egonomy.views.user_fragments', name='user_fragments'), url(r'^senseetiveapi/$', 'egonomy.views.senseetive_api', name='senseetive_api'), + url(r'^deletefragment/$', 'egonomy.views.delete_fragment', name='delete_fragment'), # Uncomment the admin/doc line below to enable admin documentation: url(r'^admin/doc/', include('django.contrib.admindocs.urls')), diff -r d528dd349be7 -r 4732fcfd3a76 src/egonomy/views.py --- a/src/egonomy/views.py Tue Apr 23 11:42:35 2013 +0200 +++ b/src/egonomy/views.py Thu May 02 14:39:19 2013 +0200 @@ -220,6 +220,24 @@ context_instance=RequestContext(request)) +def delete_fragment(request): + + if "fragment_pk" in request.GET: + frg_pk = request.GET["fragment_pk"] + frg = get_object_or_404(Fragment.objects.select_related('author'), pk=frg_pk) + # We check if the current user is the fragment's author + if frg.author != request.user: + return HttpResponseForbidden(_("You are not allowed to delete this fragment.")) + # Delete the fragment + frg.delete() + if "next" in request.GET: + # Redirect to the next parameter + return redirect(request.GET["next"]) + else: + # Redirect to the next parameter + return redirect(reverse("user_fragments", args=[request.user.username])) + + def senseetive_api(request):