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 { $gettext, $gettextInterpolate } from '../lib/gettext';
import Report from '../lib/report.js'; import Report from '../lib/report.ts';
// Allow fieldsets to collapse // Allow fieldsets to collapse
$(document).on( $(document).on(
......
...@@ -61,7 +61,7 @@ import QuickSelection from './lib/quick_selection.js'; ...@@ -61,7 +61,7 @@ import QuickSelection from './lib/quick_selection.js';
import Raumzeit from './lib/raumzeit.js'; import Raumzeit from './lib/raumzeit.js';
import {ready, domReady, dialogReady} from './lib/ready.js'; import {ready, domReady, dialogReady} from './lib/ready.js';
import register from './lib/register.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 Resources from './lib/resources.js';
import Responsive from './lib/responsive.js'; import Responsive from './lib/responsive.js';
import Schedule from './lib/schedule.js'; import Schedule from './lib/schedule.js';
......
...@@ -3,7 +3,7 @@ import parseOptions from './parse_options.js'; ...@@ -3,7 +3,7 @@ import parseOptions from './parse_options.js';
import extractCallback from './extract_callback.js'; import extractCallback from './extract_callback.js';
import Overlay from './overlay.js'; import Overlay from './overlay.js';
import PageLayout from './page_layout.js'; import PageLayout from './page_layout.js';
import Report from './report.js'; import Report from './report.ts';
/** /**
* Specialized dialog handler * Specialized dialog handler
......
...@@ -8,41 +8,38 @@ ...@@ -8,41 +8,38 @@
* @license GLP2 or any later version * @license GLP2 or any later version
* @copyright 2019 Stud.IP Core Group * @copyright 2019 Stud.IP Core Group
*/ */
import eventBus from "./event-bus";
import Dialog from './dialog.js'; export default class Report
{
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 = {
// Info message // Info message
info (title, content, options = {}) { static info (title: string, content: string) {
reportMessage('info', title, content, options); Report.#reportMessage('info', title, content);
}, }
// Success message // Success message
success (title, content, options = {}) { static success (title: string, content: string) {
reportMessage('success', title, content, options); Report.#reportMessage('success', title, content);
}, }
// Warning message // Warning message
warning (title, content, options = {}) { static warning (title: string, content: string) {
reportMessage('warning', title, content, options); Report.#reportMessage('warning', title, content);
}, }
// Error message // Error message
error (title, content, options = {}) { static error (title: string, content: string) {
reportMessage('error', title, content, options); 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.
Finish editing this message first!
Please register or to comment