Skip to content

Commit 7cc3969

Browse files
committed
Merge branch 'main' into course_titles
2 parents 3e160ad + 12136c2 commit 7cc3969

File tree

5 files changed

+34
-15
lines changed

5 files changed

+34
-15
lines changed

nbgrader/server_extensions/course_list/handlers.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def check_for_local_formgrader(self, config):
9393
raise gen.Return([{
9494
'course_id': coursedir.course_id,
9595
'course_title': title,
96-
'url': base_url + '/lab',
96+
'url': base_url + '/formgrader',
9797
'kind': 'local'
9898
}])
9999

@@ -131,7 +131,7 @@ def check_for_noauth_jupyterhub_formgraders(self, config):
131131
courses = [{
132132
'course_id': coursedir.course_id,
133133
'course_title': title,
134-
'url': url + "/lab",
134+
'url': url + "/lab?formgrader=true",
135135
'kind': 'jupyterhub'
136136
}]
137137
raise gen.Return(courses)
@@ -179,7 +179,7 @@ def check_for_jupyterhub_formgraders(self, config):
179179
courses.append({
180180
'course_id': course,
181181
'course_title': title,
182-
'url': self.get_base_url() + service['prefix'].rstrip('/') + "/lab",
182+
'url': self.get_base_url() + service['prefix'].rstrip('/') + "/lab?formgrader=true",
183183
'kind': 'jupyterhub'
184184
})
185185

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies = [
4646
"python-dateutil>=2.8",
4747
"rapidfuzz>=1.8",
4848
"requests>=2.26",
49+
"setuptools",
4950
"sqlalchemy>=1.4,<3",
5051
"PyYAML>=6.0",
5152
]

src/course_list/courselist.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function createElementFromCourse(data: any, app: JupyterFrontEnd, isNotebook:boo
6262
} else {
6363
const url = data['url'] as string;
6464
if (isNotebook) {
65-
anchor.href = URLExt.join(url.replace(/lab\/?$/, 'tree'));
65+
anchor.href = url.replace(/\/lab(\/|\?)?/, '/tree$1');
6666
} else {
6767
anchor.href = url
6868
}

src/index.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ILabShell, ILayoutRestorer, JupyterFrontEnd, JupyterFrontEndPlugin } from "@jupyterlab/application";
1+
import { ILabShell, ILayoutRestorer, IRouter, JupyterFrontEnd, JupyterFrontEndPlugin } from "@jupyterlab/application";
22
import { ICommandPalette, MainAreaWidget, WidgetTracker } from "@jupyterlab/apputils";
33
import { PageConfig, URLExt } from "@jupyterlab/coreutils";
44
import { IMainMenu } from '@jupyterlab/mainmenu';
@@ -178,7 +178,6 @@ const courseListExtension: JupyterFrontEndPlugin<void> = {
178178
id: pluginIDs.coursesList,
179179
autoStart: true,
180180
optional: [ILayoutRestorer, INotebookTree],
181-
182181
activate: (
183182
app: JupyterFrontEnd,
184183
restorer: ILayoutRestorer | null,
@@ -240,11 +239,12 @@ const courseListExtension: JupyterFrontEndPlugin<void> = {
240239
const formgraderExtension: JupyterFrontEndPlugin<void> = {
241240
id: pluginIDs.formgrader,
242241
autoStart: true,
243-
optional: [ILayoutRestorer, INotebookTree],
242+
optional: [ILayoutRestorer, INotebookTree, IRouter],
244243
activate: (
245244
app: JupyterFrontEnd,
246245
restorer: ILayoutRestorer | null,
247-
notebookTree: INotebookTree | null
246+
notebookTree: INotebookTree | null,
247+
router: IRouter | null
248248
) => {
249249
// Declare a widget variable
250250
let widget: MainAreaWidget<FormgraderWidget>;
@@ -290,6 +290,15 @@ const formgraderExtension: JupyterFrontEndPlugin<void> = {
290290
}
291291
});
292292

293+
// Open formgrader from URL.
294+
if (router) {
295+
const formgraderPattern = /(\?|&)formgrader=true/;
296+
router.register({
297+
command: commandIDs.openFormgrader,
298+
pattern: formgraderPattern
299+
});
300+
}
301+
293302
// Restore the widget state
294303
if (restorer != null){
295304
restorer.restore(tracker, {

yarn.lock

+16-7
Original file line numberDiff line numberDiff line change
@@ -5424,6 +5424,15 @@ __metadata:
54245424
languageName: node
54255425
linkType: hard
54265426

5427+
"nanoid@npm:^3.3.7":
5428+
version: 3.3.7
5429+
resolution: "nanoid@npm:3.3.7"
5430+
bin:
5431+
nanoid: bin/nanoid.cjs
5432+
checksum: d36c427e530713e4ac6567d488b489a36582ef89da1d6d4e3b87eded11eb10d7042a877958c6f104929809b2ab0bafa17652b076cdf84324aa75b30b722204f2
5433+
languageName: node
5434+
linkType: hard
5435+
54275436
"natural-compare-lite@npm:^1.4.0":
54285437
version: 1.4.0
54295438
resolution: "natural-compare-lite@npm:1.4.0"
@@ -5980,13 +5989,13 @@ __metadata:
59805989
linkType: hard
59815990

59825991
"postcss@npm:^8.3.11, postcss@npm:^8.4.19, postcss@npm:^8.4.21":
5983-
version: 8.4.28
5984-
resolution: "postcss@npm:8.4.28"
5992+
version: 8.4.32
5993+
resolution: "postcss@npm:8.4.32"
59855994
dependencies:
5986-
nanoid: ^3.3.6
5995+
nanoid: ^3.3.7
59875996
picocolors: ^1.0.0
59885997
source-map-js: ^1.0.2
5989-
checksum: f605c24a36f7e400bad379735fbfc893ccb8d293ad6d419bb824db77cdcb69f43d614ef35f9f7091f32ca588d130ec60dbcf53b366e6bf88a8a64bbeb3c05f6d
5998+
checksum: 220d9d0bf5d65be7ed31006c523bfb11619461d296245c1231831f90150aeb4a31eab9983ac9c5c89759a3ca8b60b3e0d098574964e1691673c3ce5c494305ae
59905999
languageName: node
59916000
linkType: hard
59926001

@@ -6985,11 +6994,11 @@ __metadata:
69856994
linkType: hard
69866995

69876996
"systeminformation@npm:^5.8.6":
6988-
version: 5.18.15
6989-
resolution: "systeminformation@npm:5.18.15"
6997+
version: 5.21.18
6998+
resolution: "systeminformation@npm:5.21.18"
69906999
bin:
69917000
systeminformation: lib/cli.js
6992-
checksum: 15555c2c0fac29ca8146153c5b9ad146f5fe5ffe109f0cbc20d2d2b902f8b4d2cc57a1add233edc4914c13f984b96250a51ce351bd570a1ac6ba369ed3caa974
7001+
checksum: 8cd17aac622b97182c75e49905cd723efd997169bf397aa494bc343fc6c313a2447ba1dbc1545b6c4348d905f83d57784521301c02a4717814c85a0568030ee4
69937002
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
69947003
languageName: node
69957004
linkType: hard

0 commit comments

Comments
 (0)