address field. js and style is broken
This commit is contained in:
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 -%>
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<div class="modal hide fade" id="address-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; ">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">Modal header</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>One fine body…</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
<button class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,61 @@
|
||||
<div class="modal hide fade address-edit <%= btn_class %>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel"><%= (field_name rescue nil) || t("address_modal.default_title") %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs">
|
||||
<% VALID_LOCALES.each do |locale|%>
|
||||
<% active = (locale == VALID_LOCALES.first ? "active" : nil ) %>
|
||||
<%= content_tag :i,:class=>active do%>
|
||||
<%= link_to t("langs.#{locale}"),".#{btn_class}.address_modal.#{locale}",:data=>{:toggle=>"tab"}%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<% VALID_LOCALES.each do |locale|%>
|
||||
<!-- start of lang tab context -->
|
||||
<% active = (locale == VALID_LOCALES.first ? "active" : "" ) %>
|
||||
<div class="tab-pane <%= active %> fade in <%= "#{btn_class} address_modal #{locale}" %>" for="<%= locale %>">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="street_address"><%= t("address_modal.street_address") %></label>
|
||||
<div class="controls">
|
||||
<%= text_area_tag("#{btn_class}_street_address_#{locale}",nil,:rows=>3) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="city"><%= t("address_modal.city") %></label>
|
||||
<div class="controls">
|
||||
<%= text_field_tag("#{btn_class}_city_#{locale}") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="counties"><%= t("address_modal.county") %></label>
|
||||
<div class="controls">
|
||||
<%= text_field_tag("#{btn_class}_county_#{locale}") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="zip"><%= t("address_modal.zip") %></label>
|
||||
<div class="controls">
|
||||
<%= text_field_tag("#{btn_class}_zip_#{locale}",nil,:class=>"input-mini") %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="country"><%= t("address_modal.country") %></label>
|
||||
<div class="controls">
|
||||
<%= text_field_tag("#{btn_class}_country_#{locale}") %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of tab context -->
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true"><%=t("modal.close")%></button>
|
||||
<button href="" class="btn btn-primary bt-save" data-dismiss="modal" aria-hidden="true"><%=t("modal.save_and_close")%></button>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user