AppEnv: move listener to setup() function

This commit is contained in:
Hector Sanjuan committed 2012-09-21 15:50:55 +02:00
1 parent 9cf27e1cd2
commit 6a9004ba23
1 file changed
+15 -15
+15 -15
View File
@@ -104,7 +104,7 @@ var create_appenv_tmpl = '\
</div>\
<div class="appenv_param">\
<label for="templates">'+tr("Compatible templates")+':</label>\
<select type="text" name="templates" multiple>\
<select type="text" id="env_templates" name="templates" multiple>\
</select>\
</div>\
<div class="appenv_param">\
@@ -618,6 +618,20 @@ function setupCreateAppEnvDialog(){
return false;
});
//Somehow this needs to go here. Live() doesn't respond in setup function
$('select#env_templates option').live("click", function(){
var clicked = $(this).attr('clicked');
if (clicked){//unbold, unmark
$(this).text($(this).text().replace(/☒/g,'☐'));
$(this).removeAttr('clicked');
}
else {//bold,mark
$(this).text($(this).text().replace(/☐/g,'☒'));
$(this).attr('clicked','clicked');
}
return false;
});
/******** UNUSED
$('#add_custom_var_appenv_button', dialog).click(
function(){
@@ -702,20 +716,6 @@ function popUpCreateAppEnvDialog(){
$(this).text('☐ '+$(this).text());
});
//Somehow this needs to go here. Live() doesn't respond in setup function
$('select[name="templates"] option', dialog).click(function(){
var clicked = $(this).attr('clicked');
if (clicked){//unbold, unmark
$(this).text($(this).text().replace(/☒/g,'☐'));
$(this).removeAttr('clicked');
}
else {//bold,mark
$(this).text($(this).text().replace(/☐/g,'☒'));
$(this).attr('clicked','clicked');
}
return false;
});
dialog.dialog('open');
}