commit e8a1fe3143ad9d92a8b2806c8ef961d7b93f2732
Author: Jérôme Schneider <jschneider@entrouvert.com>
Date:   Wed Jul 30 13:47:20 2014 +0200

    dossiers: render pause facturation comment expandable
    
    Closes #5010

diff --git a/calebasse/dossiers/templates/dossiers/patientrecord_tab1_general.html b/calebasse/dossiers/templates/dossiers/patientrecord_tab1_general.html
index 64d2bf2a..a829da86 100644
--- a/calebasse/dossiers/templates/dossiers/patientrecord_tab1_general.html
+++ b/calebasse/dossiers/templates/dossiers/patientrecord_tab1_general.html
@@ -91,10 +91,14 @@
       <p id="confidential-msg" style="display: none; font-size: 10px;">Confidentialité mise à jour</p>
       {{ form.confidential.label_tag }} : <span class="autosubmit">{{ form.confidential }}</span>
       <p id="pause-msg" style="display: none; font-size: 10px;">Pause facturation mise à jour</p>
-      {{ form.pause.label_tag }} : {{ form.pause }}
-      <br/><label>Commentaire de la pause facturation</label> <button class="save enable-on-change btn-maj">✔</button><br/>
-      {{ form.pause_comment }}
-
+      {{ form.pause.label_tag }} : <span class="autosubmit">{{ form.pause }}</span>
+      <br/>
+      <span class="js-expandable">
+      <label class="js-click-to-expand">Commentaire de la pause facturation {% if object.pause_comment %}<span title="Un commentaire existe" class="icon-comment" style="display: inline"></span>{% endif %}</label>
+      <span class="js-to-expand">
+        <button class="save enable-on-change btn-maj">✔</button><br/>
+        {{ form.pause_comment }}
+      </span>
     </div>
   </form>
 
diff --git a/calebasse/dossiers/templates/dossiers/patientrecord_tab3_contact.html b/calebasse/dossiers/templates/dossiers/patientrecord_tab3_contact.html
index 7cf13809..4dfba1a9 100644
--- a/calebasse/dossiers/templates/dossiers/patientrecord_tab3_contact.html
+++ b/calebasse/dossiers/templates/dossiers/patientrecord_tab3_contact.html
@@ -38,8 +38,9 @@
   </li>
   {% endif %}
   <span class="social-security-contact">
-    <label class="social-security-label">Infos d'assuré [+]</label>
-    <ul>
+    <span class="js-expandable">
+    <label class="js-click-to-expand">Infos d'assuré</label>
+    <ul class="js-to-expand">
       {% if contact.id == object.id %}
       {{ object.first_name }} <span class="lastname">{{ object.last_name }}</span>
       {% endif %}
@@ -88,4 +89,5 @@
       {% endif %}
     </ul>
   </span>
+  </span>
 </ul>
diff --git a/calebasse/static/css/dossiers.css b/calebasse/static/css/dossiers.css
index c1d83329..78a68292 100644
--- a/calebasse/static/css/dossiers.css
+++ b/calebasse/static/css/dossiers.css
@@ -152,3 +152,11 @@ input[type=checkbox] + button {
 .print-container form {
     display: inline;
 }
+
+.js-expandable .js-click-to-expand:after { content: " [+]"; }
+.js-expanded .js-click-to-expand:after { content: " [-]"; }
+.js-click-to-expand { cursor: pointer; }
+.js-click-to-expand:hover { font-weight: bold; }
+
+.js-expandable .js-to-expand { display: none; }
+.js-expandable.js-expanded .js-to-expand { display: block; }
diff --git a/calebasse/static/css/style.css b/calebasse/static/css/style.css
index 6d2e472c..6ac8f8d0 100644
--- a/calebasse/static/css/style.css
+++ b/calebasse/static/css/style.css
@@ -1395,17 +1395,6 @@ div.statistic {
     list-style-type: none;
 }
 
-.social-security-label {
-    cursor: pointer;
-}
-
-label.social-security-label:hover {
-    font-weight: bold;
-}
-
-.social-security-contact ul {
-    display: none;
-}
 
 .right {
     float: right;
diff --git a/calebasse/static/js/calebasse.dossiers.js b/calebasse/static/js/calebasse.dossiers.js
index a17500ec..6d6d9fd3 100644
--- a/calebasse/static/js/calebasse.dossiers.js
+++ b/calebasse/static/js/calebasse.dossiers.js
@@ -268,18 +268,6 @@ function load_tab3_addresses() {
               }
           });
       });
-    $('.social-security-label').click(function() {
-      var label = $(this).html();
-      var data = $(this).next();
-      if (($(data).is(':hidden'))) {
-        $(this).html(label.replace('+', '-'));
-        $(this).css("font-weight", "bold");
-      } else {
-        $(this).html(label.replace('-', '+'));
-        $(this).css("font-weight", "");
-      }
-      $(data).toggle();
-    });
     var hashes = location.hash.split('&');
     for (i in hashes) {
       if (hashes[i] == "newcontact") {
@@ -339,7 +327,7 @@ function load_tab6_next_rdv() {
 }
 
 function load_tab7_socialisation() {
-    $('#new-socialisation-duration-btn').click(function() {
+    $('#new-socialisation-duration-btn').on("click", function() {
         generic_ajaxform_dialog('socialisation/new', 'Ajouter une période de socialisation',
             '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
     });
@@ -387,19 +375,22 @@ function load_tab8_medical() {
   $(function() {
     var $tabs = $('#tabs').tabs({
       load: function(event, ui) {
+        $(document).on('click', '.js-click-to-expand', function (event) {
+             $(event.target).parents('.js-expandable').toggleClass('js-expanded');
+        });
         var tabid = $(ui.tab).attr('id');
         if (tabid == "ui-id-1")
-      load_tab1_general();
+            load_tab1_general();
         else if (tabid == "ui-id-2")
-      load_tab2_adm();
+            load_tab2_adm();
         else if (tabid == "ui-id-3")
-      load_tab3_addresses();
+            load_tab3_addresses();
         else if (tabid == "ui-id-4")
-      load_tab4_notifs();
+            load_tab4_notifs();
         else if (tabid == "ui-id-7")
-      load_tab7_socialisation();
+            load_tab7_socialisation();
         else if (tabid == "ui-id-8")
-      load_tab8_medical();
+            load_tab8_medical();
       },
         selected: -1,
         collapsible: true,
