Skip to content
Snippets Groups Projects
Commit 8b323add authored by Thomas Hackl's avatar Thomas Hackl Committed by Jan-Hendrik Willms
Browse files

Resolve "STUDIP.Report in die neuen Notifications integrieren"

Closes #4428

Merge request studip/studip!3220
parent f66cd167
No related branches found
No related tags found
No related merge requests found
import { $gettext, $gettextInterpolate } from '../lib/gettext';
import Report from '../lib/report.js';
import Report from '../lib/report.ts';
// Allow fieldsets to collapse
$(document).on(
......
......@@ -61,7 +61,7 @@ import QuickSelection from './lib/quick_selection.js';
import Raumzeit from './lib/raumzeit.js';
import {ready, domReady, dialogReady} from './lib/ready.js';
import register from './lib/register.js';
import Report from './lib/report.js';
import Report from './lib/report.ts';
import Resources from './lib/resources.js';
import Responsive from './lib/responsive.js';
import Schedule from './lib/schedule.js';
......
......@@ -3,7 +3,7 @@ import parseOptions from './parse_options.js';
import extractCallback from './extract_callback.js';
import Overlay from './overlay.js';
import PageLayout from './page_layout.js';
import Report from './report.js';
import Report from './report.ts';
/**
* Specialized dialog handler
......
......@@ -8,41 +8,38 @@
* @license GLP2 or any later version
* @copyright 2019 Stud.IP Core Group
*/
import eventBus from "./event-bus";
import Dialog from './dialog.js';
let counter = 0;
function reportMessage(type, title, content, options) {
options.id = `report-${type}-${counter++}`;
options.title = title;
options.size = 'fit';
options.wikilink = false;
options.dialogClass = `report-${type}`;
Dialog.show(content, options);
}
const Report = {
export default class Report
{
// Info message
info (title, content, options = {}) {
reportMessage('info', title, content, options);
},
static info (title: string, content: string) {
Report.#reportMessage('info', title, content);
}
// Success message
success (title, content, options = {}) {
reportMessage('success', title, content, options);
},
static success (title: string, content: string) {
Report.#reportMessage('success', title, content);
}
// Warning message
warning (title, content, options = {}) {
reportMessage('warning', title, content, options);
},
static warning (title: string, content: string) {
Report.#reportMessage('warning', title, content);
}
// Error message
error (title, content, options = {}) {
reportMessage('error', title, content, options);
static error (title: string, content: string) {
Report.#reportMessage('error', title, content);
}
};
export default Report;
static #reportMessage(type: string, title: string, content: string) {
eventBus.emit(
'push-system-notification',
{
type: type,
message: title,
details: content
}
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment