Added Public checkbox
authorveltr
Mon, 22 Jul 2013 12:02:47 +0200
changeset 35 63dae3d25255
parent 34 7aa03ab5bbcd
child 36 bad0e6c60b63
Added Public checkbox
integration/annotation-article.html
integration/css/annotation-article.css
integration/js/annotation-article.js
--- a/integration/annotation-article.html	Mon Jul 08 12:53:32 2013 +0200
+++ b/integration/annotation-article.html	Mon Jul 22 12:02:47 2013 +0200
@@ -559,7 +559,8 @@
                 "tags": [ "Banque", "Publique", "Investissement" ],
                 "annotatedText" : "Banque publique d’investissement",
                 "beforeText" : "Arnaud Montebourg au sujet de la ",
-                "afterText" : " (BPI) et se sont longuement attardés"
+                "afterText" : " (BPI) et se sont longuement attardés",
+                "isPublic": true
             }, {
                 "startOffset" : 752,
                 "length" : 17,
@@ -569,7 +570,8 @@
                 "tags": [ "Chef du gouvernement" ],
                 "annotatedText" : "Jean-Marc Ayrault",
                 "beforeText" : "certains ministres du gouvernement de ",
-                "afterText" : ". Il révèle aussi que les deux"
+                "afterText" : ". Il révèle aussi que les deux",
+                "isPublic": true
             }, {
                 "startOffset" : 13163,
                 "length" : 17,
@@ -578,7 +580,8 @@
                 "comment" : "Le Ministre du Redressement productif",
                 "annotatedText" : "Arnaud Montebourg",
                 "beforeText" : "de l'assurance-vie Or, même si ",
-                "afterText" : " ne veut pas contrevenir à la"
+                "afterText" : " ne veut pas contrevenir à la",
+                "isPublic": false
             }];
         </script>
         
--- a/integration/css/annotation-article.css	Mon Jul 08 12:53:32 2013 +0200
+++ b/integration/css/annotation-article.css	Mon Jul 22 12:02:47 2013 +0200
@@ -115,7 +115,7 @@
     float: left; clear: both; width: 480px; padding: 7px; background: rgba(200,200,200,.9);
 }
 .annotation-form h3 {
-    color: #197CAA; font-size: 14px; font-weight: bold; margin: 2px 0 0;
+    color: #197CAA; font-size: 14px; font-weight: bold; margin: 4px 0;
 }
 .annotation-textarea {
     height: 120px; resize: none; border: 1px solid #666; padding: 2px; width: 472px;
--- a/integration/js/annotation-article.js	Mon Jul 08 12:53:32 2013 +0200
+++ b/integration/js/annotation-article.js	Mon Jul 22 12:02:47 2013 +0200
@@ -127,7 +127,7 @@
         + '<% } else { %><p><%- annotation.comment || "(sans commentaire)" %></p><% } %>'
         + '<h3>Mots-clés&nbsp;:</h3>'
         + '<ul class="<%- editable ? "annotation-tags-form" : "" %>"><% _(annotation.tags).forEach(function(tag) { %><li><%- tag %></li><% }) %></ul>'
-        + '<% if (editable) { %><div><a class="annotation-remove" href="#">Supprimer</a><input class="annotation-submit" type="submit" value="Enregistrer" /></div><% } %>'
+        + '<% if (editable) { %><h3><input class="annotation-public" type="checkbox" <% if (annotation.isPublic) {%>checked <% } %>/>Annotation publique</h3><div><a class="annotation-remove" href="#">Supprimer</a><input class="annotation-submit" type="submit" value="Enregistrer" /></div><% } %>'
         + '</form></div>'
     );
     
@@ -218,11 +218,17 @@
         $(".annotation-frames").append(frame);
         $(".annotation-list").append(li);
         
-        frame.find(".annotation-textarea").on("keyup change", function() {
+        frame.find(".annotation-textarea").on("keyup paste input change", function() {
             annotation.comment = $(this).val();
             li.find(".annotation-comment").text(annotation.comment || "(Sans commentaire)");
         });
         
+        frame.find(".annotation-public").change(function() {
+            annotation.isPublic = $(this).is(":checked");
+        });
+        
+        frame.find("")
+        
         var ontagchange = function(evt, ui) {
             annotation.tags = $(this).tagit("assignedTags");
             li.find(".annotation-tags").text((annotation.tags || []).join(", ") || "(aucun mot-clé)");