Skip to content

Commit

Permalink
cleared old bs switch files (#3189)
Browse files Browse the repository at this point in the history
* cleared old bs switch files

* delete unnecessary code line
  • Loading branch information
jack-han-115 committed Jun 12, 2023
1 parent 561cfeb commit 7e67e74
Show file tree
Hide file tree
Showing 26 changed files with 39 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ var onClickListAction = function () {
* So, when refreshing the grid, the bootstrap-switch must be re-applyed to the elements
*
*/

// TODO: It seems below two functions are not used and can be deleted. Please confirm.
function prepareBsSwitchBoolean($gridid){
// Bootstrap switch with class "bootstrap-switch-boolean" will use the default boolean values.
// e.g: question mandatory, question other, etc
Expand All @@ -304,6 +304,8 @@ function prepareBsSwitchInteger($gridid){
});
});
}
// =================================================================================


function prepareBsDateTimePicker($gridid){
var dateTimeSettings = getDefaultDateTimePickerSettings();
Expand Down
30 changes: 16 additions & 14 deletions application/views/admin/dataentry/vvimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
</div>

<div class="mb-3" id="insertmethod-container">
<div class="mb-3 d-none" id="insertmethod-container">
<label for="insertmethod" class=" form-label">
<?php eT("When an imported record matches an existing record ID:"); ?>
</label>
Expand Down Expand Up @@ -159,17 +159,19 @@

</div></div></div>
<?php
App()->getClientScript()->registerScript('VVImportBSSwitcher', "
LS.renderBootstrapSwitch();
$('#noid').on('switchChange.bootstrapSwitch', function(event, state) {
if (!state){
$('#insertmethod').removeAttr('disabled');
$('#insertmethod-container').show('slow');
}else{
$('#insertmethod').attr('disabled','disabled');
$('#insertmethod-container').hide('slow');
}
$excludeRecordActive = <<<JAVASCRIPT
$('#noid_1').on('change', function (evt) {
$('#insertmethod-container').addClass('d-none');
$('#insertmethod').attr('disabled','disabled');
});
$('#noid_2').on('change', function (evt) {
$('#insertmethod-container').removeClass('d-none');
$('#insertmethod').removeAttr('disabled');
});
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
JAVASCRIPT;


App()->getClientScript()->registerScript('VVImportBS5Switcher', $excludeRecordActive, LSYii_ClientScript::POS_POSTSCRIPT);
?>
11 changes: 3 additions & 8 deletions application/views/admin/export/exportresults_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<?php $this->renderPartial('/admin/export/exportresult_panels/_general', ['selecthide' => $selecthide, 'selectshow' => $selectshow, 'selectinc' => $selectinc, 'aLanguages' => $aLanguages]); ?>

<?php if (empty(App()->getRequest()->getParam('responseIds'))) : ?>
<?php $this->renderPartial('/admin/export/exportresult_panels/_range', ['SingleResponse' => $SingleResponse, 'min_datasets' => $min_datasets, 'max_datasets' => $max_datasets]); ?>
<?php $this->renderPartial('/admin/export/exportresult_panels/_range', ['SingleResponse' => $SingleResponse, 'min_datasets' => $min_datasets, 'max_datasets' => $max_datasets]); ?>
<?php else : ?>
<?php $this->renderPartial('/admin/export/exportresult_panels/_single-value', ['SingleResponse' => $SingleResponse, 'surveyid' => $surveyid]); ?>
<?php endif; ?>
Expand All @@ -63,11 +63,6 @@
</div>
</div>
</div>
<input type='submit' class="btn btn-outline-secondary d-none" value='<?php eT("Export data");?>' id='exportresultsubmitbutton' />
<input type='submit' class="btn btn-outline-secondary d-none" value='<?php eT("Export data"); ?>' id='exportresultsubmitbutton' />
</form>
</div>
<?php
App()->getClientScript()->registerScript('ExportResultsBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
</div>
5 changes: 0 additions & 5 deletions application/views/admin/export/statistics_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,3 @@
</div>
</div>
</div>
<?php
App()->getClientScript()->registerScript('StatisticsViewBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('globalsettings');

App()->getClientScript()->registerScript('GlobalSettingsBSSwitcher', "LS.renderBootstrapSwitch();", LSYii_ClientScript::POS_POSTSCRIPT);

?>
<script type="text/javascript">
var msgCantRemoveDefaultLanguage = '<?php eT("You can't remove the default language.", 'js'); ?>';
Expand Down Expand Up @@ -95,4 +92,4 @@
<input type='hidden' name='action' value='globalsettingssave'/>
<input type='submit' class="d-none"/>
<?php echo CHtml::endForm() ?>
</div>
</div>
2 changes: 0 additions & 2 deletions application/views/admin/globalsettings/surveySettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
</div>

<script>
window.LS.unrenderBootstrapSwitch();
window.LS.renderBootstrapSwitch();

$('#surveySettings a').click(function (e) {
window.location.hash = $(this).attr('href');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
});
jQuery(function(){jQuery('#ParticipantAttributeName_attribute_type').trigger('change');});

LS.renderBootstrapSwitch();

</script>
</div>
<div class="modal-footer">
Expand All @@ -248,4 +248,4 @@
</div>
<?php
$this->endWidget();
?>
?>
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@
<?php echo $buttonTitle; ?>
</button>
</div>
<script>
$('#editPartcipantActiveForm .bootstrap-switch').bootstrapSwitch();
</script>

<?php
$this->endWidget();
?>
?>
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,4 @@
<?php
$aModalData = ['aAttributes' => $aAttributes];
App()->getController()->renderPartial('/admin/participants/modal_subviews/_exportCSV', $aModalData);

App()->getClientScript()->registerScript(
'ParticipantsPanelBSSwitcher',
"LS.renderBootstrapSwitch();",
LSYii_ClientScript::POS_POSTSCRIPT
);
?>

7 changes: 1 addition & 6 deletions application/views/admin/survey/queXMLSurvey_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,4 @@
</div>
</div>
</div>
</div>
<?php
App()->getClientScript()->registerScript('QueXMLExportBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
</div>
6 changes: 2 additions & 4 deletions application/views/admin/surveysgroups/surveySettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@
<?php
Yii::app()->getClientScript()->registerScript(
"editLocalSettings_submit",
"window.LS.unrenderBootstrapSwitch();
window.LS.renderBootstrapSwitch();
"
$('#surveySettings a').click(function (e) {
window.location.hash = $(this).attr('href');
e.preventDefault();
Expand Down Expand Up @@ -152,4 +150,4 @@
LSYii_ClientScript::POS_POSTSCRIPT
);
?>
</div>
</div>
9 changes: 1 addition & 8 deletions application/views/admin/token/csvupload.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,4 @@
?>
</div>
</div>
</div>
<?php
App()->getClientScript()->registerScript('CSVUploadViewBSSwitcher',
"
LS.renderBootstrapSwitch();
",
LSYii_ClientScript::POS_POSTSCRIPT);
?>
</div>
9 changes: 1 addition & 8 deletions application/views/admin/token/exportdialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,4 @@
</div>
</div>
</div>


</div>
<?php
App()->getClientScript()->registerScript('ExportDialogViewBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
</div>
3 changes: 1 addition & 2 deletions application/views/admin/token/invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@
<?php

App()->getClientScript()->registerScript("Tokens:BindInviteView", "
LS.renderBootstrapSwitch();
$('#send-invitation-button').on('click', function(){
$('#sendinvitation').submit();
})
", LSYii_ClientScript::POS_POSTSCRIPT );
?>
?>
7 changes: 1 addition & 6 deletions application/views/admin/token/managetokenattributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,4 @@
<?php } ?>
</div>
</div>
</div>
<?php
App()->getClientScript()->registerScript('ManageTokenAttributesViewBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
</div>
10 changes: 0 additions & 10 deletions application/views/admin/token/massive_actions/_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,6 @@


<?php App()->getClientScript()->registerScript("Tokens:MassActionUpdateView_Scripts", "
var bindBSSwitch = function(formGroup){
console.log(\"bindBSSwitch run on:\",formGroup);
//Script to update the completed settings
formGroup.find('.YesNoSwitch').on('switchChange.bootstrapSwitch', function(e, state){
formGroup.find('.selector_datechange').css('display', (state ? '' : 'none'));
});
};
var bindDatepicker = function(myFormGroup){
myFormGroup.find('.action_datepickerUpdateHiddenField').on('change dp.change', function(){
myFormGroup.find('.selector_submitField').val($(this).val());
Expand Down Expand Up @@ -422,7 +413,6 @@
myFormGroup.find('.selector_submitField').val('lskeep');
} else {
myFormGroup.find('.selector_submitField').val('');
bindBSSwitch(myFormGroup);
bindDatepicker(myFormGroup);
}
Expand Down
1 change: 0 additions & 1 deletion application/views/admin/token/remind.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@

<?php
App()->getClientScript()->registerScript("Tokens:BindReminderView", "
LS.renderBootstrapSwitch();
$('#send-reminders-button').on('click', function(){
$('#sendreminder').submit();
})
Expand Down
8 changes: 0 additions & 8 deletions application/views/admin/token/tokenform.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,6 @@ class='form-control<?= $attr_description['mandatory'] == 'Y' ? ' mandatory-attri
</div>
</div>
</div>
<?php
App()->getClientScript()->registerScript('TokenformViewBSSwitcher',
"
LS.renderBootstrapSwitch();
",
LSYii_ClientScript::POS_POSTSCRIPT
);
?>

<?php if ($token_subaction == "addnew"): ?>
<!-- Empty Token Confirmation Modal -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@

App()->getClientScript()->registerScript("editLocalSettings_submit_" . $entryData['name'],
"
window.LS.unrenderBootstrapSwitch();
window.LS.renderBootstrapSwitch();
$('#" . $entryData['name'] . "').off('.editLocalsettings');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2133,10 +2133,6 @@ table#responsedetail tr td {
margin-bottom: 30px;
}

#insertmethod-container {
display: none;
}


/* Some printing optimization */
@media print {
Expand Down
4 changes: 3 additions & 1 deletion assets/packages/adminbasics/src/parts/globalMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import LOG from '../components/lslog';

const globalWindowMethods = {
// TODO: It seems below two functions are not used and can be deleted. Please confirm.
renderBootstrapSwitch : () => {
try{
if(!$('[data-is-bootstrap-switch]').parent().hasClass('bootstrap-switch-container')) {
Expand All @@ -19,6 +20,7 @@ const globalWindowMethods = {
$('[data-is-bootstrap-switch]').bootstrapSwitch('destroy');
} catch(e) { LOG.error(e); }
},
// ==================================================================================
validatefilename: (form, strmessage) => {
if (form.the_file.value == "") {
$('#pleaseselectfile-popup').modal();
Expand Down Expand Up @@ -158,4 +160,4 @@ const globalStartUpMethods = {
};


export {globalStartUpMethods, globalWindowMethods};
export {globalStartUpMethods, globalWindowMethods};
7 changes: 0 additions & 7 deletions modules/admin/globalsettings/views/globalSettings_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('globalsettings');

App()->getClientScript()->registerScript('GlobalSettingsBSSwitcher',
"
LS.renderBootstrapSwitch();
",
LSYii_ClientScript::POS_POSTSCRIPT
);

?>
<script type="text/javascript">
var msgCantRemoveDefaultLanguage = '<?php eT("You can't remove the default language.", 'js'); ?>';
Expand Down
4 changes: 0 additions & 4 deletions themes/admin/Sea_Green/css/sea_green-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -13371,10 +13371,6 @@ table#responsedetail tr td {
margin-bottom: 30px;
}

#insertmethod-container {
display: none;
}

/* Some printing optimization */
@media print {
html, body {
Expand Down
2 changes: 1 addition & 1 deletion themes/admin/Sea_Green/css/sea_green-rtl.min.css

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions themes/admin/Sea_Green/css/sea_green.css
Original file line number Diff line number Diff line change
Expand Up @@ -13394,10 +13394,6 @@ table#responsedetail tr td {
margin-bottom: 30px;
}

#insertmethod-container {
display: none;
}

/* Some printing optimization */
@media print {
html, body {
Expand Down
2 changes: 1 addition & 1 deletion themes/admin/Sea_Green/css/sea_green.min.css

Large diffs are not rendered by default.

0 comments on commit 7e67e74

Please sign in to comment.