Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var AssignmentUI = Backbone.View.extend({

this.$name.append($("<a/>")
.text(name)
.map(linkTo("directory", url_prefix + "/" + this.model.get("source_path")))
.map(linkTo("directory", url_prefix + "/" + this.model.get("source_path"), base_url))
);

// duedate
Expand Down Expand Up @@ -150,7 +150,7 @@ var AssignmentUI = Backbone.View.extend({
var release_path = this.model.get("release_path");
if (release_path) {
this.$preview.append($("<a/>")
.map(linkTo("directory", url_prefix + "/" + release_path))
.map(linkTo("directory", url_prefix + "/" + release_path, base_url))
.append($("<span/>")
.addClass("glyphicon glyphicon-search")
.attr("aria-hidden", "true")
Expand Down
11 changes: 7 additions & 4 deletions nbgrader/server_extensions/formgrader/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,20 @@ var insertDataTable = function (tbl) {
});
};

var linkTo = function (type, path) {
var linkTo = function (type, path, base) {
/*
* Connect a link in the appropriate manner for the context.
* - If we're in the outermost frame, assume notebook and use an href.
* - If we're in an iframe, assume lab and send a message.
*/
if (window === window.top) {
if (typeof base === "undefined") {
base = "";
}
var prefix = {
notebook: "/notebooks/",
file: "/edit/",
directory: "/tree/"
notebook: base + "/notebooks/",
file: base + "/edit/",
directory: base + "/tree/"
}[type];

return (_, el) => {
Expand Down