mirror of
https://github.com/dkmstr/openuds-gui.git
synced 2025-01-03 05:17:36 +03:00
updated
This commit is contained in:
parent
fc2229259d
commit
aeaf7be1c9
@ -9,7 +9,7 @@
|
|||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"assets": [
|
"assets": [
|
||||||
"img",
|
"img",
|
||||||
"jsi18n",
|
"server",
|
||||||
"favicon.ico"
|
"favicon.ico"
|
||||||
],
|
],
|
||||||
"index": "index.html",
|
"index": "index.html",
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve --host 172.27.0.1 --port 9000 --proxy-config proxy.conf.json",
|
"start": "ng serve --host 172.27.0.1 --port 9000 --proxy-config proxy.conf.json",
|
||||||
"build": "ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /static/modern",
|
"build": "ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /static/modern",
|
||||||
"postbuild": "python3 builder.py",
|
"postbuild": "python3 toUDS.py",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e"
|
"e2e": "ng e2e"
|
||||||
|
@ -6,3 +6,9 @@ a.dropdown-toggle {
|
|||||||
width: 2em;
|
width: 2em;
|
||||||
margin-top: -8px;
|
margin-top: -8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fix dropdown menu */
|
||||||
|
.dropdown-menu-right {
|
||||||
|
right: 0 !important;
|
||||||
|
left: auto !important;
|
||||||
|
}
|
@ -14,12 +14,12 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#"><uds-translate>About</uds-translate></a>
|
<a class="nav-link" href="#"><uds-translate>About</uds-translate></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown" ngbDropdown>
|
<li class="nav-item dropdown dropdown-menu-right" ngbDropdown>
|
||||||
<a class="nav-link dropdown-toggle" id="dropdown01" ngbDropdownToggle>{{ lang }}</a>
|
<a class="nav-link dropdown-toggle" id="dropdown01" ngbDropdownToggle>{{ lang }}</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown01" ngbDropdownMenu>
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown01" ngbDropdownMenu>
|
||||||
<a class="dropdown-item" href="#" *ngFor="let l of langs">{{ l.name }}</a>
|
<a class="dropdown-item" href="#" *ngFor="let l of langs">{{ l.name }}</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
@ -1,5 +1,6 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Uds</title>
|
<title>Uds</title>
|
||||||
@ -9,15 +10,14 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
|
||||||
<!-- DYNAMIC_DATA -->
|
<!-- DYNAMIC_DATA -->
|
||||||
<script type="text/javascript" src="jsi18n/es.js"></script>
|
<script type="text/javascript" src="server/es.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript" src="server/uds.js"></script>
|
||||||
var udsConfig = {
|
|
||||||
"language": "en", "available_languages": [{"name": "Spanish", "id": "es"}, {"name": "English", "id": "en"}, {"name": "French", "id": "fr"}, {"name": "German", "id": "de"}, {"name": "Portuguese", "id": "pt"}, {"name": "Italian", "id": "it"}, {"name": "Basque", "id": "eu"}, {"name": "Arabian", "id": "ar"}, {"name": "Catalan", "id": "ca"}]};
|
|
||||||
</script>
|
|
||||||
<!-- ENDDYNAMIC_DATA -->
|
<!-- ENDDYNAMIC_DATA -->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<uds-root></uds-root>
|
<uds-root></uds-root>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
31
src/server/uds.js
Normal file
31
src/server/uds.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
var udsConfig = {
|
||||||
|
"language": "en",
|
||||||
|
"available_languages": [{
|
||||||
|
"name": "Spanish",
|
||||||
|
"id": "es"
|
||||||
|
}, {
|
||||||
|
"name": "English",
|
||||||
|
"id": "en"
|
||||||
|
}, {
|
||||||
|
"name": "French",
|
||||||
|
"id": "fr"
|
||||||
|
}, {
|
||||||
|
"name": "German",
|
||||||
|
"id": "de"
|
||||||
|
}, {
|
||||||
|
"name": "Portuguese",
|
||||||
|
"id": "pt"
|
||||||
|
}, {
|
||||||
|
"name": "Italian",
|
||||||
|
"id": "it"
|
||||||
|
}, {
|
||||||
|
"name": "Basque",
|
||||||
|
"id": "eu"
|
||||||
|
}, {
|
||||||
|
"name": "Arabian",
|
||||||
|
"id": "ar"
|
||||||
|
}, {
|
||||||
|
"name": "Catalan",
|
||||||
|
"id": "ca"
|
||||||
|
}]
|
||||||
|
};
|
@ -65,8 +65,8 @@ def locateHtmlFiles():
|
|||||||
|
|
||||||
def fixIndex():
|
def fixIndex():
|
||||||
print('Fixing index.html...')
|
print('Fixing index.html...')
|
||||||
translations = '<script src="{% url \'uds.web.views.jsCatalog\' LANGUAGE_CODE %}"></script>'
|
translations = '<script type="text/javascript" src="{% url \'uds.web.views.jsCatalog\' LANGUAGE_CODE %}"></script>'
|
||||||
jsdata = '{% jsdata %}'
|
jsdata = '<script type="text/javascript" src="{% url \'modern.js\' %}"></script>'
|
||||||
# Change index.html, to include django required staff
|
# Change index.html, to include django required staff
|
||||||
translatePattern = re.compile(
|
translatePattern = re.compile(
|
||||||
'<!-- DYNAMIC_DATA -->.*<!-- ENDDYNAMIC_DATA -->', re.MULTILINE | re.DOTALL)
|
'<!-- DYNAMIC_DATA -->.*<!-- ENDDYNAMIC_DATA -->', re.MULTILINE | re.DOTALL)
|
||||||
@ -74,6 +74,8 @@ def fixIndex():
|
|||||||
html = f.read()
|
html = f.read()
|
||||||
# include django headers
|
# include django headers
|
||||||
html = '{% load uds i18n %}{% get_current_language as LANGUAGE_CODE %}' + html
|
html = '{% load uds i18n %}{% get_current_language as LANGUAGE_CODE %}' + html
|
||||||
|
# Change <html lang="en"> with {{ LANGUAGE_CODE }}
|
||||||
|
html = re.sub('<html lang="en">', '<html lang="{{ LANGUAGE_CODE }}">', html)
|
||||||
with open(os.path.join(os.path.join(UDS, TEMPLATE), 'index.html'), 'w', encoding='utf8') as f:
|
with open(os.path.join(os.path.join(UDS, TEMPLATE), 'index.html'), 'w', encoding='utf8') as f:
|
||||||
f.write(translatePattern.sub(translations + jsdata, html))
|
f.write(translatePattern.sub(translations + jsdata, html))
|
||||||
|
|
||||||
@ -102,16 +104,15 @@ def organize():
|
|||||||
continue # Also skip html
|
continue # Also skip html
|
||||||
shutil.copy(f, os.path.join(UDS, STATIC))
|
shutil.copy(f, os.path.join(UDS, STATIC))
|
||||||
|
|
||||||
|
|
||||||
def cleanUp():
|
def cleanUp():
|
||||||
print('Cleaning up unneeded content')
|
print('Cleaning unneeded content')
|
||||||
folder = os.path.join(UDS, STATIC)
|
folder = os.path.join(UDS, STATIC)
|
||||||
os.unlink(os.path.join(folder, 'favicon.ico'))
|
os.unlink(os.path.join(folder, 'favicon.ico'))
|
||||||
|
|
||||||
|
|
||||||
def createDirs():
|
def createDirs():
|
||||||
try:
|
try:
|
||||||
print('Crating output uds dir...')
|
print('Creating output uds dir...')
|
||||||
os.mkdir(UDS)
|
os.mkdir(UDS)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('Already exists, cleaning content')
|
print('Already exists, cleaning content')
|
Loading…
Reference in New Issue
Block a user