-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#266 [Session] add: JS action on fk_soc and fk_project
- Loading branch information
1 parent
7c1dad7
commit 227412b
Showing
8 changed files
with
278 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const gulp = require('gulp'); | ||
const sass = require('gulp-sass')(require('sass')); | ||
const rename = require('gulp-rename'); | ||
const uglify = require('gulp-uglify'); | ||
const concat = require('gulp-concat'); | ||
|
||
const paths = { | ||
js_backend : ['js/dolimeet.js', 'js/modules/*.js'] | ||
}; | ||
|
||
gulp.task('js_backend', function() { | ||
return gulp.src(paths.js_backend) | ||
.pipe(concat('dolimeet.min.js')) | ||
.pipe(uglify()) | ||
.pipe(gulp.dest('./js/')); | ||
}); | ||
|
||
/** Watch */ | ||
gulp.task('default', function() { | ||
gulp.watch(paths.js_backend[1], gulp.series('js_backend')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* Copyright (C) 2021-2023 EVARISK <technique@evarisk.com> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* Library javascript to enable Browser notifications | ||
*/ | ||
|
||
/** | ||
* \file js/dolimeet.js | ||
* \ingroup dolimeet | ||
* \brief JavaScript file for module DoliMeet | ||
*/ | ||
|
||
'use strict'; | ||
|
||
if (!window.dolimeet) { | ||
/** | ||
* Init DoliMeet JS | ||
* | ||
* @memberof DoliMeet_Init | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @type {Object} | ||
*/ | ||
window.dolimeet = {}; | ||
|
||
/** | ||
* Init scriptsLoaded DoliMeet | ||
* | ||
* @memberof DoliMeet_Init | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @type {Boolean} | ||
*/ | ||
window.dolimeet.scriptsLoaded = false; | ||
} | ||
|
||
if (!window.dolimeet.scriptsLoaded) { | ||
/** | ||
* DoliMeet init | ||
* | ||
* @memberof DoliMeet_Init | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @returns {void} | ||
*/ | ||
window.dolimeet.init = function() { | ||
window.dolimeet.load_list_script(); | ||
}; | ||
|
||
/** | ||
* Load all modules' init | ||
* | ||
* @memberof DoliMeet_Init | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @returns {void} | ||
*/ | ||
window.dolimeet.load_list_script = function() { | ||
if (!window.dolimeet.scriptsLoaded) { | ||
let key = undefined, slug = undefined; | ||
for (key in window.dolimeet) { | ||
if (window.dolimeet[key].init) { | ||
window.dolimeet[key].init(); | ||
} | ||
for (slug in window.dolimeet[key]) { | ||
if (window.dolimeet[key] && window.dolimeet[key][slug] && window.dolimeet[key][slug].init) { | ||
window.dolimeet[key][slug].init(); | ||
} | ||
} | ||
} | ||
window.dolimeet.scriptsLoaded = true; | ||
} | ||
}; | ||
|
||
/** | ||
* Refresh and reload all modules' init | ||
* | ||
* @memberof DoliMeet_Init | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @returns {void} | ||
*/ | ||
window.dolimeet.refresh = function() { | ||
let key = undefined; | ||
let slug = undefined; | ||
for (key in window.dolimeet) { | ||
if (window.dolimeet[key].refresh) { | ||
window.dolimeet[key].refresh(); | ||
} | ||
for (slug in window.dolimeet[key]) { | ||
if (window.dolimeet[key] && window.dolimeet[key][slug] && window.dolimeet[key][slug].refresh) { | ||
window.dolimeet[key][slug].refresh(); | ||
} | ||
} | ||
} | ||
}; | ||
$(document).ready(window.dolimeet.init); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
//Silence is golden apple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
// Silence is golden |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* Copyright (C) 2021-2023 EVARISK <technique@evarisk.com> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* Library javascript to enable Browser notifications | ||
*/ | ||
|
||
/** | ||
* \file js/session.js | ||
* \ingroup dolimeet | ||
* \brief JavaScript session file for module DoliMeet | ||
*/ | ||
|
||
/** | ||
* Init session JS | ||
* | ||
* @memberof DoliMeet_Session | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @type {Object} | ||
*/ | ||
window.dolimeet.session = {}; | ||
|
||
/** | ||
* Session init | ||
* | ||
* @memberof DoliMeet_Session | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @returns {void} | ||
*/ | ||
window.dolimeet.session.init = function() { | ||
window.dolimeet.session.event(); | ||
}; | ||
|
||
/** | ||
* Session event | ||
* | ||
* @memberof DoliMeet_Session | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @returns {void} | ||
*/ | ||
window.dolimeet.session.event = function() { | ||
$(document).on('change', '#fk_soc', window.dolimeet.session.reloadField); | ||
}; | ||
|
||
/** | ||
* Session reload field | ||
* | ||
* @memberof DoliMeet_Session | ||
* | ||
* @since 1.2.0 | ||
* @version 1.2.0 | ||
* | ||
* @returns {void} | ||
*/ | ||
window.dolimeet.session.reloadField = function() { | ||
let form = document.getElementById('session_form'); | ||
let formData = new FormData(form); | ||
|
||
let token = window.saturne.toolbox.getToken(); | ||
let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL); | ||
|
||
let field = formData.get('fk_soc'); | ||
|
||
$.ajax({ | ||
url: document.URL + querySeparator + "fk_soc=" + field + "&token=" + token, | ||
type: "POST", | ||
processData: false, | ||
contentType: false, | ||
success: function(resp) { | ||
$('.field_fk_project').replaceWith($(resp).find('.field_fk_project')); | ||
}, | ||
error: function() {} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"main": "index.js", | ||
"scripts": { | ||
"update": "npm install", | ||
"start": "node node_modules/gulp/bin/gulp.js" | ||
}, | ||
"author": "Evarisk", | ||
"contributors": [ | ||
{ | ||
"name": "Evarisk", | ||
"email": "technique@evarisk.com" | ||
} | ||
], | ||
"license": "GPLv3", | ||
"devDependencies": { | ||
"gulp": "^4.0.0", | ||
"gulp-autoprefixer": "^6.0.0", | ||
"gulp-concat": "latest", | ||
"gulp-line-ending-corrector": "^1.0.3", | ||
"gulp-rename": "latest", | ||
"gulp-sass": "latest", | ||
"sass": "latest", | ||
"gulp-uglify": "latest", | ||
"gulp-watch": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters