Skip to content
Snippets Groups Projects
Commit 2d494d9e authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add a markdown preview to session settings

parent d65b08bf
Branches
Tags
No related merge requests found
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
], ],
"styles": [ "styles": [
"src/styles.scss", "src/styles.scss",
"./node_modules/material-design-icons/iconfont/material-icons.css" "./node_modules/material-design-icons/iconfont/material-icons.css",
"node_modules/prismjs/themes/prism-okaidia.css",
"node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
], ],
"scripts": [ "scripts": [
"node_modules/marked/lib/marked.js" "node_modules/marked/lib/marked.js"
...@@ -138,4 +140,4 @@ ...@@ -138,4 +140,4 @@
"prefix": "app" "prefix": "app"
} }
} }
} }
\ No newline at end of file
...@@ -25,7 +25,7 @@ import { CreatorModule } from './components/creator/creator.module'; ...@@ -25,7 +25,7 @@ import { CreatorModule } from './components/creator/creator.module';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LanguageService } from './services/util/language.service'; import { LanguageService } from './services/util/language.service';
import { MarkdownService, MarkedOptions } from 'ngx-markdown'; import { MarkdownModule, MarkdownService, MarkedOptions } from 'ngx-markdown';
import { NewLandingComponent } from './components/home/new-landing/new-landing.component'; import { NewLandingComponent } from './components/home/new-landing/new-landing.component';
import { HomePageComponent } from './components/home/home-page/home-page.component'; import { HomePageComponent } from './components/home/home-page/home-page.component';
import { UserHomeComponent } from './components/home/user-home/user-home.component'; import { UserHomeComponent } from './components/home/user-home/user-home.component';
...@@ -59,6 +59,9 @@ import { OverlayComponent } from './components/home/_dialogs/overlay/overlay.com ...@@ -59,6 +59,9 @@ import { OverlayComponent } from './components/home/_dialogs/overlay/overlay.com
import { DemoDeComponent } from '../assets/i18n/demo/demo-de'; import { DemoDeComponent } from '../assets/i18n/demo/demo-de';
import { DemoEnComponent } from '../assets/i18n/demo/demo-en'; import { DemoEnComponent } from '../assets/i18n/demo/demo-en';
import 'prismjs/prism';
import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
export function dialogClose(dialogResult: any) { export function dialogClose(dialogResult: any) {
} }
...@@ -113,6 +116,7 @@ export function initializeApp(appConfig: AppConfig) { ...@@ -113,6 +116,7 @@ export function initializeApp(appConfig: AppConfig) {
ThemeModule, ThemeModule,
CreatorModule, CreatorModule,
ModeratorModule, ModeratorModule,
MarkdownModule.forRoot(),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
TranslateModule.forChild({ TranslateModule.forChild({
loader: { loader: {
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<mat-placeholder class="placeholder">{{ 'session.session-name' | translate }}</mat-placeholder> <mat-placeholder class="placeholder">{{ 'session.session-name' | translate }}</mat-placeholder>
<mat-hint align="end"><span aria-hidden="true">{{ editRoom.name.length }} / 20</span></mat-hint> <mat-hint align="end"><span aria-hidden="true">{{ editRoom.name.length }} / 20</span></mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field class="input-block"> <mat-tab-group>
<mat-tab label="{{'room-page.description' | translate}}">
<mat-form-field class="input-block">
<textarea <textarea
(focus)="eventService.makeFocusOnInputTrue()" (blur)="eventService.makeFocusOnInputFalse()" (focus)="eventService.makeFocusOnInputTrue()" (blur)="eventService.makeFocusOnInputFalse()"
[(ngModel)]="editRoom.description" [(ngModel)]="editRoom.description"
...@@ -21,9 +23,17 @@ ...@@ -21,9 +23,17 @@
name="description" name="description"
aria-labelledby="description" aria-labelledby="description"
></textarea> ></textarea>
<mat-placeholder class="placeholder">{{ 'session.description' | translate }}</mat-placeholder> <mat-hint align="end">
<mat-hint align="end"><span aria-hidden="true">{{ editRoom.description ? editRoom.description.length : 0 }} / 255</span></mat-hint> <span aria-hidden="true">
</mat-form-field> {{ editRoom.description ? editRoom.description.length : 0 }} / 255
</span>
</mat-hint>
</mat-form-field>
</mat-tab>
<mat-tab label="{{'session.preview' | translate}}" [disabled]="!editRoom.description">
<markdown [data]="editRoom.description"></markdown>
</mat-tab>
</mat-tab-group>
<div fxLayoutAlign="center center"> <div fxLayoutAlign="center center">
<button mat-raised-button class="delete" (click)="openDeleteRoomDialog()" aria-labelledby="delete-room"> <button mat-raised-button class="delete" (click)="openDeleteRoomDialog()" aria-labelledby="delete-room">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.delete { .delete {
margin: 20px 0 20px 0; margin: 20px 0 20px 0;
min-width: 220px; min-width: 160px;
background-color: var(--red); background-color: var(--red);
color: var(--on-secondary); color: var(--on-secondary);
} }
...@@ -51,3 +51,17 @@ mat-hint { ...@@ -51,3 +51,17 @@ mat-hint {
color: var(--on-surface)!important; color: var(--on-surface)!important;
} }
::ng-deep .mat-tab-label-active,
::ng-deep .mat-tab-label {
color: var(--on-surface);
opacity: 1!important;
}
::ng-deep .mat-ink-bar {
background-color: var(--primary) !important;
}
markdown {
color: var(--on-surface);
}
...@@ -29,6 +29,7 @@ import { ModeratorDeleteComponent } from './_dialogs/moderator-delete/moderator- ...@@ -29,6 +29,7 @@ import { ModeratorDeleteComponent } from './_dialogs/moderator-delete/moderator-
import { DeleteCommentComponent } from './_dialogs/delete-comment/delete-comment.component'; import { DeleteCommentComponent } from './_dialogs/delete-comment/delete-comment.component';
import { DeleteCommentsComponent } from './_dialogs/delete-comments/delete-comments.component'; import { DeleteCommentsComponent } from './_dialogs/delete-comments/delete-comments.component';
import { BonusDeleteComponent } from './_dialogs/bonus-delete/bonus-delete.component'; import { BonusDeleteComponent } from './_dialogs/bonus-delete/bonus-delete.component';
import { MarkdownModule } from 'ngx-markdown';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -44,7 +45,8 @@ import { BonusDeleteComponent } from './_dialogs/bonus-delete/bonus-delete.compo ...@@ -44,7 +45,8 @@ import { BonusDeleteComponent } from './_dialogs/bonus-delete/bonus-delete.compo
deps: [HttpClient] deps: [HttpClient]
}, },
isolate: true isolate: true
}) }),
MarkdownModule
], ],
declarations: [ declarations: [
ContentChoiceCreatorComponent, ContentChoiceCreatorComponent,
......
...@@ -175,10 +175,10 @@ ...@@ -175,10 +175,10 @@
"create-content": "Frage erstellen", "create-content": "Frage erstellen",
"default-content-group": "Standard", "default-content-group": "Standard",
"delete-all-comments": "Alle Fragen löschen", "delete-all-comments": "Alle Fragen löschen",
"delete-room": "Löschen", "delete-room": "Sitzung Löschen",
"delete-room-description": "Sitzung löschen", "delete-room-description": "Sitzung löschen",
"deleted": " gelöscht.", "deleted": " gelöscht.",
"description": "Beschreibung der Sitzung", "description": "Beschreibung",
"email-error": "E-Mail Adresse ist ungültig.", "email-error": "E-Mail Adresse ist ungültig.",
"export-comments": "Fragen exportieren", "export-comments": "Fragen exportieren",
"general": "Sitzung", "general": "Sitzung",
...@@ -226,9 +226,10 @@ ...@@ -226,9 +226,10 @@
"session": { "session": {
"a11y-description": "Gib eine Beschreibung für die Sitzung ein.", "a11y-description": "Gib eine Beschreibung für die Sitzung ein.",
"create-session": "Speichern", "create-session": "Speichern",
"description": "Beschreibung der Sitzung", "description": "Beschreibung",
"max-ls": "Maximale Anzahl Zeichen:", "max-ls": "Maximale Anzahl Zeichen:",
"session-name": "Name der Sitzung" "session-name": "Name der Sitzung",
"preview": "Vorschau"
}, },
"statistic": { "statistic": {
"abstentions": "Enthaltungen", "abstentions": "Enthaltungen",
......
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
"delete-room": "Delete session", "delete-room": "Delete session",
"delete-room-description": "Delete session", "delete-room-description": "Delete session",
"deleted": " deleted.", "deleted": " deleted.",
"description": "Description of session", "description": "Description",
"email-error": "E-Mail is invalid.", "email-error": "E-Mail is invalid.",
"export-comments": "Export questions", "export-comments": "Export questions",
"general": "Session", "general": "Session",
...@@ -227,9 +227,10 @@ ...@@ -227,9 +227,10 @@
"session": { "session": {
"a11y-description": "Enter a description for the session", "a11y-description": "Enter a description for the session",
"create-session": "Create session", "create-session": "Create session",
"description": "Session description", "description": "Description",
"max-ls": "Max. characters:", "max-ls": "Max. characters:",
"session-name": "Session name" "session-name": "Session name",
"preview": "Preview"
}, },
"statistic": { "statistic": {
"abstentions": "Abstentions", "abstentions": "Abstentions",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment