Ray's changes for css and js
This commit is contained in:
1 parent
408bebaa4b
commit
fe82427baa
306 files changed
+20659
-607
No files matched your search
@@ -0,0 +1,37 @@
|
||||
function loadViewPage(url, id) {
|
||||
var $listView = $(id);
|
||||
|
||||
$listView.empty().removeClass('in active');
|
||||
$listView.load(url, function(response, status, xhr) {
|
||||
$(this).addClass('in active');
|
||||
$('#member-card').imagesLoaded(function() {
|
||||
$('#member-card .member-avatar img').muImageResize({width: 150, height:150});
|
||||
});
|
||||
$('#member-abstract').imagesLoaded(function() {
|
||||
$('#member-abstract .member-avatar img').muImageResize({width: 250, height:120});
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$search = window.location.pathname.substring(1);
|
||||
$search = $search.split("/");
|
||||
$search = $search[$search.length-1];
|
||||
$viewType = window.localStorage.getItem('viewType') || '#member-list';
|
||||
$viewSwitchNo = window.localStorage.getItem('viewSwitchNo') || 0;
|
||||
if($search == 'users-registrant-list.shtml') {
|
||||
loadViewPage('member-registrant-list.html ' + $viewType, '#list-view');
|
||||
} else {
|
||||
loadViewPage('member-list.html ' + $viewType, '#list-view');
|
||||
};
|
||||
$('.view-switch').children('.btn').eq($viewSwitchNo).addClass('active');
|
||||
$('.view-switch').delegate(".btn", 'click', function(e){
|
||||
var url = $(this).attr('href'),
|
||||
ID = url.split("#"),
|
||||
ID = '#' + ID[ID.length-1];
|
||||
window.localStorage.setItem('viewType', ID);
|
||||
window.localStorage.setItem('viewSwitchNo', $(this).index());
|
||||
loadViewPage(url, '#list-view');
|
||||
e.preventDefault();
|
||||
});
|
||||
})
|
||||
@@ -0,0 +1,55 @@
|
||||
// Go to
|
||||
!function ($) {
|
||||
$.fn.goTo = function (){
|
||||
var $this = this,
|
||||
$destination = $this.attr('href'),
|
||||
$offset = $($destination).offset();
|
||||
$this.on(clickEvent, function() {
|
||||
$("html, body").animate({
|
||||
scrollTop: $offset.top,
|
||||
}, 500);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}(window.jQuery);
|
||||
function checkHeight() {
|
||||
if($('#member-module').height() > $(window).height()) {
|
||||
H = $(window).height()-
|
||||
parseInt($('.wrap-inner').css('padding-top'))+
|
||||
parseInt($('.wrap-inner').css('padding-bottom'))-
|
||||
$('#orbit-bar').outerHeight(true);
|
||||
}else{
|
||||
H = $(window).height()-
|
||||
parseInt($('.wrap-inner').css('padding-top'))+
|
||||
parseInt($('.wrap-inner').css('padding-bottom'))-
|
||||
$('#filter').outerHeight()+
|
||||
parseInt($('#filter').css('margin-bottom'))-
|
||||
$('#orbit-bar').outerHeight(true);
|
||||
};
|
||||
$('#basic-info').height(H);
|
||||
$('#member-roles').height(H-$('.member-avatar').outerHeight(true)-parseInt($('#member-roles').css('margin-top')))
|
||||
};
|
||||
|
||||
$(function() {
|
||||
var H;
|
||||
checkHeight();
|
||||
$(window).resize(function() {
|
||||
checkHeight();
|
||||
setModuleBlockWidth();
|
||||
});
|
||||
$('#member-roles h4 > span').each(function() {
|
||||
$(this).css('margin-left',function() {
|
||||
return $(this).innerWidth()/2*-1;
|
||||
})
|
||||
})
|
||||
$('#basic-info').scrollToFixed({
|
||||
marginTop: $('#orbit-bar').outerHeight(true)+20,
|
||||
});
|
||||
$('#module-navbar').scrollToFixed({
|
||||
marginTop: $('#orbit-bar').outerHeight(true),
|
||||
});
|
||||
$('.member-avatar').imagesLoaded(function() {
|
||||
$('#basic-info .member-avatar img').muImageResize({width: 100, height:100});
|
||||
});
|
||||
$('#member-roles').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
|
||||
})
|
||||
@@ -0,0 +1,475 @@
|
||||
// Retrieve the initial data
|
||||
function temporary() {
|
||||
attributesArray.length = 0;
|
||||
$('.attributes').each(function() {
|
||||
var attributesData = {},
|
||||
$selectType = $('.dataType').data().type;
|
||||
|
||||
// Capture "attributes-body" within the input[type = "text"] val
|
||||
$(this).find('.attributes-body').find('input[type="text"]').each(function(i) {
|
||||
var $type = $(this).data().type;
|
||||
attributesData[$type] = $(this).val();
|
||||
});
|
||||
|
||||
// Capture "attributes-body" within the input[type = "radio"] checked
|
||||
$(this).find('.attributes-body').find('input[type="radio"]').each(function(i) {
|
||||
var $type = $(this).data().type;
|
||||
attributesData[$type] = $(this).prop("checked");
|
||||
});
|
||||
|
||||
// Capture "attributes-body" within the dataType selected
|
||||
$(this).find('.attributes-body').find('.dataType').children("option:selected").each(function () {
|
||||
attributesData[$selectType] = {};
|
||||
attributesData[$selectType].index = $(this).index();
|
||||
attributesData[$selectType].name = $(this).attr('ref');
|
||||
if($(this).attr('ref') == 'typeB' || $(this).attr('ref') == 'typeE' || $(this).attr('ref') == 'typeF') {
|
||||
attributesData[$selectType].option = [];
|
||||
}
|
||||
});
|
||||
|
||||
// Capture "field-type" within the input[type = "text"] val
|
||||
$(this).find('.field-type').find('input[type="text"]').each(function(i) {
|
||||
var $type = $(this).data().type;
|
||||
if(!$type.match('option_lang')) {
|
||||
attributesData[$selectType][$type] = $(this).val();
|
||||
}
|
||||
});
|
||||
|
||||
$(this).find('.field-type .add-target').find('.input-append').each(function() {
|
||||
var append = []
|
||||
$(this).children('input[type="text"]').each(function() {
|
||||
var val = $(this).val();
|
||||
append.push(val);
|
||||
});
|
||||
attributesData[$selectType].option.push(append);
|
||||
})
|
||||
|
||||
// Capture "field-type" within the input[type = "checkbox"] checked
|
||||
$(this).find('.field-type').find('input[type="checkbox"]').each(function() {
|
||||
var $type = $(this).data().type;
|
||||
attributesData[$selectType][$type] = $(this).prop("checked");
|
||||
});
|
||||
|
||||
// Capture "field-type" within the input[type = "radio"] checked
|
||||
$(this).find('.field-type').find('input[type="radio"]').each(function() {
|
||||
var $type = $(this).data().type;
|
||||
attributesData[$selectType][$type] = $(this).prop("checked");
|
||||
});
|
||||
|
||||
// Capture "field-type" within the dataType selected
|
||||
$(this).find('.field-type').find('select').children("option:selected").each(function () {
|
||||
attributesData[$selectType].dateFormat = $(this).index();
|
||||
});
|
||||
|
||||
attributesArray.push(attributesData);
|
||||
});
|
||||
};
|
||||
|
||||
// Determine the Append input length
|
||||
function inputAppendLength() {
|
||||
$('.add-target').each(function(i) {
|
||||
if($(this).children('.input-append:not(:hidden)').length == 1) {
|
||||
$(this).children('.input-append').each(function() {
|
||||
if($(this).children('div').hasClass('tab-content')) {
|
||||
var btnLength = $(this).children('.btn').length;
|
||||
$(this).find('.btn').eq(btnLength-2).addClass('last');
|
||||
$(this).find('.remove-input').addClass('hide');
|
||||
} else {
|
||||
var mediumLength = $(this).children('.input-medium').length;
|
||||
$(this).children('.input-medium').eq(mediumLength-1).addClass('last');
|
||||
$(this).children('.remove-input').addClass('hide');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(this).children('.input-append').each(function() {
|
||||
if($(this).children('div').hasClass('tab-content')) {
|
||||
$(this).find('.btn').removeClass('last');
|
||||
$(this).find('.remove-input').removeClass('hide');
|
||||
} else {
|
||||
$(this).children('.input-medium').removeClass('last');
|
||||
$(this).children('.remove-input').removeClass('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Role Attribute Template Data
|
||||
function setData(l, type, ol) {
|
||||
var fields = "role[attribute_fields]",
|
||||
data = {
|
||||
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
|
||||
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
|
||||
_cross_lang: ["cross_lang_" +l, fields+"["+l+"]["+type+"][cross_lang]"],
|
||||
_disabled: ["disabled_" +l, fields+"["+l+"][disabled]"],
|
||||
_format: ["format_" +l, fields+"["+l+"]["+type+"][format]"],
|
||||
_initial: ["initial_" +l, fields+"["+l+"]["+type+"][initial]"],
|
||||
_is_range: ["is_range_" +l, fields+"["+l+"]["+type+"][is_range]"],
|
||||
_key: ["key_" +l, fields+"["+l+"][key]"],
|
||||
_markup: fields+"["+l+"][markup]",
|
||||
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
|
||||
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
|
||||
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
|
||||
_to_delete: ["to_delete_" +l, fields+"["+l+"][to_delete]"],
|
||||
_to_search: ["to_search_" +l, fields+"["+l+"][to_search]"],
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
// Get Default Address Form
|
||||
function getAddressForm(trigger, element, decide) {
|
||||
if(decide) {
|
||||
addressVal.length = addressArray.length = 0;
|
||||
var addressAllVal = [];
|
||||
var inputNameArray = [];
|
||||
trigger.parents('.input-append').find('.tab-pane').each(function() {
|
||||
var adderssText = $(this).children('input[type="text"]').val(),
|
||||
addersshidden = '',
|
||||
addressData = {},
|
||||
inputName = [];
|
||||
$(this).children('input:not(:first)').each(function(j) {
|
||||
var name = $(this).attr('name'),
|
||||
val = $(this).val();
|
||||
addersshidden += val;
|
||||
addressData[name] = val;
|
||||
inputName.push(name);
|
||||
});
|
||||
addressArray.push(addressData);
|
||||
addressAllVal.push(adderssText);
|
||||
inputNameArray.push(inputName);
|
||||
if(adderssText != addersshidden) {
|
||||
addressVal.push(false);
|
||||
} else {
|
||||
addressVal.push(true);
|
||||
}
|
||||
});
|
||||
element.find('.tab-pane').each(function(i) {
|
||||
$(this).find('textarea, input[type="text"]').each(function(j) {
|
||||
$(this).attr('name',inputNameArray[i][j]);
|
||||
});
|
||||
if(addressVal[i]) {
|
||||
$(this).find('textarea, input[type="text"]').each(function(j) {
|
||||
$(this).val(addressArray[i][$(this).attr('name')]);
|
||||
});
|
||||
} else {
|
||||
$(this).find('textarea').val(addressAllVal[i]);
|
||||
$(this).find('input[type="text"]').each(function(j) {
|
||||
$(this).val('');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
element.off('show');
|
||||
};
|
||||
|
||||
// Return Address Form
|
||||
function returnAddressForm(element, decide) {
|
||||
if(decide) {
|
||||
addressArray.length = 0;
|
||||
element.find('.tab-pane').each(function(i) {
|
||||
var addressData = {};
|
||||
$(this).find('textarea, input[type="text"]').each(function(j) {
|
||||
var name = $(this).attr('name'),
|
||||
val = $(this).val();
|
||||
addressData[name] = val;
|
||||
});
|
||||
addressArray.push(addressData);
|
||||
});
|
||||
$.map(addressInputId, function(n, i) {
|
||||
var v = '';
|
||||
$('#'+n).find('input[type="hidden"]').each(function() {
|
||||
$(this).val(addressArray[i][$(this).attr('name')]);
|
||||
v += addressArray[i][$(this).attr('name')]
|
||||
});
|
||||
$('#'+n).find('input[type="text"]').each(function() {
|
||||
$(this).val(v);
|
||||
});
|
||||
});
|
||||
};
|
||||
returnDecide = false;
|
||||
};
|
||||
|
||||
$(function() {
|
||||
appendIndex = null;
|
||||
if($('#new-user-forms').length) {
|
||||
addressVal = [];
|
||||
addressArray = [];
|
||||
addressInputId = [];
|
||||
roleType = null;
|
||||
returnDecide = false;
|
||||
$('.returnDecide').on(clickEvent, function() {
|
||||
returnDecide = true;
|
||||
})
|
||||
$('#address-field').on('hidden', function () {
|
||||
$('.btn[data-toggle="modal"]').removeClass('active').blur();
|
||||
$(this).find('.nav-tabs > li').removeClass('active').eq(0).addClass('active');
|
||||
$(this).find('.tab-content > .tab-pane').removeClass('active in').eq(0).addClass('active in');
|
||||
$(this).on('show', getAddressForm(null, $(this), false));
|
||||
returnAddressForm($(this), returnDecide)
|
||||
});
|
||||
$('.control-group').delegate('.btn[data-toggle="modal"]', 'click', function() {
|
||||
var $trigger = $(this);
|
||||
addressInputId.length = 0;
|
||||
$(this).parents('.input-append').find('.tab-pane').each(function() {
|
||||
addressInputId.push($(this).attr('id'));
|
||||
});
|
||||
$('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true));
|
||||
});
|
||||
$('#new-user-forms').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
|
||||
if($(this).hasClass('togglebox')) {
|
||||
if($(this).hasClass('disabled')) {
|
||||
$(this).find('.toggle-check')
|
||||
.attr('value', 'false')
|
||||
.parents('.attributes')
|
||||
.removeClass('disabled')
|
||||
.find('.attributes-body')
|
||||
.fadeIn(300);
|
||||
} else {
|
||||
$(this).find('.toggle-check')
|
||||
.attr('value', 'true')
|
||||
.parents('.attributes')
|
||||
.addClass('disabled')
|
||||
.find('.attributes-body')
|
||||
.fadeOut(300);
|
||||
}
|
||||
$(this).toggleClass('disabled');
|
||||
};
|
||||
if($(this).hasClass('remove-input')) {
|
||||
$(this).parents('.input-append').fadeOut(300, function() {
|
||||
inputAppendLength();
|
||||
});
|
||||
};
|
||||
if($(this).hasClass('trigger')) {
|
||||
appendIndex = $(this).parents('.controls').find('.input-append').length;
|
||||
roleType = $(this).data('roles')
|
||||
if($(this).hasClass('textInput')) {
|
||||
$("#template-text").tmpl().appendTo($(this).parents('.controls').find('.add-target'));
|
||||
} else if ($(this).hasClass('textLengInput')) {
|
||||
$("#template-text-language").tmpl().appendTo($(this).parents('.controls').find('.add-target'));
|
||||
} else if ($(this).hasClass('address')) {
|
||||
$("#template-address").tmpl().appendTo($(this).parents('.controls').find('.add-target'));
|
||||
}
|
||||
inputAppendLength();
|
||||
};
|
||||
event.preventDefault();
|
||||
});
|
||||
inputAppendLength();
|
||||
} else {
|
||||
attributesArray = [];
|
||||
attributesLength = $('#attributes-area .attributes').length;
|
||||
attributesHeaderLength = null;
|
||||
templateType = null;
|
||||
attributeIndex = null;
|
||||
if($('.add-target').length) {
|
||||
inputAppendLength();
|
||||
}
|
||||
if(!$('.attributes').length) {
|
||||
$('#attributes-area').addClass('clickHere');
|
||||
} else {
|
||||
temporary();
|
||||
};
|
||||
|
||||
$('.add-attributes').on(clickEvent, function() {
|
||||
if($('#attributes-area').hasClass('clickHere')) {
|
||||
$('#attributes-area').removeClass('clickHere');
|
||||
};
|
||||
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
|
||||
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
|
||||
$('.toggle-check').togglebox();
|
||||
attributesLength = $('#attributes-area .attributes').length;
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('.attributes.default').each(function(i) {
|
||||
$(this).children('.field-type').not('.default').hide();
|
||||
$(this).find('input[type="text"]').on('keyup', function() {
|
||||
$(this).trigger("checking");
|
||||
});
|
||||
$(this).find('input[type="radio"], input[type="checkbox"], select').change(function() {
|
||||
$(this).trigger("checking");
|
||||
});
|
||||
$(this).delegate('input[type="text"], input[type="radio"], input[type="checkbox"], select', 'checking', function(e) {
|
||||
var e = e.target.type,
|
||||
$data = $(this).data().type;
|
||||
switch(e) {
|
||||
case 'text':
|
||||
var val = $(this).val();
|
||||
if(!$(this).parents('.field-type').length) {
|
||||
$data = attributesArray[i][$data];
|
||||
} else if(!$(this).parents('.add-target').length) {
|
||||
$data = attributesArray[i].select[$data];
|
||||
} else {
|
||||
appendIndex = $(this).parent('.input-append').index()
|
||||
optionIndex = $(this).index()
|
||||
$data = attributesArray[i].select.option[appendIndex][optionIndex];
|
||||
}
|
||||
if(val != $data) {
|
||||
$(this).parents('.attributes').find('.reply').removeClass('hide');
|
||||
}
|
||||
break;
|
||||
case 'radio':
|
||||
var checked = $(this).prop("checked");
|
||||
$data = attributesArray[i][$data];
|
||||
if(checked != $data) {
|
||||
$(this).parents('.attributes').find('.reply').removeClass('hide');
|
||||
}
|
||||
break;
|
||||
case 'checkbox':
|
||||
var checked = $(this).prop("checked");
|
||||
$data = attributesArray[i].select[$data];
|
||||
if(checked != $data) {
|
||||
$(this).parents('.attributes').find('.reply').removeClass('hide');
|
||||
}
|
||||
break;
|
||||
case 'select-one':
|
||||
var ref,
|
||||
$data = attributesArray[i].select.name;
|
||||
$(this).children("option:selected").each(function() {
|
||||
ref = $(this).attr('ref');
|
||||
});
|
||||
if(ref != $data) {
|
||||
$(this).parents('.attributes').find('.reply').removeClass('hide');
|
||||
}
|
||||
break;
|
||||
};
|
||||
});
|
||||
$(this).delegate('.reply', clickEvent, function() {
|
||||
var $bodyText = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="text"]'),
|
||||
$bodyRadio = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="radio"]'),
|
||||
$bodySelected = $(this).parent('.attributes-header').siblings('.attributes-body').find('.dataType').children("option"),
|
||||
$fieldTypeO = $(this).parent('.attributes-header').siblings('.field-type.default'),
|
||||
$fieldTypeN = $(this).parent('.attributes-header').siblings('.field-type').not('.default');
|
||||
$bodyText.each(function() {
|
||||
var $type = $(this).data().type;
|
||||
$(this).val(attributesArray[i][$type]);
|
||||
});
|
||||
$bodyRadio.each(function() {
|
||||
var $type = $(this).data().type;
|
||||
$(this).prop("checked", attributesArray[i][$type])
|
||||
});
|
||||
$fieldTypeO.find('input[type="text"]').each(function() {
|
||||
var $type = $(this).data().type;
|
||||
if(!$type.match('option_lang')) {
|
||||
$(this).val(attributesArray[i].select[$type]);
|
||||
}
|
||||
});
|
||||
$fieldTypeO.find('.add-target').find('.input-append').each(function(k) {
|
||||
$(this).children('input[type="text"]').each(function(j) {
|
||||
$(this).val(attributesArray[i].select.option[k][j]);
|
||||
// var val = $(this).val();
|
||||
// append.push(val);
|
||||
});
|
||||
})
|
||||
$fieldTypeO.find('input[type="checkbox"], input[type="radio"]').each(function() {
|
||||
var $type = $(this).data().type;
|
||||
$(this).prop("checked", attributesArray[i].select[$type]);
|
||||
});
|
||||
$fieldTypeO.find('select').children("option").eq(attributesArray[i].select.dateFormat).prop('selected',true);
|
||||
$bodySelected.eq(attributesArray[i].select.index).prop('selected',true);
|
||||
$fieldTypeO.show();
|
||||
$fieldTypeN.empty().hide();
|
||||
$(this).addClass('hide')
|
||||
return false
|
||||
})
|
||||
});
|
||||
$('#attributes-area').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
|
||||
if($(this).hasClass('togglebox')) {
|
||||
if($(this).hasClass('disabled')) {
|
||||
$(this).find('.toggle-check')
|
||||
.attr('value', 'false')
|
||||
.parents('.attributes')
|
||||
.removeClass('disabled')
|
||||
.find('input, select')
|
||||
.removeAttr('disabled')
|
||||
.end('.attributes')
|
||||
.find('.btn-group .btn')
|
||||
.removeClass('disabled')
|
||||
.end().find('.attribute_field_disabled').attr('value', 'false');
|
||||
if($(this).parents('.attributes').find('.dataType').children("option:selected").attr('ref')) {
|
||||
$(this).parents('.attributes').find('.field-type').addClass('in').find('.control-group').delay(150).fadeIn(300);
|
||||
}
|
||||
} else {
|
||||
$(this).find('.toggle-check')
|
||||
.attr('value', 'true')
|
||||
.parents('.attributes')
|
||||
.addClass('disabled')
|
||||
.find('.attributes-body input, .attributes-body select')
|
||||
.attr({'disabled': 'disabled'})
|
||||
.end('.attributes')
|
||||
.find('.btn-group .btn')
|
||||
.addClass('disabled')
|
||||
.end().find('.attribute_field_disabled').attr('value', 'true')
|
||||
.end().find('.field-type .control-group').fadeOut(300, function() {
|
||||
$(this).parent('.field-type').removeClass('in');
|
||||
});
|
||||
}
|
||||
$(this).toggleClass('disabled');
|
||||
};
|
||||
if($(this).hasClass('delete')) {
|
||||
$(this).parents('.attributes').fadeOut(300, function() {
|
||||
$('.attributes:not(:hidden)').each(function(i) {
|
||||
$(this).find('.attributes-header h4 span').text(i+1);
|
||||
});
|
||||
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
|
||||
if(!$('.attributes:not(:hidden)').length) {
|
||||
$('#attributes-area').addClass('clickHere');
|
||||
};
|
||||
}).find('.attribute_field_to_delete').attr('value', 'true');;
|
||||
};
|
||||
if($(this).hasClass('trigger')) {
|
||||
appendIndex = $(this).parents('.controls').find('.input-append').length;
|
||||
attributeIndex = $(this).parents('.attributes').index();
|
||||
$("#template-input-append").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo($(this).parents('.controls').find('.add-target'));
|
||||
inputAppendLength();
|
||||
};
|
||||
if($(this).hasClass('remove-input')) {
|
||||
$(this).parent('.input-append').fadeOut(300, function() {
|
||||
inputAppendLength();
|
||||
});
|
||||
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
$('#attributes-area').delegate('.dataType', 'change', function() {
|
||||
$(this).children("option:selected").each(function () {
|
||||
var target = $(this).parents('.attributes').find('.field-type').not('.default');
|
||||
attributeIndex = $(this).parents('.attributes').index();
|
||||
appendIndex = $(this).parents('.attributes').find('.add-target').find('.input-append').length;
|
||||
if($(this).parents('.attributes').hasClass('default')){
|
||||
var i = $(this).parents('.attributes').index()
|
||||
if($(this).attr('ref') == attributesArray[i].select.name) {
|
||||
$(this).parents('.attributes').find('.field-type.default').show()
|
||||
target.empty().hide();
|
||||
} else {
|
||||
$(this).parents('.attributes').find('.field-type.default').hide()
|
||||
if($(this).attr('ref')) {
|
||||
templateType = $(this).attr('ref');
|
||||
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
|
||||
$("#template-type").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo(target);
|
||||
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
|
||||
inputAppendLength();
|
||||
}
|
||||
} else {
|
||||
target.removeAttr('class').addClass('field-type fade')
|
||||
target.empty();
|
||||
};
|
||||
target.show();
|
||||
}
|
||||
} else {
|
||||
if($(this).attr('ref')) {
|
||||
templateType = $(this).attr('ref');
|
||||
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
|
||||
$("#template-type").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo(target);
|
||||
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
|
||||
inputAppendLength();
|
||||
}
|
||||
} else {
|
||||
target.removeAttr('class').addClass('field-type fade')
|
||||
target.empty();
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
$(function() {
|
||||
var $btnW = null,
|
||||
$textareaLangBtnGroup = $('.textarea-lang > .btn-group'),
|
||||
$textareaLang = $('.textarea-lang'),
|
||||
$textareaTab = $('.textarea-lang > .tab-pane'),
|
||||
$textarea = $('.textarea-lang > .tab-pane > .resizable');
|
||||
$textareaLangBtnGroup.each(function() {
|
||||
$btnW = 4
|
||||
$(this).find('.btn').each(function() {
|
||||
$btnW += $(this).outerWidth(true);
|
||||
$(this).on('click', function() {
|
||||
var $id = $($(this).attr('href'));
|
||||
if($id.find('.ui-wrapper').height() < 96) {
|
||||
$id.find('.ui-wrapper').height(96)
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
$textarea.each(function() {
|
||||
$(this).width($btnW+100);
|
||||
});
|
||||
$textarea.resizable({
|
||||
maxHeight: 250,
|
||||
maxWidth: 500,
|
||||
minHeight: 100,
|
||||
minWidth: $btnW+114,
|
||||
handles: "se",
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user