Skip to content

Commit

Permalink
Merge branch 'Langres-App:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
kiloutyg authored Mar 21, 2024
2 parents a7c5afa + 02bd2c0 commit 020a381
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 103 deletions.
27 changes: 5 additions & 22 deletions FRONT/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,20 @@ <h1 id="title" class="center fullcaps">Documents</h1>
<script>
// if path end with /, we remove it
if (window.location.pathname.endsWith('/')) window.location.pathname = window.location.pathname.slice(0, -1);

// get the path of the current page (without the domain name)
let path = window.location.pathname;

// replace the '/posign' because the website is in a folder called 'posign'
path = path.replace('/posign', '');
path = path.replace('/FRONT', '');

// split the path into an array of strings
const pathArray = path.split('/');
let relativePath = '';

// depending on the path, we set the relative path to the root of the website or to the 'posign' folder
if (path == '') relativePath = 'posign/';
else relativePath = './';

// for each element in the array, we add a '../' to the relative path to go to the root of the website
for (let i = 0; i < pathArray.length - 2; i++)
relativePath += '../';

const path = `/${window.location.pathname.split('/')[1]}/`;

// we add the main.js and Utils.js scripts to the head of the document
// they will load the other scripts, styles and the page content
let script = document.createElement('script');
script.src = relativePath + 'js/model/Utils.js';
const script = document.createElement('script');
script.src = path + 'js/model/Utils.js';
document.querySelector('head').appendChild(script);

// when the Utils.js script is loaded, we load the main.js script (which will load the other scripts and the page content through the Utils.js script)
script.onload = () => {
let script = document.createElement('script');
script.src = relativePath + 'js/main.js';
script.src = path + 'js/main.js';
document.querySelector('head').appendChild(script);
}

Expand Down
22 changes: 4 additions & 18 deletions FRONT/js/model/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,11 @@ class Utils {
* @returns {string} The relative path to the root of the website
*/
static getRelativePathToRoot() {
// if path end with /, we remove it
if (window.location.pathname.endsWith('/')) window.location.pathname = window.location.pathname.slice(0, -1);

// get the path of the current page (without the domain name)
let path = window.location.pathname;

// replace the '/posign' because the website is in a folder called 'posign'
path = path.replace('/posign', '');
path = path.replace('/front', '');

// split the path into an array of strings
const pathArray = path.split('/');
let relativePath = '';

if (path == '') relativePath = 'posign/';
else relativePath = './';

// for each element in the array, we add a '../' to the relative path to go to the root of the website
for (let i = 0; i < pathArray.length - 2; i++) {
relativePath += '../';
}
return relativePath;
return `/${window.location.pathname.split('/')[1]}/`;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions FRONT/js/view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ class IndexView extends View {
}
}

// order by the biggest size of docs_waiting
users.sort((a, b) => b.docs_waiting.length - a.docs_waiting.length);

// add the users to the container
await this.userTemplateManager.addUsers(users);
}
Expand Down
25 changes: 4 additions & 21 deletions FRONT/visual/pages/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,35 +66,18 @@ <h2 class="smallcaps">Connexion</h2>
if (window.location.pathname.endsWith('/')) window.location.pathname = window.location.pathname.slice(0, -1);

// get the path of the current page (without the domain name)
let path = window.location.pathname;

// replace the '/posign' because the website is in a folder called 'posign'
path = path.replace('/posign', '');
path = path.replace('/FRONT', '');

// split the path into an array of strings
const pathArray = path.split('/');
let relativePath = '';

// depending on the path, we set the relative path to the root of the website or to the 'posign' folder
if (path == '') relativePath = 'posign/';
else relativePath = './';

// for each element in the array, we add a '../' to the relative path to go to the root of the website
for (let i = 0; i < pathArray.length - 2; i++)
relativePath += '../';

const path = `/${window.location.pathname.split('/')[1]}/`;

// we add the main.js and Utils.js scripts to the head of the document
// they will load the other scripts, styles and the page content
let script = document.createElement('script');
script.src = relativePath + 'js/model/Utils.js';
const script = document.createElement('script');
script.src = path + 'js/model/Utils.js';
document.querySelector('head').appendChild(script);

// when the Utils.js script is loaded, we load the main.js script (which will load the other scripts and the page content through the Utils.js script)
script.onload = () => {
let script = document.createElement('script');
script.src = relativePath + 'js/main.js';
script.src = path + 'js/main.js';
document.querySelector('head').appendChild(script);
}

Expand Down
25 changes: 4 additions & 21 deletions FRONT/visual/pages/signedList.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,18 @@ <h3 id="no-signing" class="disabled">Aucune personne n'a signé ce document pour
if (window.location.pathname.endsWith('/')) window.location.pathname = window.location.pathname.slice(0, -1);

// get the path of the current page (without the domain name)
let path = window.location.pathname;

// replace the '/posign' because the website is in a folder called 'posign'
path = path.replace('/posign', '');
path = path.replace('/FRONT', '');

// split the path into an array of strings
const pathArray = path.split('/');
let relativePath = '';

// depending on the path, we set the relative path to the root of the website or to the 'posign' folder
if (path == '') relativePath = 'posign/';
else relativePath = './';

// for each element in the array, we add a '../' to the relative path to go to the root of the website
for (let i = 0; i < pathArray.length - 2; i++)
relativePath += '../';

const path = `/${window.location.pathname.split('/')[1]}/`;

// we add the main.js and Utils.js scripts to the head of the document
// they will load the other scripts, styles and the page content
let script = document.createElement('script');
script.src = relativePath + 'js/model/Utils.js';
const script = document.createElement('script');
script.src = path + 'js/model/Utils.js';
document.querySelector('head').appendChild(script);

// when the Utils.js script is loaded, we load the main.js script (which will load the other scripts and the page content through the Utils.js script)
script.onload = () => {
let script = document.createElement('script');
script.src = relativePath + 'js/main.js';
script.src = path + 'js/main.js';
document.querySelector('head').appendChild(script);
}

Expand Down
25 changes: 4 additions & 21 deletions FRONT/visual/pages/signing.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,18 @@ <h2 id="doc-title" class="smallcaps">[NOM DOC]</h2>
if (window.location.pathname.endsWith('/')) window.location.pathname = window.location.pathname.slice(0, -1);

// get the path of the current page (without the domain name)
let path = window.location.pathname;

// replace the '/posign' because the website is in a folder called 'posign'
path = path.replace('/posign', '');
path = path.replace('/FRONT', '');

// split the path into an array of strings
const pathArray = path.split('/');
let relativePath = '';

// depending on the path, we set the relative path to the root of the website or to the 'posign' folder
if (path == '') relativePath = 'posign/';
else relativePath = './';

// for each element in the array, we add a '../' to the relative path to go to the root of the website
for (let i = 0; i < pathArray.length - 2; i++)
relativePath += '../';

const path = `/${window.location.pathname.split('/')[1]}/`;

// we add the main.js and Utils.js scripts to the head of the document
// they will load the other scripts, styles and the page content
let script = document.createElement('script');
script.src = relativePath + 'js/model/Utils.js';
const script = document.createElement('script');
script.src = path + 'js/model/Utils.js';
document.querySelector('head').appendChild(script);

// when the Utils.js script is loaded, we load the main.js script (which will load the other scripts and the page content through the Utils.js script)
script.onload = () => {
let script = document.createElement('script');
script.src = relativePath + 'js/main.js';
script.src = path + 'js/main.js';
document.querySelector('head').appendChild(script);
}

Expand Down

0 comments on commit 020a381

Please sign in to comment.