use strict mode for p4l.js
authorymh <ymh.work@gmail.com>
Wed, 11 Sep 2013 07:20:23 +0200
changeset 63 09a086a49b71
parent 62 8433e12362e0
child 64 74aed9b135f6
use strict mode for p4l.js add title + addedtitle + lang for isbn and issn
src/p4l/locale/en/LC_MESSAGES/django.mo
src/p4l/locale/en/LC_MESSAGES/django.po
src/p4l/locale/es/LC_MESSAGES/django.mo
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/static/p4l/templates/isbnDisp.html
src/p4l/static/p4l/templates/isbnForm.html
src/p4l/static/p4l/templates/issnDisp.html
src/p4l/static/p4l/templates/issnForm.html
src/p4l/static/p4l/templates/titleDisp.html
src/p4l/static/p4l/templates/titleForm.html
src/p4l/templates/p4l/record_update_form.html
src/p4l/templates/p4l/translations.html
Binary file src/p4l/locale/en/LC_MESSAGES/django.mo has changed
--- a/src/p4l/locale/en/LC_MESSAGES/django.po	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/locale/en/LC_MESSAGES/django.po	Wed Sep 11 07:20:23 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-10 10:40-0500\n"
+"POT-Creation-Date: 2013-09-11 00:12-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"
@@ -294,46 +294,43 @@
 
 #: templates/p4l/translations.html:5
 msgid "Update"
-msgstr ""
+msgstr "Update"
 
 #: templates/p4l/translations.html:6
 msgid "Add a new subject"
 msgstr "Add a new subject"
 
 #: templates/p4l/translations.html:7
-#, fuzzy
 msgid "Add a new theme"
-msgstr "Add a new subject"
+msgstr "Add a new theme"
 
 #: templates/p4l/translations.html:8
-#, fuzzy
 msgid "Add a new country"
-msgstr "Add a new subject"
+msgstr "Add a new country"
 
 #: templates/p4l/translations.html:9
-#, fuzzy
 msgid "Add a new language"
-msgstr "Add a new subject"
+msgstr "Add a new language"
 
 #: templates/p4l/translations.html:10
-#, fuzzy
 msgid "Add a new project"
-msgstr "Add a new subject"
+msgstr "Add a new project"
 
 #: templates/p4l/translations.html:11
-#, fuzzy
 msgid "Add a new organization"
-msgstr "Add a new subject"
+msgstr "Add a new organization"
 
 #: templates/p4l/translations.html:12
-#, fuzzy
 msgid "Modify the language"
-msgstr "other languages"
+msgstr "Modify the language"
 
 #: templates/p4l/translations.html:13
-#, fuzzy
 msgid "Modify the record type"
-msgstr "record type"
+msgstr "Modify the record type"
+
+#: templates/p4l/translations.html:14
+msgid "title"
+msgstr "title"
 
 #: templates/registration/login.html:8
 msgid "Sorry, that's not a valid username or password."
Binary file src/p4l/locale/es/LC_MESSAGES/django.mo has changed
--- a/src/p4l/locale/es/LC_MESSAGES/django.po	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/locale/es/LC_MESSAGES/django.po	Wed Sep 11 07:20:23 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-10 10:40-0500\n"
+"POT-Creation-Date: 2013-09-11 00:12-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"
@@ -295,46 +295,43 @@
 
 #: templates/p4l/translations.html:5
 msgid "Update"
-msgstr ""
+msgstr "Update"
 
 #: templates/p4l/translations.html:6
 msgid "Add a new subject"
 msgstr "Add a new subject"
 
 #: templates/p4l/translations.html:7
-#, fuzzy
 msgid "Add a new theme"
-msgstr "Add a new subject"
+msgstr "Add a new theme"
 
 #: templates/p4l/translations.html:8
-#, fuzzy
 msgid "Add a new country"
-msgstr "Add a new subject"
+msgstr "Add a new country"
 
 #: templates/p4l/translations.html:9
-#, fuzzy
 msgid "Add a new language"
-msgstr "Add a new subject"
+msgstr "Add a new language"
 
 #: templates/p4l/translations.html:10
-#, fuzzy
 msgid "Add a new project"
-msgstr "Add a new subject"
+msgstr "Add a new project"
 
 #: templates/p4l/translations.html:11
-#, fuzzy
 msgid "Add a new organization"
-msgstr "Add a new subject"
+msgstr "Add a new organization"
 
 #: templates/p4l/translations.html:12
-#, fuzzy
 msgid "Modify the language"
-msgstr "other languages"
+msgstr "Modify the language"
 
 #: templates/p4l/translations.html:13
-#, fuzzy
 msgid "Modify the record type"
-msgstr "record type"
+msgstr "Modify the record type"
+
+#: templates/p4l/translations.html:14
+msgid "title"
+msgstr "title"
 
 #: templates/registration/login.html:8
 msgid "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	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/locale/fr/LC_MESSAGES/django.po	Wed Sep 11 07:20:23 2013 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-10 10:40-0500\n"
+"POT-Creation-Date: 2013-09-11 00:12-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"
@@ -17,9 +17,7 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
-#: admin.py:10
-#: forms.py:36
-#: templates/p4l/p4l_record_view.html:51
+#: admin.py:10 forms.py:36 templates/p4l/p4l_record_view.html:51
 msgid "language"
 msgstr "langue"
 
@@ -39,22 +37,20 @@
 msgid "Search"
 msgstr "Chercher"
 
-#: semantictree/forms/widgets.py:43
-#: semantictree/forms/widgets.py:80
+#: semantictree/forms/widgets.py:43 semantictree/forms/widgets.py:80
 msgid ""
 "\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" and "
 "\"data-child-count-query\" must be set in CharField configuration"
-msgstr "\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" et "
+msgstr ""
+"\"data-url\", \"data-query\", \"data-root-query\", \"data-childs-query\" et "
 "\"data-child-count-query\" doivent être renseignés dans la configuration "
 "CharField"
 
-#: semantictree/forms/widgets.py:44
-#: semantictree/forms/widgets.py:81
+#: semantictree/forms/widgets.py:44 semantictree/forms/widgets.py:81
 msgid "Browse"
 msgstr "Parcourir"
 
-#: semantictree/forms/widgets.py:49
-#: semantictree/forms/widgets.py:86
+#: semantictree/forms/widgets.py:49 semantictree/forms/widgets.py:86
 msgid "or"
 msgstr "ou"
 
@@ -62,19 +58,16 @@
 msgid "logout"
 msgstr "deconnection"
 
-#: templates/p4l/p4l_base.html:37
-#: templates/registration/login.html:4
+#: templates/p4l/p4l_base.html:37 templates/registration/login.html:4
 #: templates/registration/login.html:27
 msgid "login"
 msgstr "connection"
 
-#: templates/p4l/p4l_home.html:6
-#: templates/p4l/p4l_home.html.py:10
+#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:10
 msgid "Record List"
 msgstr "Liste notice"
 
-#: templates/p4l/p4l_home.html:6
-#: templates/p4l/p4l_home.html.py:29
+#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:29
 #: templates/p4l/p4l_home.html:66
 msgid "Page"
 msgstr "Page"
@@ -83,23 +76,19 @@
 msgid "Title"
 msgstr "Titre"
 
-#: templates/p4l/p4l_home.html:26
-#: templates/p4l/p4l_home.html.py:63
+#: templates/p4l/p4l_home.html:26 templates/p4l/p4l_home.html.py:63
 msgid "Previous"
 msgstr "Préc."
 
-#: templates/p4l/p4l_home.html:29
-#: templates/p4l/p4l_home.html.py:66
+#: templates/p4l/p4l_home.html:29 templates/p4l/p4l_home.html.py:66
 msgid "on"
 msgstr "sur"
 
-#: templates/p4l/p4l_home.html:32
-#: templates/p4l/p4l_home.html.py:69
+#: templates/p4l/p4l_home.html:32 templates/p4l/p4l_home.html.py:69
 msgid "Next"
 msgstr "Suiv."
 
-#: templates/p4l/p4l_home.html:39
-#: templates/p4l/p4l_record_view.html:59
+#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:59
 msgid "titles"
 msgstr "titres"
 
@@ -341,17 +330,18 @@
 msgid "Modify the record type"
 msgstr "Modifier le type de notice"
 
+#: templates/p4l/translations.html:14
+msgid "title"
+msgstr "titre"
+
 #: templates/registration/login.html:8
 msgid "Sorry, that's not a valid username or password."
 msgstr "Désolé, utilisateur ou mot de passe invalide"
 
-#: templates/registration/login.html:14
-#: templates/registration/login.html:16
+#: templates/registration/login.html:14 templates/registration/login.html:16
 msgid "Username"
 msgstr "Utilisateur"
 
-#: templates/registration/login.html:20
-#: templates/registration/login.html:22
+#: templates/registration/login.html:20 templates/registration/login.html:22
 msgid "Password"
 msgstr "Mot de passe"
-
--- a/src/p4l/static/p4l/js/p4l.js	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/static/p4l/js/p4l.js	Wed Sep 11 07:20:23 2013 +0200
@@ -1,4 +1,4 @@
-//"use strict";
+"use strict";
 // initialize the app
 
 var app = angular.module("recordApp", ['ngResource', 'ngRoute', 'pascalprecht.translate'])
@@ -130,7 +130,7 @@
       },
       link: function($scope, $element, $attrs) {
     	  // Get queries attributes from $scope listname and context query dict
-    	  attr_dict = context.query_dicts[$scope.listname];
+    	  var attr_dict = context.query_dicts[$scope.listname];
     	  for (var k in attr_dict){
 			  if (attr_dict.hasOwnProperty(k)) {
 			      $scope[k] = attr_dict[k];
@@ -167,50 +167,50 @@
     }
 });
 
-app.directive('simpleSemUri', function(RecordModel, context, $timeout){
-	  return {
-	      restrict: 'E',
-	      replace: true,
-	      transclude: true,
-	      scope: {
-	    	  listname:"@",
-	    	  val:"=",
-	    	  placeholder:"@",
-	      },
-	      templateUrl: function(tElement, tAttrs) {
-	          return context.urls.base_static+'p4l/templates/simpleSemanticUriForm.html';  
-	      },
-	      link: function($scope, $element, $attrs) {
-	    	  // Get queries attributes from $scope listname and context query dict
-	    	  attr_dict = context.query_dicts[$scope.listname];
-	    	  for (var k in attr_dict){
-				  if (attr_dict.hasOwnProperty(k)) {
-				      $scope[k] = attr_dict[k];
-				  }
-			  }
-	    	  // initalize autocomplete and browse thesaurus events
-	    	  // We have to timeout because init_browse needs the real ids and not {{ $id }}
-	    	  // NB : scope.apply generates bug
-	    	  $timeout(function(){
-	    		  init_autocomplete();
-	    		  init_browse();
-	          }, 0);
-	      },
-	      controller: function($scope, $element, $attrs, $transclude, RecordModel){
-		    $scope.record = RecordModel.record;
-		    $scope.uriLabels = RecordModel.uriLabels;
-		    $scope.addUriText = '';
-		    
-		    $scope.updateVal = function() {
-		        $scope.val = $scope.addUriText;
-		    };
-		    
-		    $scope.updateUriLabelDict = function(k,v) {
-		        $scope.uriLabels[k] = v;
-		    };
-	      }
-	    }
-	});
+app.directive('simpleSemUri', function(RecordModel, context, $timeout) {
+    return {
+        restrict: 'E',
+        replace: true,
+        transclude: true,
+        scope: {
+            listname:"@",
+            val:"=",
+            placeholder:"@",
+        },
+        templateUrl: function(tElement, tAttrs) {
+            return context.urls.base_static+'p4l/templates/simpleSemanticUriForm.html';  
+        },
+        link: function($scope, $element, $attrs) {
+            // Get queries attributes from $scope listname and context query dict
+            var attr_dict = context.query_dicts[$scope.listname];
+            for (var k in attr_dict){
+                if (attr_dict.hasOwnProperty(k)) {
+                    $scope[k] = attr_dict[k];
+                }
+            }
+            // initalize autocomplete and browse thesaurus events
+            // We have to timeout because init_browse needs the real ids and not {{ $id }}
+            // NB : scope.apply generates bug
+            $timeout(function(){
+                init_autocomplete();
+                init_browse();
+            }, 0);
+        },
+        controller: function($scope, $element, $attrs, $transclude, RecordModel) {
+            $scope.record = RecordModel.record;
+            $scope.uriLabels = RecordModel.uriLabels;
+            $scope.addUriText = '';
+
+            $scope.updateVal = function() {
+                $scope.val = $scope.addUriText;
+            };
+
+            $scope.updateUriLabelDict = function(k,v) {
+                $scope.uriLabels[k] = v;
+            };
+        }
+    };
+});
 
 app.controller("RecordCtrl", function($scope, RecordModel, context){
     
--- a/src/p4l/static/p4l/templates/isbnDisp.html	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/static/p4l/templates/isbnDisp.html	Wed Sep 11 07:20:23 2013 +0200
@@ -1,1 +1,1 @@
-<div>{{'isbn'|translate}} : {{obj.isbn}}</div>
\ No newline at end of file
+<div>{{obj.isbn}} <small class="text-muted" ng-show="obj.lang">({{ obj.lang }})</small></div>
\ No newline at end of file
--- a/src/p4l/static/p4l/templates/isbnForm.html	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/static/p4l/templates/isbnForm.html	Wed Sep 11 07:20:23 2013 +0200
@@ -1,5 +1,6 @@
  <form class="well span3">
     <div class="span3 row">
      <label for="isbn-{{$id}}">{{'isbn'|translate}}</label><input type="text" placeholder="{{'isbn'|translate}}" ng_model="editedObj.isbn" name="isbn" id="isbn-{{$id}}" class="span3"/>
+     <label for="lang-{{$id}}">{{'lang'|translate}}</label><input type="text" placeholder="{{'lang'|translate}}" ng_model="editedObj.lang" name="lang" id="lang-{{$id}}" class="span3"/>
      </div>
  </form>
\ No newline at end of file
--- a/src/p4l/static/p4l/templates/issnDisp.html	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/static/p4l/templates/issnDisp.html	Wed Sep 11 07:20:23 2013 +0200
@@ -1,1 +1,1 @@
-<div>{{'issn'|translate}} : {{obj.issn}}</div>
\ No newline at end of file
+<div>{{obj.issn}} <small class="text-muted" ng-show="obj.lang">({{ obj.lang }})</small></div>
\ No newline at end of file
--- a/src/p4l/static/p4l/templates/issnForm.html	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/static/p4l/templates/issnForm.html	Wed Sep 11 07:20:23 2013 +0200
@@ -1,5 +1,6 @@
  <form class="well span3">
     <div class="span3 row">
      <label for="issn-{{$id}}">{{'issn'|translate}}</label><input type="text" placeholder="{{'issn'|translate}}" ng_model="editedObj.issn" name="issn" id="issn-{{$id}}" class="span3"/>
+     <label for="lang-{{$id}}">{{'lang'|translate}}</label><input type="text" placeholder="{{'lang'|translate}}" ng_model="editedObj.lang" name="lang" id="lang-{{$id}}" class="span3"/>
      </div>
  </form>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/p4l/static/p4l/templates/titleDisp.html	Wed Sep 11 07:20:23 2013 +0200
@@ -0,0 +1,1 @@
+<div>{{'title'|translate}} : {{obj.title}} <small class="text-muted" ng-show="obj.lang">({{ obj.lang }})</small></div>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/p4l/static/p4l/templates/titleForm.html	Wed Sep 11 07:20:23 2013 +0200
@@ -0,0 +1,6 @@
+ <form class="well span3">
+    <div class="span3 row">
+     <label for="title-{{$id}}">{{'title'|translate}}</label><input type="text" placeholder="{{'title'|translate}}" ng_model="editedObj.title" name="title" id="title-{{$id}}" class="span3"/>
+     <label for="lang-{{$id}}">{{'lang'|translate}}</label><input type="text" placeholder="{{'lang'|translate}}" ng_model="editedObj.lang" name="lang" id="lang-{{$id}}" class="span3"/>
+     </div>
+ </form>
\ No newline at end of file
--- a/src/p4l/templates/p4l/record_update_form.html	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/templates/p4l/record_update_form.html	Wed Sep 11 07:20:23 2013 +0200
@@ -86,7 +86,6 @@
     <tr>
       <td>{{ 'language' | translate }}</td>
       <td><simple-sem-uri val="record.language" listname="languages" placeholder="{{'Modify the language' | translate}}"></simple-sem-uri></td>
-</td>
     </tr>
     <tr>
       <td>{{ 'other languages' | translate }}</td>
@@ -94,18 +93,15 @@
     </tr>
     <tr>
       <td>{{ 'titles' | translate }}</td>
-      <td><small>#todo</small>
-</td>
+      <td><object-list form-template="titleForm" disp-template="titleDisp" object-list="record.titles" object-fields='["lang", "title"]'></object-list></td>
     </tr>
     <tr>
       <td>{{ 'abstracts' | translate }}</td>
-      <td><small>#todo</small>
-</td>
+      <td><small>#todo</small></td>
     </tr>
     <tr>
       <td>{{ 'added titles' | translate }}</td>
-      <td><small>#todo</small>
-</td>
+      <td><object-list form-template="titleForm" disp-template="titleDisp" object-list="record.addedTitles" object-fields='["lang", "title"]'></object-list></td>
     </tr>
     <tr>
       <td>{{ 'titles main document' | translate }}</td>
--- a/src/p4l/templates/p4l/translations.html	Tue Sep 10 17:51:25 2013 +0200
+++ b/src/p4l/templates/p4l/translations.html	Wed Sep 11 07:20:23 2013 +0200
@@ -10,4 +10,5 @@
 {% trans 'Add a new project' %}
 {% trans 'Add a new organization' %}
 {% trans 'Modify the language' %}
-{% trans 'Modify the record type' %}
\ No newline at end of file
+{% trans 'Modify the record type' %}
+{% trans 'title' %}
\ No newline at end of file