Skip to content

Commit

Permalink
Added help icons to some admin pages and fixed worker pipeline for gi…
Browse files Browse the repository at this point in the history
…thub to show current version instead of version sha
  • Loading branch information
SebiWrn committed Nov 23, 2023
1 parent ff094d4 commit 395ddc7
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-workers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ jobs:
context: ./${{ matrix.module }}
pull: true
push: true
build-args: version=${{ steps.vars.outputs.sha_short }}
build-args: version=${{ github.ref_name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion web/assets/css/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,4 @@ label:has(~ .tum-live-input) {

.tum-live-markdown a {
border-bottom: 1px solid black;
}
}
16 changes: 13 additions & 3 deletions web/template/admin/admin_tabs/course-import.gohtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{define "course-import"}}
<h1 class="text-2xl text-1 my-4">Course Import</h1>
<link rel="stylesheet" href="/static/node_modules/flatpickr/dist/flatpickr.min.css">
<link href="/static/node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
<script src="/static/node_modules/flatpickr/dist/flatpickr.min.js"></script>

<section class="form-container" x-data="admin.pageData()" x-on:loading-start.window="loading=true"
Expand All @@ -14,7 +15,10 @@

<form x-show="step===0 || step===1" class="form-container-body grid grid-cols-2 gap-4">
<label>
<h2>Year</h2>
<div class="flex flex-row">
<h2>Year</h2>
<help-icon class="transform -translate-x-0.5" text="Please select the current year. In case of WS select the first year"/>
</div>
<select x-model="year" class="tl-select">
<option>2023</option>
<option>2024</option>
Expand Down Expand Up @@ -44,14 +48,20 @@
<input x-show="department==='-- specify id --'" x-model="departmentID" type="text" class="tl-input">
</label>
<label>
<h2>Opt In / Opt Out</h2>
<div class="flex flex-row">
<h2>Opt In / Opt Out</h2>
<help-icon class="transform -translate-x-0.5" text="Opt In -> Lecturer has to opt in to use the system<br/>Opt Out -> Lecturer only has to opt out if he doesn't want to use livestreaming"/>
</div>
<select x-model="optInOut" class="tl-select">
<option>Opt In</option>
<option>Opt Out</option>
</select>
</label>
<label class="col-span-full" x-init="flatpickr($refs.range, {'mode': 'range'})">
<h2>Import events in this range</h2>
<div class="flex flex-row">
<h2>Import events in this range</h2>
<help-icon class="transform -translate-x-0.5" text="Please select a start date and and end date"/>
</div>
<input class="tl-input" type="text" x-ref="range" x-model="range" placeholder="click me!">
</label>
<button class="btn primary col-span-full" @click="step++; $dispatch(`notify${step}`)" :disabled="loading"
Expand Down
5 changes: 5 additions & 0 deletions web/template/partial/course/manage/course_settings.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,35 @@
<input class="w-auto" id="enVOD" name="enVOD" type="checkbox" {{if and . .VODEnabled}}checked{{end}}
{{if not .}}checked{{end}}>
Enable VOD
<help-icon text="Students can watch this lecture after the livestream ended"/>
</label>
<label class="block text-slate-900 dark:text-slate-200" for="enDL">
<input class="w-auto" id="enDL" name="enDL" type="checkbox"
{{if and . .DownloadsEnabled}}checked{{end}}
{{if not .}}checked{{end}}>
Enable Downloads
<help-icon text="Students can download this lecture after the livestream ended"/>
</label>
<div x-init="isChatEnabledForCourse={{.ChatEnabled}}">
<label class="block" for="enChat">
<input x-model="isChatEnabledForCourse" class="w-auto" id="enChat" name="enChat" type="checkbox"
{{if and . .ChatEnabled}}checked{{end}} {{if not .}}checked{{end}}>
Enable Live Chat
<help-icon text="Students use the chat during the lecture"/>
</label>
<label class="block" for="enChatAnon">
<input :disabled="!isChatEnabledForCourse" class="w-auto" id="enChatAnon" name="enChatAnon"
type="checkbox"
{{if and . .AnonymousChatEnabled}}checked{{end}} {{if not .}}checked{{end}}>
Allow Anonymous Messages
<help-icon text="Students are allowed to send messages anonymously"/>
</label>
<label class="block" for="enChatMod">
<input :disabled="!isChatEnabledForCourse" class="w-auto" id="enChatMod" name="enChatMod"
type="checkbox"
{{if and . .ModeratedChatEnabled}}checked{{end}} {{if not .}}checked{{end}}>
Enable Moderate Chat
<help-icon text="Every Chat message has to be checked and approved by a moderator"/>
</label>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions web/ts/custom-elements/elements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as help from "./help-icon";

export function defineElements() {
customElements.define("help-icon", help.HelpIcon);
console.log("Defined custom elements");
}
31 changes: 31 additions & 0 deletions web/ts/custom-elements/help-icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export class HelpIcon extends HTMLElement {
private text: string;
constructor() {
super();
}

connectedCallback() {
this.text = this.getAttribute("text") ?? "No help available";
this.innerHTML = `
<style>
.help-icon-tooltip-desktop {
max-width: 22rem;
}
</style>
<span
x-data="{ tooltip: false }"
x-on:mouseover="tooltip = true"
x-on:mouseleave="tooltip = false"
class="cursor-pointer m-0 pl-1 text-sm">
<i class="fa-solid fa-circle-info text-gray-700 dark:text-gray-400 w-fit h-fit justify-self-center"></i>
<div x-show="tooltip"
class="text-sm help-icon-tooltip-desktop text-white absolute primary rounded-lg p-1.5"
>
${this.text}
</div>
</span>
`;
this.className = "m-0 p-0 text-xs";
this.style.textRendering = "";
}
}
2 changes: 1 addition & 1 deletion web/ts/entry/user.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* This bundle contains all functionality that students depend on when not watching a video */
export * from "../global";
export * from "../course-overview";
export * from "../course-overview";
3 changes: 3 additions & 0 deletions web/ts/global.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { StatusCodes } from "http-status-codes";
import {defineElements} from "./custom-elements/elements";

export * from "./notifications";
export * from "./user-settings";
export * from "./start-page";
export * from "./utilities/time";
export * from "./custom-elements/elements";

export async function getData(url = "") {
return await fetch(url);
Expand Down Expand Up @@ -304,6 +306,7 @@ export type Section = {

window.onload = function () {
initHiddenCourses();
defineElements();
};

export function cloneEvents(srcElem: HTMLElement, destElem: HTMLElement, events: string[]) {
Expand Down
2 changes: 1 addition & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "es6",
"target": "es5",
"target": "es6",
"sourceMap": true,
"outDir": "assets/ts-dist",
"noImplicitAny": false,
Expand Down

1 comment on commit 395ddc7

@YiranDuan721
Copy link
Contributor

@YiranDuan721 YiranDuan721 commented on 395ddc7 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I think the admin pages with help-icons would be really helpful. I'm also working on the admin pages, and I'd like to write down my thoughts on the help icons here, when I had any.

For now I'm considering about the slug on the create-course page. I'm changing its behaviour, so that only such characters would be accepted: A-Z, a-z, 0-9, and some of the URL-safe special characters "-_.+()~". I think this should be enough for a course slug...
I think a help icon is needed for the slug, and the help information should include the following:

  1. the slug will be used in the url for the course;
  2. only the characters mentioned above can be accepted

Please sign in to comment.