Skip to content

Commit

Permalink
Fixed issue #CR-1181: Bootstrap is loaded twice in ls6_surveytheme
Browse files Browse the repository at this point in the history
  • Loading branch information
ptelu committed Jun 26, 2023
1 parent 9103105 commit 34cc9c9
Show file tree
Hide file tree
Showing 14 changed files with 11,494 additions and 5,537 deletions.
10,286 changes: 4,915 additions & 5,371 deletions assets/bootstrap_5/build/js/bootstrap_5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/bootstrap_5/build/js/bootstrap_5.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions assets/bootstrap_5/js/bootstrap_5.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
import * as Bootstrap from '../../../node_modules/bootstrap/dist/js/bootstrap.esm.js';

// register to global scope
window.bootstrap = Bootstrap;
30 changes: 0 additions & 30 deletions assets/survey_themes/ls6_surveytheme/core/ls6_core_theme.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
/*
LimeSurvey
Copyright (C) 2007-2023
The LimeSurvey Project Team / Patrick Teichmann
All rights reserved.
License: GNU/GPL License v3 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
(¯`·._.·(¯`·._.· Theme main JavaScript ·._.·´¯)·._.·´¯)
Javascript file for this template.
You'd rather not touch it. This file can be overwritten by an update.
██████╗ ██████╗ ███╗ ██╗ ██████╗ ████████╗ ████████╗ ██████╗ ██╗ ██╗ ██████╗██╗ ██╗ ██╗
██╔══██╗██╔═══██╗ ████╗ ██║██╔═══██╗╚══██╔══╝ ╚══██╔══╝██╔═══██╗██║ ██║██╔════╝██║ ██║ ██║
██║ ██║██║ ██║ ██╔██╗ ██║██║ ██║ ██║ ██║ ██║ ██║██║ ██║██║ ███████║ ██║
██║ ██║██║ ██║ ██║╚██╗██║██║ ██║ ██║ ██║ ██║ ██║██║ ██║██║ ██╔══██║ ╚═╝
██████╔╝╚██████╔╝ ██║ ╚████║╚██████╔╝ ██║ ██║ ╚██████╔╝╚██████╔╝╚██████╗██║ ██║ ██╗
╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═╝
Please, use custom.js
*/

import TemplateCoreClass from './template_core_class.js';

/**
Expand Down
29 changes: 29 additions & 0 deletions assets/survey_themes/ls6_surveytheme/ls6_javascript_disclaimer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
LimeSurvey
Copyright (C) 2007-2023
The LimeSurvey Project Team / Patrick Teichmann
All rights reserved.
License: GNU/GPL License v3 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
(¯`·._.·(¯`·._.· Theme main JavaScript ·._.·´¯)·._.·´¯)
Javascript file for this template.
You'd rather not touch it. This file can be overwritten by an update.
██████╗ ██████╗ ███╗ ██╗ ██████╗ ████████╗ ████████╗ ██████╗ ██╗ ██╗ ██████╗██╗ ██╗ ██╗
██╔══██╗██╔═══██╗ ████╗ ██║██╔═══██╗╚══██╔══╝ ╚══██╔══╝██╔═══██╗██║ ██║██╔════╝██║ ██║ ██║
██║ ██║██║ ██║ ██╔██╗ ██║██║ ██║ ██║ ██║ ██║ ██║██║ ██║██║ ███████║ ██║
██║ ██║██║ ██║ ██║╚██╗██║██║ ██║ ██║ ██║ ██║ ██║██║ ██║██║ ██╔══██║ ╚═╝
██████╔╝╚██████╔╝ ██║ ╚████║╚██████╔╝ ██║ ██║ ╚██████╔╝╚██████╔╝╚██████╗██║ ██║ ██╗
╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═╝
Please, use custom.js
*/
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* This file loads all javascript modules (ES6/ES2015) defined in ls6_surveytheme
*/

import * as Disclaimer from './ls6_javascript_disclaimer.js';
import * as Bootstrap from '../../../assets/bootstrap_5/js/bootstrap_5.js';
import ThemeScripts from './core/ls6_core_theme.js';
import ArrayScripts from './questiontypes/array/array.js';
import NavbarScripts from './navbar/navbar.js';
29 changes: 26 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,31 @@ const babelify = require('babelify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const browserify = require('browserify');
const header = require('gulp-header');
const fs = require('fs');

function js_minify() {
return src(['node_modules/bootstrap/dist/js/bootstrap.bundle.js', 'assets/bootstrap_5/js/bootstrap_5.js'])
.pipe(concat('bootstrap_5.js'))
// browserify package handler
return browserify({
entries: ['assets/bootstrap_5/js/bootstrap_5.js']
})
// transform babelify ES6 to ES5 [@babel/preset-env]
.transform(babelify, {
presets: ['@babel/preset-env'],
retainLines: false,
compact: false,
global: true

})
// bundle the transformed code
.bundle()
// sourcemap
.pipe(source('assets/bootstrap_5/js/bootstrap_5.js'))
// rename
.pipe(rename('bootstrap_5.js'))
// buffer
.pipe(buffer())
// distination
.pipe(dest('assets/bootstrap_5/build/js/'))
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
Expand Down Expand Up @@ -185,8 +206,9 @@ function survey_theme_ls6_js() {
// transform babelify ES6 to ES5 [@babel/preset-env]
.transform(babelify, {
presets: ['@babel/preset-env'],
retainLines: true,
retainLines: false,
compact: false,
global: true
})
// bundle the transformed code
.bundle()
Expand All @@ -197,6 +219,7 @@ function survey_theme_ls6_js() {
// buffer
.pipe(buffer())
// distination
.pipe(header(fs.readFileSync('assets/survey_themes/ls6_surveytheme/ls6_javascript_disclaimer.js')))
.pipe(dest('themes/survey/ls6_surveytheme/scripts/'));
}

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"cssnano": "^5.0.17",
"fs": "^0.0.1-security",
"gulp": "^4.0.2",
"gulp-cli": "^2.3.0",
"gulp-concat": "^2.6.1",
"gulp-header": "^2.0.9",
"gulp-if": "^3.0.0",
"gulp-postcss": "^9.0.1",
"gulp-rename": "^2.0.0",
Expand Down
8 changes: 4 additions & 4 deletions themes/survey/ls6_surveytheme/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@
<optionspage>core</optionspage>

<!-- If empty, bootstrap css/js files will not be loaded. In the future, we may have more engines, like foundation -->
<!-- PLease do not load bootstrap twice...Not necessary here-->
<cssframework>
<name>bootstrap</name>
</cssframework>
<!-- Please do not load bootstrap twice...Not necessary here. Bootstrap is already loaded together with the theme css and theme js-->
<!-- <cssframework>-->
<!-- <name>bootstrap</name>-->
<!-- </cssframework>-->

<!-- Path of the views files (can be different than views -->
<viewdirectory>views</viewdirectory>
Expand Down
Empty file modified themes/survey/ls6_surveytheme/css/variations/theme_apple.css
100755 → 100644
Empty file.
Empty file.
Empty file modified themes/survey/ls6_surveytheme/css/variations/theme_grape.css
100755 → 100644
Empty file.
Empty file modified themes/survey/ls6_surveytheme/css/variations/theme_mango.css
100755 → 100644
Empty file.

0 comments on commit 34cc9c9

Please sign in to comment.