mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-14 01:50:40 +00:00
Merge branch 'template-rework' into development
This commit is contained in:
@ -1 +0,0 @@
|
||||
@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(../fonts/material_design_icons/MaterialIcons-Regular.eot);src:local('Material Icons'),local('MaterialIcons-Regular'),url(../fonts/material_design_icons/MaterialIcons-Regular.ttf) format('truetype'),url(../fonts/material_design_icons/MaterialIconsOutlined-Regular.otf) format('opentype'),url(../fonts/material_design_icons/MaterialIconsRound-Regular.otf) format('opentype'),url(../fonts/material_design_icons/MaterialIconsSharp-Regular.otf) format('opentype'),url(../fonts/material_design_icons/MaterialIconsTwoTone-Regular.otf) format('opentype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:'liga'}
|
12
web/app/static/css/materialize.sidenav-fixed.css
Normal file
12
web/app/static/css/materialize.sidenav-fixed.css
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* The sidenav-fixed class is used which causes the sidenav to be fixed and open
|
||||
* on large screens and hides to the regular functionality on smaller screens.
|
||||
* In order to prevent the sidenav to overlap the content, the content (in our
|
||||
* case header, main and footer) gets an offset equal to the width of the
|
||||
* sidenav.
|
||||
*/
|
||||
@media only screen and (min-width : 993px) {
|
||||
header, main, footer {padding-left: 300px;}
|
||||
.modal:not(.bottom-sheet) {left: 300px;}
|
||||
.navbar-fixed > nav {width: calc(100% - 300px)}
|
||||
}
|
13
web/app/static/css/materialize.sticky-footer.css
Normal file
13
web/app/static/css/materialize.sticky-footer.css
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Force the footer to always stay on the bottom of the page regardless of how
|
||||
* little content is on the page.
|
||||
*/
|
||||
body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
}
|
@ -1,19 +1,7 @@
|
||||
/*
|
||||
* ### Start sticky footer ###
|
||||
* Force the footer to always stay on the bottom of the page regardless of how
|
||||
* little content is on the page.
|
||||
*/
|
||||
body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
flex-direction: column;
|
||||
.tab .material-icons {
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
/* ### End sticky footer ### */
|
||||
|
||||
/* add custom bold class */
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
|
@ -4,12 +4,8 @@
|
||||
*/
|
||||
var nopaque = {};
|
||||
|
||||
// nopaque ressources
|
||||
nopaque.socket = undefined;
|
||||
|
||||
// User data
|
||||
nopaque.user = {};
|
||||
nopaque.user.isAuthenticated = undefined;
|
||||
nopaque.user.settings = {};
|
||||
nopaque.user.settings.darkMode = undefined;
|
||||
nopaque.corporaSubscribers = [];
|
||||
@ -25,81 +21,76 @@ nopaque.foreignCorporaSubscribers = [];
|
||||
nopaque.foreignJobsSubscribers = [];
|
||||
nopaque.foreignQueryResultsSubscribers = [];
|
||||
|
||||
nopaque.flashedMessages = undefined;
|
||||
|
||||
// nopaque functions
|
||||
nopaque.socket = {};
|
||||
nopaque.socket.init = function() {
|
||||
nopaque.socket = io({transports: ['websocket']});
|
||||
// Add event handlers
|
||||
nopaque.socket.on("user_data_stream_init", function(msg) {
|
||||
nopaque.user = JSON.parse(msg);
|
||||
for (let subscriber of nopaque.corporaSubscribers) {
|
||||
subscriber._init(nopaque.user.corpora);
|
||||
}
|
||||
for (let subscriber of nopaque.jobsSubscribers) {
|
||||
subscriber._init(nopaque.user.jobs);
|
||||
}
|
||||
for (let subscriber of nopaque.queryResultsSubscribers) {
|
||||
subscriber._init(nopaque.user.query_results);
|
||||
}
|
||||
});
|
||||
nopaque.socket = io({transports: ['websocket']});
|
||||
// Add event handlers
|
||||
nopaque.socket.on("user_data_stream_init", function(msg) {
|
||||
nopaque.user = JSON.parse(msg);
|
||||
for (let subscriber of nopaque.corporaSubscribers) {
|
||||
subscriber._init(nopaque.user.corpora);
|
||||
}
|
||||
for (let subscriber of nopaque.jobsSubscribers) {
|
||||
subscriber._init(nopaque.user.jobs);
|
||||
}
|
||||
for (let subscriber of nopaque.queryResultsSubscribers) {
|
||||
subscriber._init(nopaque.user.query_results);
|
||||
}
|
||||
});
|
||||
|
||||
nopaque.socket.on("user_data_stream_update", function(msg) {
|
||||
var patch;
|
||||
nopaque.socket.on("user_data_stream_update", function(msg) {
|
||||
var patch;
|
||||
|
||||
patch = JSON.parse(msg);
|
||||
nopaque.user = jsonpatch.apply_patch(nopaque.user, patch);
|
||||
corpora_patch = patch.filter(operation => operation.path.startsWith("/corpora"));
|
||||
jobs_patch = patch.filter(operation => operation.path.startsWith("/jobs"));
|
||||
query_results_patch = patch.filter(operation => operation.path.startsWith("/query_results"));
|
||||
for (let subscriber of nopaque.corporaSubscribers) {
|
||||
subscriber._update(corpora_patch);
|
||||
}
|
||||
for (let subscriber of nopaque.jobsSubscribers) {
|
||||
subscriber._update(jobs_patch);
|
||||
}
|
||||
for (let subscriber of nopaque.queryResultsSubscribers) {
|
||||
subscriber._update(query_results_patch);
|
||||
}
|
||||
if (["all", "end"].includes(nopaque.user.settings.job_status_site_notifications)) {
|
||||
for (operation of jobs_patch) {
|
||||
/* "/jobs/{jobId}/..." -> ["{jobId}", ...] */
|
||||
pathArray = operation.path.split("/").slice(2);
|
||||
if (operation.op === "replace" && pathArray[1] === "status") {
|
||||
if (nopaque.user.settings.job_status_site_notifications === "end" && !["complete", "failed"].includes(operation.value)) {continue;}
|
||||
nopaque.flash(`[<a href="/jobs/${pathArray[0]}">${nopaque.user.jobs[pathArray[0]].title}</a>] New status: ${operation.value}`, "job");
|
||||
}
|
||||
patch = JSON.parse(msg);
|
||||
nopaque.user = jsonpatch.apply_patch(nopaque.user, patch);
|
||||
corpora_patch = patch.filter(operation => operation.path.startsWith("/corpora"));
|
||||
jobs_patch = patch.filter(operation => operation.path.startsWith("/jobs"));
|
||||
query_results_patch = patch.filter(operation => operation.path.startsWith("/query_results"));
|
||||
for (let subscriber of nopaque.corporaSubscribers) {
|
||||
subscriber._update(corpora_patch);
|
||||
}
|
||||
for (let subscriber of nopaque.jobsSubscribers) {
|
||||
subscriber._update(jobs_patch);
|
||||
}
|
||||
for (let subscriber of nopaque.queryResultsSubscribers) {
|
||||
subscriber._update(query_results_patch);
|
||||
}
|
||||
if (["all", "end"].includes(nopaque.user.settings.job_status_site_notifications)) {
|
||||
for (operation of jobs_patch) {
|
||||
/* "/jobs/{jobId}/..." -> ["{jobId}", ...] */
|
||||
pathArray = operation.path.split("/").slice(2);
|
||||
if (operation.op === "replace" && pathArray[1] === "status") {
|
||||
if (nopaque.user.settings.job_status_site_notifications === "end" && !["complete", "failed"].includes(operation.value)) {continue;}
|
||||
nopaque.flash(`[<a href="/jobs/${pathArray[0]}">${nopaque.user.jobs[pathArray[0]].title}</a>] New status: ${operation.value}`, "job");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
nopaque.socket.on("foreign_user_data_stream_init", function(msg) {
|
||||
nopaque.foreignUser = JSON.parse(msg);
|
||||
for (let subscriber of nopaque.foreignCorporaSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.corpora);
|
||||
}
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.jobs);
|
||||
}
|
||||
for (let subscriber of nopaque.foreignQueryResultsSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.query_results);
|
||||
}
|
||||
});
|
||||
nopaque.socket.on("foreign_user_data_stream_init", function(msg) {
|
||||
nopaque.foreignUser = JSON.parse(msg);
|
||||
for (let subscriber of nopaque.foreignCorporaSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.corpora);
|
||||
}
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.jobs);
|
||||
}
|
||||
for (let subscriber of nopaque.foreignQueryResultsSubscribers) {
|
||||
subscriber._init(nopaque.foreignUser.query_results);
|
||||
}
|
||||
});
|
||||
|
||||
nopaque.socket.on("foreign_user_data_stream_update", function(msg) {
|
||||
var patch;
|
||||
nopaque.socket.on("foreign_user_data_stream_update", function(msg) {
|
||||
var patch;
|
||||
|
||||
patch = JSON.parse(msg);
|
||||
nopaque.foreignUser = jsonpatch.apply_patch(nopaque.foreignUser, patch);
|
||||
corpora_patch = patch.filter(operation => operation.path.startsWith("/corpora"));
|
||||
jobs_patch = patch.filter(operation => operation.path.startsWith("/jobs"));
|
||||
query_results_patch = patch.filter(operation => operation.path.startsWith("/query_results"));
|
||||
for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._update(corpora_patch);}
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._update(jobs_patch);}
|
||||
for (let subscriber of nopaque.foreignQueryResultsSubscribers) {subscriber._update(query_results_patch);}
|
||||
});
|
||||
}
|
||||
patch = JSON.parse(msg);
|
||||
nopaque.foreignUser = jsonpatch.apply_patch(nopaque.foreignUser, patch);
|
||||
corpora_patch = patch.filter(operation => operation.path.startsWith("/corpora"));
|
||||
jobs_patch = patch.filter(operation => operation.path.startsWith("/jobs"));
|
||||
query_results_patch = patch.filter(operation => operation.path.startsWith("/query_results"));
|
||||
for (let subscriber of nopaque.foreignCorporaSubscribers) {subscriber._update(corpora_patch);}
|
||||
for (let subscriber of nopaque.foreignJobsSubscribers) {subscriber._update(jobs_patch);}
|
||||
for (let subscriber of nopaque.foreignQueryResultsSubscribers) {subscriber._update(query_results_patch);}
|
||||
});
|
||||
|
||||
nopaque.Forms = {};
|
||||
nopaque.Forms.init = function() {
|
||||
@ -173,32 +164,10 @@ nopaque.Forms.init = function() {
|
||||
}
|
||||
}
|
||||
|
||||
nopaque.Navigation = {};
|
||||
nopaque.Navigation.init = function() {
|
||||
/* ### Initialize sidenav-main ### */
|
||||
for (let entry of document.querySelectorAll("#sidenav-main a")) {
|
||||
if (entry.href === window.location.href) {
|
||||
entry.parentNode.classList.add("active");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nopaque.flash = function() {
|
||||
var classes, toast, toastActionElement;
|
||||
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
category = "message";
|
||||
message = arguments[0];
|
||||
break;
|
||||
case 2:
|
||||
message = arguments[0];
|
||||
category = arguments[1];
|
||||
break;
|
||||
default:
|
||||
console.error("Usage: nopaque.flash(message) or nopaque.flash(message, category)")
|
||||
}
|
||||
nopaque.flash = function(message, category) {
|
||||
let toast;
|
||||
let toastActionElement;
|
||||
|
||||
switch (category) {
|
||||
case "corpus":
|
||||
@ -219,27 +188,5 @@ nopaque.flash = function() {
|
||||
<i class="material-icons">close</i>
|
||||
</button>`});
|
||||
toastActionElement = toast.el.querySelector('.toast-action[data-action="close"]');
|
||||
if (toastActionElement) {
|
||||
toastActionElement.addEventListener('click', function() {
|
||||
toast.dismiss();
|
||||
});
|
||||
}
|
||||
toastActionElement.addEventListener('click', () => {toast.dismiss();});
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Disable all option elements with no value
|
||||
for (let optionElement of document.querySelectorAll('option[value=""]')) {
|
||||
optionElement.disabled = true;
|
||||
}
|
||||
M.AutoInit();
|
||||
M.CharacterCounter.init(document.querySelectorAll('input[data-length][type="text"]'));
|
||||
M.Dropdown.init(document.querySelectorAll('#nav-notifications, #nav-account'),
|
||||
{alignment: 'right', constrainWidth: false, coverTrigger: false});
|
||||
nopaque.Forms.init();
|
||||
nopaque.Navigation.init();
|
||||
while (nopaque.flashedMessages.length) {
|
||||
flashedMessage = nopaque.flashedMessages.shift();
|
||||
nopaque.flash(flashedMessage[1], flashedMessage[0]);
|
||||
}
|
||||
});
|
||||
|
@ -85,7 +85,6 @@ RessourceList.dataMappers = {
|
||||
author: corpus_file.author,
|
||||
filename: corpus_file.filename,
|
||||
link: `${corpus_file.corpus_id}/files/${corpus_file.id}`,
|
||||
publishing_year: corpus_file.publishing_year,
|
||||
title: corpus_file.title,
|
||||
title1: corpus_file.title,
|
||||
"delete-link": `/corpora/${corpus_file.corpus_id}/files/${corpus_file.id}/delete`,
|
||||
@ -131,11 +130,11 @@ RessourceList.dataMappers = {
|
||||
confirmed: user.confirmed,
|
||||
email: user.email,
|
||||
id: user.id,
|
||||
link: `user/${user.id}`,
|
||||
link: `users/${user.id}`,
|
||||
role_id: user.role_id,
|
||||
username: user.username,
|
||||
username2: user.username,
|
||||
"delete-link": `/admin/user/${user.id}/delete`,
|
||||
"delete-link": `/admin/users/${user.id}/delete`,
|
||||
"delete-modal": `delete-user-${user.id}-modal`,
|
||||
"delete-modal-trigger": `delete-user-${user.id}-modal`,
|
||||
}),
|
||||
@ -239,7 +238,6 @@ RessourceList.options = {
|
||||
<td class="filename" style="word-break: break-word;"></td>
|
||||
<td class="author" style="word-break: break-word;"></td>
|
||||
<td class="title" style="word-break: break-word;"></td>
|
||||
<td class="publishing_year" style="word-break: break-word;"></td>
|
||||
<td>
|
||||
<div class="right-align">
|
||||
<a class="btn-floating modal-trigger red tooltipped waves-effect waves-light delete-modal-trigger" data-position="top" data-tooltip="Delete">
|
||||
@ -267,7 +265,6 @@ RessourceList.options = {
|
||||
valueNames: [
|
||||
"author",
|
||||
"filename",
|
||||
"publishing_year",
|
||||
"title",
|
||||
"title1",
|
||||
{name: "delete-link", attr: "href"},
|
||||
|
Reference in New Issue
Block a user