www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

titre-bloc.js (1386B)


      1 function MTitreBloc() {
      2     makeUid(this);
      3     makeField(this, 'titre', 'Nom du Bloc');
      4 }
      5 
      6 function VTitreBloc(mTitreBloc, emplacement) {
      7     makeView(this, 'vTitreBloc', emplacement, 'vTitre', 'vÉdition', 'vTexte', 'vSubmit', 'vCancel');
      8     
      9     var that = this;
     10     
     11     // Actions
     12     this.updateTitreBloc = function(mTitreBloc, titre) {
     13         that.parties.vTitre.text(titre);
     14         that.parties.vTexte.val(titre);
     15     };
     16     
     17     this.editerTitreBloc = function() {
     18         that.parties.vTitre.hide();
     19         that.parties.vÉdition.show();
     20     };
     21     
     22     this.accepteÉditionTitreBloc = function() {
     23         mTitreBloc.titre(that.parties.vTexte.val());
     24         that.vueNormale();
     25     };
     26     
     27     this.anuleÉditionTitreBloc = function() {
     28         that.parties.vTexte.val(mTitreBloc.titre());
     29         that.vueNormale();
     30     };
     31     
     32     this.vueNormale = function() {
     33         that.parties.vTitre.show();
     34         that.parties.vÉdition.hide();
     35     };
     36     
     37     // Binding
     38     mTitreBloc.onChangeTitre(this.updateTitreBloc);
     39     this.updateTitreBloc(mTitreBloc, mTitreBloc.titre());
     40     
     41     that.parties.vTitre.dblclick(this.editerTitreBloc);
     42     
     43     that.parties.vCancel.click(this.anuleÉditionTitreBloc);
     44     
     45     that.parties.vÉdition.submit(function(e) {
     46         that.accepteÉditionTitreBloc();
     47         return false;
     48     });
     49     
     50     // Défauts
     51     this.vueNormale();
     52 }