Remove js from html

This commit is contained in:
chris2tof committed 2011-12-05 10:36:25 +08:00
1 parent 962bf03af2
commit 26b49dcf02
25 files changed
+101 -1206

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
$("div.editable").live("mouseenter mouseleave",
function (event) {
$(this).children('.edit_link').toggle();
});
@@ -0,0 +1,8 @@
$('div a.hide').live( "click", function(){
$(this).parent().next().hide();
$(this).replaceWith("<a href='#' class='show'><%= t(:show) %></a>");
});
$('div a.show').live( "click", function(){
$(this).parent().next().show();
$(this).replaceWith("<a href='#' class='hide'><%= t(:hide) %></a>");
});
@@ -0,0 +1,10 @@
var new_one = $('fieldset #new_one').clone();
$('fieldset #new_one').remove();
$('fieldset a.remove').live( "click", function(){
$(this).parent().remove();
});
$('fieldset a.add').click(function(){
new_one.clone().appendTo( $('fieldset') );
})
@@ -0,0 +1,33 @@
$('#attributes_block a.delete').live('click', function(){
$(this).parent().parent().parent().remove();
});
$('#attributes_block a.add').click(function(){
$('#attributes').append("<%= escape_javascript(render(:partial => 'admin/user_attribute_models/attribute_model', :object => @user_attribute_model.attribute_models.build)) %>");
});
$('#attributes_block a.remove_existing_record').click(function(){
$(this).next('.should_destroy').attr('value', 1);
$(this).parent().parent().hide();
});
$('#attributes_block a.change_built_in').click(function(){
$(this).parent().toggleClass('disable');
var $am = $(this).next('.built_in_state')
$am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
});
$('.select_mulitlingual input').live('click', function(){
$(this).next().attr('value', this.checked);
});
$('.select_type select').live('change', function(){
if(this.value == 'select')
{
$(this).next().show();
}
else
{
$(this).next().hide();
}
});
+6
View File
@@ -0,0 +1,6 @@
$(document).ready(function(){
$('#user_active_role').change(function(){
$('#role_models .roles_block').hide();
$('#'+this.value+'_block').toggle();
});
});