orbit-basic/app/views/admin/users_new_interface/_form.html.erb

69 lines
2.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="user-info">
<div class="user-avatar pull-left">
<p class="reflective"></p>
<% if @user.avatar? %>
<%= image_tag(@user.avatar.thumb.url) %>
<% else %>
<%= image_tag "person.png" %>
<% end %>
<%= file_field_tag 'file' %>
<%= hidden_field_tag :avatar_cache %>
</div>
<label>
<%= f.check_box :admin %>
<span><%= t(:admin) %></span>
</label>
</div>
<%= 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 -%>