Hide comment form when no annotation selected.
authorAlexandre Segura <mex.zktk@gmail.com>
Fri, 24 Feb 2017 14:54:06 +0100
changeset 384 04500e5914f9
parent 383 b38ee6c486ce
child 385 d0465086d8d2
Hide comment form when no annotation selected.
src/iconolab/templates/iconolab/detail_image.html
--- a/src/iconolab/templates/iconolab/detail_image.html	Thu Feb 23 20:27:39 2017 +0100
+++ b/src/iconolab/templates/iconolab/detail_image.html	Fri Feb 24 14:54:06 2017 +0100
@@ -61,7 +61,7 @@
         <comment-list v-bind:annotation="annotation"
           fetch="{% url 'get_annotation_comments_json' ':annotation_guid' %}"></comment-list>
         <div id="form-comment">
-          <form>
+          <form style="display: none;">
               <div class="form-group">
                 <textarea class="form-control input-sm" placeholder="Ajouter mon commentaire..." disabled></textarea>
               </div>
@@ -109,7 +109,7 @@
         $('.list-group a[data-annotation-id]').removeClass('active');
         $el.addClass('active');
 
-        $('#form-comment form').replaceWith(form);
+        $('#form-comment form').replaceWith(form).show();
 
         vm.annotation = annotations[revision];
 
@@ -150,7 +150,10 @@
 
     vm.annotation = null;
 
-    $('#form-comment form').find('textarea, [type="submit"]').attr('disabled', true);
+    $('#form-comment form')
+      .hide()
+      .find('textarea, [type="submit"]')
+      .attr('disabled', true);
 
     location.hash = '';
   });