titre-définition.js~ (1529B)
1 function MTitreDéfinition() { 2 makeUid(this); 3 makeField(this, 'titre', 'Nom de la définition'); 4 } 5 6 function VTitreDéfinition(mTitreDéfinition, emplacement) { 7 makeView(this, 'vTitreDéfinition', emplacement, 'vTitre', 'vÉdition', 'vTexte', 'vSubmit', 'vCancel'); 8 9 var that = this; 10 11 // Actions 12 this.updateTitreDéfinition = function(mTitreDéfinition, titre) { 13 that.parties.vTitre.text(titre); 14 that.parties.vTexte.val(titre); 15 }; 16 17 this.editerTitreDéfinition = function() { 18 that.parties.vTitre.hide(); 19 that.parties.vÉdition.show(); 20 }; 21 22 this.accepteÉditionTitreDéfinition = function() { 23 mTitreDéfinition.titre(that.parties.vTexte.val()); 24 that.vueNormale(); 25 }; 26 27 this.anuleÉditionTitreDéfinition = function() { 28 that.parties.vTexte.val(mTitreDéfinition.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 mTitreDéfinition.onChangeTitre(this.updateTitreDéfinition); 39 this.updateTitreDéfinition(mTitreDéfinition, mTitreDéfinition.titre()); 40 41 that.parties.vTitre.dblclick(this.editerTitreDéfinition); 42 43 that.parties.vCancel.click(this.anuleÉditionTitreDéfinition); 44 45 that.parties.vÉdition.submit(function(e) { 46 that.accepteÉditionTitreDéfinition(); 47 return false; 48 }); 49 50 // Défauts 51 this.vueNormale(); 52 }