address field and text field convert
This commit is contained in:
1 parent
a85e5fcc0d
commit
17988f2fb2
10 files changed
+217
-116
No files matched your search
@@ -0,0 +1,33 @@
|
||||
function checkSwitch() {
|
||||
$(".groups").each(function() {
|
||||
$(this).find('.form-horizontal > .hide').length < $(this).find('.form-horizontal > div').length ? $(this).removeClass("disabled") : $(this).addClass("disabled")
|
||||
});
|
||||
// $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
checkSwitch();
|
||||
$('.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");
|
||||
}else{
|
||||
$(this).text("ON");
|
||||
}
|
||||
}
|
||||
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");
|
||||
}else{
|
||||
$(this).text("ON");
|
||||
}
|
||||
checkSwitch();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
$(document).ready(function(){
|
||||
$(".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:''});
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
});
|
||||
+34
-17
@@ -1,21 +1,38 @@
|
||||
jQuery(document).ready(function($) {
|
||||
// Stuff to do as soon as the DOM is ready. Use $() w/o colliding with other libs;
|
||||
var current_textarea = {};
|
||||
current_textarea['en'] = $("textarea[for=en]").val();
|
||||
current_textarea['zh_tw'] = $("textarea[for=zh_tw]").val();
|
||||
var lang = <%= VALID_LOCALES.to_s %>;
|
||||
|
||||
$.each(lang,function(index,value){
|
||||
current_textarea[value] = $("textarea[for="+value+"]").val();
|
||||
});
|
||||
|
||||
// current_textarea['en'] = $("textarea[for=en]").val();
|
||||
// current_textarea['zh_tw'] = $("textarea[for=zh_tw]").val();
|
||||
|
||||
|
||||
|
||||
$("div.controls").on("click","a.edit-btn",function(){
|
||||
switch($(this).parent().parent().find("ul li.active a").attr("href")){
|
||||
case ".tab1":
|
||||
$("#tab3").addClass("active in");
|
||||
$(".modal-body li").eq(0).addClass("active");
|
||||
break;
|
||||
case ".tab2":
|
||||
$("#tab4").addClass("active in");
|
||||
$(".modal-body li").eq(1).addClass("active");
|
||||
break;
|
||||
}
|
||||
var lang = ["en","zh_tw"];
|
||||
for(i=0;i<2;i++){
|
||||
choosen_lang = $(this).parent().parent().find("ul li.active").attr("for");
|
||||
$(this).parents(".editMore").find(".modal_tab").removeClass("active in");
|
||||
$(this).parents(".editMore").find(".modal_tab[for="+choosen_lang+"]").addClass("active in");
|
||||
|
||||
$(this).parents(".editMore").find(".modal-body li").removeClass("active");
|
||||
$(this).parents(".editMore").find(".modal-body li[for="+choosen_lang+"]").addClass("active");
|
||||
// switch($(this).parent().parent().find("ul li.active a").attr("href")){
|
||||
// case ".tab1":
|
||||
|
||||
// $("#tab3").addClass("active in");
|
||||
// $(".modal-body li").eq(0).addClass("active");
|
||||
// break;
|
||||
// case ".tab2":
|
||||
// $("#tab4").addClass("active in");
|
||||
// $(".modal-body li").eq(1).addClass("active");
|
||||
// break;
|
||||
});
|
||||
|
||||
|
||||
$.each(lang,function(i,value){
|
||||
|
||||
var sa = $(".tab-content input.street_address_"+lang[i]).val();
|
||||
var city = $(".tab-content input.city_"+lang[i]).val();
|
||||
@@ -36,8 +53,8 @@ jQuery(document).ready(function($) {
|
||||
$(".tab-content").find('#street_address_'+lang[i]).val($(".tab-content textarea[for="+lang[i]+"]").val());
|
||||
$(".modal-body input").val("");
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$("textarea.dummy").change(function(){
|
||||
var lang = $(this).attr("for");
|
||||
if(current_textarea[lang] != $(this).val())
|
||||
@@ -54,7 +71,7 @@ jQuery(document).ready(function($) {
|
||||
|
||||
})
|
||||
$(".bt-save").click(function(){
|
||||
var lang = ["en","zh_tw"];
|
||||
var lang = <%= VALID_LOCALES.to_s %>;
|
||||
for(i=0;i<2;i++){
|
||||
var sa = $(".tab-content").find('#street_address_'+lang[i]).val();
|
||||
var city = $(".tab-content").find('#city_'+lang[i]).val();
|
||||
@@ -1,3 +1,5 @@
|
||||
// var $CloneTarget ;
|
||||
|
||||
function checkMultipleInput() {
|
||||
$(".multipleInput").each(function() {
|
||||
$(this).children('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
|
||||
@@ -18,7 +20,15 @@
|
||||
$modalNumber+=1;
|
||||
var $CloneTarget = $(this).parents(".controls").prev(".multipleInput").children('.controls:last');
|
||||
$(this).parents(".controls").prev(".multipleInput").append($CloneTarget.clone());
|
||||
$(this).parents(".controls").prev(".multipleInput").children('.controls:last input').val("");
|
||||
|
||||
// $(this).parents(".controls").prev(".multipleInput").children('.controls:last input').val("");
|
||||
$(this).parents(".controls").prev(".multipleInput").children('.controls:last').find('input').val('')
|
||||
$(this).parents(".controls").prev(".multipleInput").children('.controls:last').find('.tab-pane').addClass("NewInput_"+$modalNumber)
|
||||
btn = $(this).parents(".controls").prev(".multipleInput").children('.controls:last').find(".nav.nav-pills li")
|
||||
$.each(btn,function(i,value){
|
||||
old_link = $(this).children("a").attr("href");
|
||||
$(this).children("a").attr("href",old_link+".NewInput_"+$modalNumber);
|
||||
});
|
||||
removeInput();
|
||||
checkMultipleInput();
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user