Subversion Repositories eFlore/Applications.cel

Rev

Rev 3166 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3165 idir 1
function nouveauChamps(html){
2
	var html =
3
		'<div>'+
4
			'<label for="nom_champs">Nom du champ</label>'+
5
			'<input type="text" value="Nom du Champs" id="nom_champs">'+
6
 
7
			'<label for="type_champ">Type de champ</label>'+
8
			'<select name="type_champ" id="type_champ">'+
9
				'<option value="text">Champ texte</option>'+
10
				'<option value="textarea">Champ rédaction</option>'+
11
				'<option value="select">Menu déroulant</option>'+
12
				'<option value="checkbox">Cases à cocher</option>'+
13
				'<option value="radio">Boutons radio</option>'+
14
				'<option value="date">Calendrier</option>'+
15
				'<option value="file">Téléchargement</option>'+
16
				'<option value="hidden">Caché</option>'+
17
				'<option value="button">Bouton</option>'+
18
			'</select>'+
19
		'<div>';
20
 
21
 
22
	$('#profile-details-fields-section').append(html);
23
}
24
 
25
function inputFileStyle() {
26
 
27
	// ajout de la classe JS à HTML
28
		$('html').addClass('js');
29
 
30
		// initialisation des variables
31
		var $fileInput  = $( ".input-file" ),
32
		    $button     = $( ".label-file" ),
33
	    	$the_return = $(".file-return");
34
 
35
		// action lorsque la "barre d'espace" ou "Entrée" est pressée
36
		$button.on( 'keydown', function( event ) {
37
		    if ( event.keyCode == 13 || event.keyCode == 32 ) {
38
		        $fileInput.focus();
39
		    }
40
		});
41
 
42
		// action lorsque le label est cliqué
43
		$button.on( 'click', function( event ) {
44
		   $fileInput.focus();
45
		   return false;
46
		});
47
 
48
		// affiche un retour visuel dès que input:file change
49
		// ...A voir ok=lus tard
50
		// $fileInput.on( 'change', function( event ) {
51
		// 	file = this.value();
52
		//     $the_return.html( file );
53
		// });
54
}
55
 
56
jQuery(document).ready(function() {
57
 
58
	inputFileStyle()
59
 
60
	// var $projet = $('#projet');
61
 
62
	// $projet.on('change', function( event ) {
63
	// 	console.log($projet.val());
64
	// 	$.ajax({
65
	// 		url : 'http://localhost/widget:cel:manager',
66
	// 		type : 'post',
67
	// 		datatype : 'mode=creation&projet='+ $projet.val()
68
	// 	});
69
	// });
70
 
71
 
72
	$('#add_fields').on("click", function(){
73
		nouveauChamps();
74
	});
75
 
76
});