Skip to content

Commit

Permalink
Format code with standardjs
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 7154d8e according to the output
from standardjs.

Details: https://deepsource.io/gh/smalos/nubuilder_dev/transform/4e3e570d-758a-4c70-ad71-9e2d7a306d2a/
  • Loading branch information
deepsource-autofix[bot] committed Feb 2, 2023
1 parent 7154d8e commit bf9fab2
Showing 1 changed file with 64 additions and 105 deletions.
169 changes: 64 additions & 105 deletions experimental/edit_responsive_css_grid/edit_responsive_css_grid.js
Original file line number Diff line number Diff line change
@@ -1,111 +1,70 @@

function nuOnLoad() {
if (nuFormType() == 'edit') {
$(document).ready(function() {

function isResponsive() {

var f = window.nuFORM.getProperty('form_id');
return f.containsAny(['nuaccess']); // form B

}


if (isResponsive()) {



var o = nuSERVERRESPONSE.objects;
function nuOnLoad () {
if (nuFormType() == 'edit') {
$(document).ready(function () {
function isResponsive () {
const f = window.nuFORM.getProperty('form_id')
return f.containsAny(['nuaccess']) // form B
}

if (isResponsive()) {
const o = nuSERVERRESPONSE.objects
for (let i = 0; i < o.length; i++) {
let id = o[i].id;
let oType = o[i].type;
//nuContentBoxContainer


if (o[i].read !== '2'&& o[i].tab == '0' ) {
$('#'+ id + ",#label_"+id).wrapAll("<div class='nuObjectWrapper' />"); //removed map for testing
// $('#'+ id).map(function(index) {

// $(this).add($("label[for='"+this.id+"']")).wrapAll("<div class='nuObjectWrapper' />");



// });
}
if (oType == 'lookup') {

$("#"+id+",#label_"+id+",#"+id+"code, #"+id+"button,#"+id+"description").wrapAll('<div class="nuObjectWrapper nuLookupWrapper"></div>');
$("#"+id+"code, #"+id+"button,#"+id+"description ,#sal_zzzzsys_form_id_open_button").wrapAll('<div class="nuLuWrapper"></div>');

}

if (oType == 'file') {


$("#label_"+id+",#"+id+",#"+id+"_file").wrapAll('<div class="nuObjectWrapper nuFileWrapper"></div>');

}
if (o[i].select2 == '1') {


$("#label_"+id+",#"+id+", .select2").wrapAll('<div class="nuObjectWrapper"></div>');

}
if (o[i].input == 'button') {


$("#"+id+"").not("#sal_zzzzsys_form_id_open_button").wrapAll('<div class="nuObjectWrapper nuRespButton"></div>');//02/02/23 Added Class:nuRespButton

}

if (o[i].tab === 0 && oType == 'subform') { //subforms in tab one only-responsive + scroll on small screens

$("#label_"+id+",#"+id+"").wrapAll('<div class="nuObjectWrapper nuSubformWrapper"></div>');
$("#"+id+",#label_"+id+"").css({
'top': '', 'left': '', 'width': '', 'position': ''

});
$("#"+id+"").css({
'overflow-x': 'auto'});

} else if (o[i].tab != '0' && oType == 'subform') { //subform on other tabs are not wrapped and maintains its NB set positions + subforms are responsive
$("#"+id).css({
'width':'90vw','overflow-x':'auto'});
$("#label_"+id).css({
'top': parseInt($('#'+id).css("top"))-18, 'left': parseInt($('#'+id).css("left")) +0,'text-align': 'left' });
//other tabs subform labels are always on top

} else if (o[i].tab != '0') { //Other objects other tabs are not wrapped and maintains its NB set positions

$("#"+id).css({
'width':'50vw'}); //to be impelemented
$("#label_"+id).css({
'top': parseInt($('#'+id).css("top"))-18, 'left': parseInt($('#'+id).css("left")) +0,'text-align': 'left' });
//can be changes based on preference



} else {
$("#"+id+",#label_"+id+",#"+id+"_file, .select2, span, .selection" ).css({'top':'','left':'','width':'','position':'','height':''});
$("#"+id+"code,#"+id+"button,#"+id+"description").css({'top':'','left':'','width':'','position':'','height':''});

}


const id = o[i].id
const oType = o[i].type
// nuContentBoxContainer

if (o[i].read !== '2' && o[i].tab == '0') {
$('#' + id + ',#label_' + id).wrapAll("<div class='nuObjectWrapper' />") // removed map for testing
// $('#'+ id).map(function(index) {

// $(this).add($("label[for='"+this.id+"']")).wrapAll("<div class='nuObjectWrapper' />");

// });
}
if (oType == 'lookup') {
$('#' + id + ',#label_' + id + ',#' + id + 'code, #' + id + 'button,#' + id + 'description').wrapAll('<div class="nuObjectWrapper nuLookupWrapper"></div>')
$('#' + id + 'code, #' + id + 'button,#' + id + 'description ,#sal_zzzzsys_form_id_open_button').wrapAll('<div class="nuLuWrapper"></div>')
}

if (oType == 'file') {
$('#label_' + id + ',#' + id + ',#' + id + '_file').wrapAll('<div class="nuObjectWrapper nuFileWrapper"></div>')
}
if (o[i].select2 == '1') {
$('#label_' + id + ',#' + id + ', .select2').wrapAll('<div class="nuObjectWrapper"></div>')
}
if (o[i].input == 'button') {
$('#' + id + '').not('#sal_zzzzsys_form_id_open_button').wrapAll('<div class="nuObjectWrapper nuRespButton"></div>')// 02/02/23 Added Class:nuRespButton
}

if (o[i].tab === 0 && oType == 'subform') { // subforms in tab one only-responsive + scroll on small screens
$('#label_' + id + ',#' + id + '').wrapAll('<div class="nuObjectWrapper nuSubformWrapper"></div>')
$('#' + id + ',#label_' + id + '').css({
top: '', left: '', width: '', position: ''

})
$('#' + id + '').css({ 'overflow-x': 'auto' })
} else if (o[i].tab != '0' && oType == 'subform') { // subform on other tabs are not wrapped and maintains its NB set positions + subforms are responsive
$('#' + id).css({ width: '90vw', 'overflow-x': 'auto' })
$('#label_' + id).css({ top: parseInt($('#' + id).css('top')) - 18, left: parseInt($('#' + id).css('left')) + 0, 'text-align': 'left' })
// other tabs subform labels are always on top
} else if (o[i].tab != '0') { // Other objects other tabs are not wrapped and maintains its NB set positions
$('#' + id).css({ width: '50vw' }) // to be impelemented
$('#label_' + id).css({ top: parseInt($('#' + id).css('top')) - 18, left: parseInt($('#' + id).css('left')) + 0, 'text-align': 'left' })
// can be changes based on preference
} else {
$('#' + id + ',#label_' + id + ',#' + id + '_file, .select2, span, .selection').css({ top: '', left: '', width: '', position: '', height: '' })
$('#' + id + 'code,#' + id + 'button,#' + id + 'description').css({ top: '', left: '', width: '', position: '', height: '' })
}
}

$(".nuObjectWrapper").wrapAll('<div class="nuContainer"></div>');

$('div:empty').remove();
$(".nuContentBoxContainer").unwrap().hide();
$(".nuContentBoxTitle").remove();
//$("#sal_zzzzsys_form_id_open_button").unwrap();
$('.nuObjectWrapper').wrapAll('<div class="nuContainer"></div>')



}
});

}
$('div:empty').remove()
$('.nuContentBoxContainer').unwrap().hide()
$('.nuContentBoxTitle').remove()
// $("#sal_zzzzsys_form_id_open_button").unwrap();
}
})
}
}

0 comments on commit bf9fab2

Please sign in to comment.