address field. js and style is broken

This commit is contained in:
Matthew K. Fu JuYuan authored and chris committed 2012-11-20 09:53:36 +08:00
1 parent be448d42c9
commit a85e5fcc0d
14 files changed
+386 -311

No files matched your search

@@ -17,53 +17,3 @@
<%= render :partial=>"infos"%>
<%= render :partial=>"roles"%>
<% content_for :page_specific_javascript do -%>
<script>
var CloneTarget ;
var NewNode;
$(document).ready(function(){
function checkMultipleInput() {
$(".multipleInput").each(function(i) {
$(this).find('.tabbable').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
});
}
function removeInput(){
$(".removeInput").live('click',function (){
$(this).parents(".tabbable").remove();
checkMultipleInput();
return false;
});
}
checkMultipleInput();
removeInput();
$(".help-block a").live('click',function (){
CloneTarget = $(this).parents(".controls").find(".tabbable:last");
NewNode = CloneTarget.clone();
var index;
NewNode.find("input").each(function(k,v){
index = CloneTarget.parents("div.control-group").find(".list_count").val();
field_name = CloneTarget.parents("div.control-group").find(".field_name").val();
ori_str = $(v).attr("name").replace(field_name,"");
lang = ori_str.match(/\[\D*\]/);
new_field_name = (field_name+"[" + (parseInt(index)+1) + "]" + lang);
$(v).attr("name",new_field_name);
$(v).val("");
})
$(this).parents("div.control-group").find(".list_count").val(parseInt(index)+1)
$(this).parents(".controls").find(".tabbable:last").after(NewNode);
removeInput();
// checkMultipleInput();
return false;
})
});
</script>
</script>
<% end -%>
@@ -11,6 +11,9 @@
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %>
<%= javascript_include_tag "lib/contenteditable" %>
<%= javascript_include_tag "inc/ploy_input_field" %>
<%= javascript_include_tag "inc/input_module" %>
<% end -%>