add_more ok
This commit is contained in:
1 parent
69bf552fa7
commit
be448d42c9
12 files changed
+645
-489
No files matched your search
@@ -33,8 +33,8 @@
|
||||
<label class="control-label"><%= t("admin.infos.options")%></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][multilingual]","true",attribute_field["typeA"]["multilingual"]) %>
|
||||
<%= t("admin.infos.multilingual")%>
|
||||
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"]) %>
|
||||
<%= t("admin.infos.cross_lang")%>
|
||||
</label>
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"]) %>
|
||||
@@ -48,7 +48,12 @@
|
||||
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeB") do %>
|
||||
<%= render :partial=> "placeholder_block",:locals=>{:label_ext=>t("admin.infos.initial"),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeB][initial]"}%>
|
||||
|
||||
<%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][typeB][option_list]"} %>
|
||||
<% if attribute_field.self_defined_markup_options?%>
|
||||
<%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][attribute][role][statuses]"} %>
|
||||
<%else #normal list%>
|
||||
<%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][typeB][option_list]"} %>
|
||||
<% end #of self_defined_markup_options?%>
|
||||
|
||||
<% end %>
|
||||
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeC") do %>
|
||||
<div class="control-group">
|
||||
@@ -85,8 +90,8 @@
|
||||
<label class="control-label"><%= t("admin.infos.options")%></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeD][multilingual]","true",attribute_field["typeD"]["multilingual"]) %>
|
||||
<%= t("admin.infos.multilingual")%>
|
||||
<%= check_box_tag("info[attribute_fields][#{attribute_field_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
|
||||
<%= t("admin.infos.cross_lang")%>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
<table id='attributes' border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t(:key) %></td>
|
||||
<td><%= t(:multilingual) %></td>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<td><%= t('admin.cross_lang') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
|
||||
@@ -20,88 +20,50 @@
|
||||
|
||||
<% content_for :page_specific_javascript do -%>
|
||||
<script>
|
||||
// $('.site-map').masonry({
|
||||
// itemSelector: '.map-block',
|
||||
// columnWidth: 450,
|
||||
// isAnimated: true
|
||||
// });
|
||||
$(document).ready(function(){
|
||||
function subrole_disable_field( triggled_object, switch_value_str){
|
||||
var switch_field = triggled_object.attr("for");
|
||||
$("input.subrole_disable_field[for="+switch_field+"]").val(switch_value_str)
|
||||
}
|
||||
|
||||
function checkSwitch() {
|
||||
$(".groups").each(function() {
|
||||
$(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
|
||||
});
|
||||
}
|
||||
function checkMultipleInput() {
|
||||
$(".multipleInput").each(function() {
|
||||
$(this).find('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
|
||||
});
|
||||
}
|
||||
function removeInput(){
|
||||
$(".removeInput").click(function (){
|
||||
$(this).parents(".controls").remove();
|
||||
checkMultipleInput();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
checkSwitch();
|
||||
checkMultipleInput();
|
||||
removeInput();
|
||||
$(".help-block a").click(function (){
|
||||
var $CloneTarget = $(this).parents(".controls").prev(".multipleInput").find('.controls:last');
|
||||
$(this).parents(".controls").prev(".multipleInput").append($CloneTarget.clone());
|
||||
$(this).parents(".controls").prev(".multipleInput").find('.controls:last input').val("");
|
||||
removeInput();
|
||||
checkMultipleInput();
|
||||
return false;
|
||||
})
|
||||
$(".status select").each(function (i) {
|
||||
$(this).change(function () {
|
||||
$(".status option:selected").eq(i).each(function () {
|
||||
if($(this).attr("value")=="alumna") {
|
||||
$(this).parents(".status").nextAll(".graduated").removeClass("hide");
|
||||
$(this).parents(".status").nextAll(".graduated").find("select").removeAttr("disabled");
|
||||
}else{
|
||||
$(this).parents(".status").nextAll(".graduated").addClass("hide");
|
||||
$(this).parents(".status").nextAll(".graduated").find("select").attr({disabled:''});
|
||||
}
|
||||
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;
|
||||
})
|
||||
})
|
||||
$('.onoff').click(function () {
|
||||
if($(this).parents("h4").length==1) {
|
||||
$(this).parents(".map-block").toggleClass("disabled");
|
||||
$(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
|
||||
if($(this).parents(".map-block").hasClass("disabled")){
|
||||
$(this).text("OFF");
|
||||
// console.log("LV1");
|
||||
// console.log($(this));
|
||||
}else{
|
||||
$(this).text("ON");
|
||||
// console.log("LV1");
|
||||
// console.log($(this));
|
||||
}
|
||||
}
|
||||
if($(this).parents("legend").length==1) {
|
||||
$(this).toggleClass("disabled");
|
||||
$(this).parents("legend").next("div").toggleClass("hide");
|
||||
if($(this).parents("legend").next("div").hasClass("hide")){
|
||||
$(this).text("OFF");
|
||||
console.log("LV2");
|
||||
subrole_disable_field($(this),"true");
|
||||
}else{
|
||||
$(this).text("ON");
|
||||
console.log("LV2");
|
||||
subrole_disable_field($(this),"false");
|
||||
}
|
||||
checkSwitch();
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
<% end -%>
|
||||
@@ -2,6 +2,6 @@
|
||||
<% show_sub_role.attribute_fields.each do |item|%>
|
||||
<tr>
|
||||
<td class="span1"><%= item.title %></td>
|
||||
<td><%= show_attribute_value(@user.get_attribute_value(item).get_value_by_locale(I18n.locale)) %></td>
|
||||
<td><%= show_attribute_value(@user.get_attribute_value(item).get_value_by_locale(I18n.locale)) rescue '' %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user