error handled on save
authorcavaliet
Fri, 20 Sep 2013 15:44:11 +0200
changeset 112 ba6056f58516
parent 111 e2ecb345b58f
child 113 c05567404888
error handled on save
src/p4l/locale/en/LC_MESSAGES/django.po
src/p4l/locale/es/LC_MESSAGES/django.po
src/p4l/locale/fr/LC_MESSAGES/django.mo
src/p4l/locale/fr/LC_MESSAGES/django.po
src/p4l/static/p4l/js/p4l.js
src/p4l/templates/p4l/translations.html
--- a/src/p4l/locale/en/LC_MESSAGES/django.po	Fri Sep 20 12:54:55 2013 +0200
+++ b/src/p4l/locale/en/LC_MESSAGES/django.po	Fri Sep 20 15:44:11 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-20 04:40-0500\n"
+"POT-Creation-Date: 2013-09-20 08:37-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"
@@ -405,6 +405,10 @@
 msgid "name"
 msgstr "name"
 
+#: templates/p4l/translations.html:22
+msgid "An error occured. Somes datas may be incorrect or incomplete."
+msgstr ""
+
 #: templates/registration/login.html:8
 msgid "Sorry, that's not a valid username or password."
 msgstr "Sorry, that's not a valid username or password."
--- a/src/p4l/locale/es/LC_MESSAGES/django.po	Fri Sep 20 12:54:55 2013 +0200
+++ b/src/p4l/locale/es/LC_MESSAGES/django.po	Fri Sep 20 15:44:11 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-20 04:40-0500\n"
+"POT-Creation-Date: 2013-09-20 08:37-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"
@@ -406,6 +406,10 @@
 msgid "name"
 msgstr "name"
 
+#: templates/p4l/translations.html:22
+msgid "An error occured. Somes datas may be incorrect or incomplete."
+msgstr ""
+
 #: templates/registration/login.html:8
 msgid "Sorry, that's not a valid username or password."
 msgstr "Sorry, that's not a valid username or password."
Binary file src/p4l/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/p4l/locale/fr/LC_MESSAGES/django.po	Fri Sep 20 12:54:55 2013 +0200
+++ b/src/p4l/locale/fr/LC_MESSAGES/django.po	Fri Sep 20 15:44:11 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-20 04:40-0500\n"
+"POT-Creation-Date: 2013-09-20 08:37-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"
@@ -415,6 +415,10 @@
 msgid "name"
 msgstr "Nom"
 
+#: templates/p4l/translations.html:22
+msgid "An error occured. Somes datas may be incorrect or incomplete."
+msgstr "Une erreur est survenue. Certaines données sont incorrectes ou incomplètes."
+
 #: templates/registration/login.html:8
 msgid "Sorry, that's not a valid username or password."
 msgstr "Désolé, utilisateur ou mot de passe invalide"
--- a/src/p4l/static/p4l/js/p4l.js	Fri Sep 20 12:54:55 2013 +0200
+++ b/src/p4l/static/p4l/js/p4l.js	Fri Sep 20 15:44:11 2013 +0200
@@ -284,7 +284,7 @@
     };
 });
 
-app.controller("RecordCtrl", function($scope, RecordModel, context){
+app.controller("RecordCtrl", function($translate, $scope, RecordModel, context){
     
     $scope.record = RecordModel.record;
     $scope.uriLabels = RecordModel.uriLabels;
@@ -293,7 +293,15 @@
         
     $scope.submitRecord = function() {
         $scope.saving = true;
-        $scope.record.$save({recordId: context.record_id})
+        $scope.record.$save(
+        	{ recordId: context.record_id },
+        	function(){
+        		//console.log("SUCCESS");
+        	},
+        	function(){
+        		alert($translate("An error occured. Somes datas may be incorrect or incomplete."));
+        		$scope.saving=false;
+        	})
             .then(function(response) {
                 $scope.saving=false;
             });
--- a/src/p4l/templates/p4l/translations.html	Fri Sep 20 12:54:55 2013 +0200
+++ b/src/p4l/templates/p4l/translations.html	Fri Sep 20 15:44:11 2013 +0200
@@ -18,4 +18,5 @@
 {% trans 'label' %}
 {% trans 'name' %}
 {% trans 'View the record' %}
-{% trans 'Edit the record' %}
\ No newline at end of file
+{% trans 'Edit the record' %}
+{% trans 'An error occured. Somes datas may be incorrect or incomplete.' %}
\ No newline at end of file