Projet

Général

Profil

0001-implement-foldable-fieldset-as-in-w.c.s.-fixes-9788.patch

Benjamin Dauvergne, 27 janvier 2016 17:26

Télécharger (2,38 ko)

Voir les différences:

Subject: [PATCH] implement foldable fieldset as in w.c.s. (fixes #9788)

 gadjo/static/css/gadjo.css | 25 +++++++++++++++++++++++++
 gadjo/static/js/gadjo.js   | 18 ++++++++++++++++++
 2 files changed, 43 insertions(+)
gadjo/static/css/gadjo.css
784 784
	margin: 0;
785 785
	line-height: 150%;
786 786
}
787
/* fieldsets */
788
fieldset.gadjo-foldable legend.gadjo-foldable-widget {
789
	border-bottom: 1px solid #aaa;
790
	cursor: pointer;
791
	display: block;
792
	font-weight: bold;
793
	padding: 1ex 0 0;
794
	width: 100%;
795
}
796
fieldset.gadjo-foldable legend.gadjo-foldable-widget:after {
797
	font-family: FontAwesome;
798
	content: "\f106"; /* angle-up */
799
	position: absolute;
800
	right: 1em;
801
}
802
fieldset.gadjo-foldable.gadjo-folded legend.gadjo-foldable-widget:after {
803
	content: "\f107"; /* angle-down */
804
}
805
fieldset.gadjo-foldable {
806
	padding: 1ex 0 0 0;
807
	border: 0;
808
}
809
.gadjo-foldable.gadjo-folded > .gadjo-folding {
810
	display: none;
811
}
787 812

  
788 813
ul#sidepage-menu li a.icon-add { background-image: url(icons/add.small.png); }
789 814
ul#sidepage-menu li a.icon-calendar { background-image: url(icons/calendar.small.png); }
gadjo/static/js/gadjo.js
233 233
        }
234 234
      }
235 235
    });
236
    $(function () {
237
      function gadjo_unfold_saved() {
238
        $('.gadjo-folded').each(function (idx, elem) {
239
          if (elem.id && sessionStorage['gadjo-foldable-id-' + elem.id + '-' + window.location.pathname] == "true") {
240
              $(elem).removeClass('gadjo-folded');
241
          }
242
        });
243
      }
244
      gadjo_unfold_saved()
245
      $(document).on('gadjo:content-update', gadjo_unfold_saved);
246
      $('body').on('click', '.gadjo-foldable-widget', function (event) {
247
        var $parent = $(event.target).closest('.gadjo-foldable');
248
        $parent.toggleClass('gadjo-folded');
249
        if ($parent[0].id) {
250
            sessionStorage['gadjo-foldable-id-' + $parent[0].id + '-' + window.location.pathname] = ! $parent.is('.gadjo-folded');
251
        }
252
      });
253
    });
236 254
})();
237
-