Skip to content

Commit

Permalink
More BasePath fixes.
Browse files Browse the repository at this point in the history
Fixes #41, finally!
  • Loading branch information
bsiegert committed Nov 19, 2023
1 parent 687a161 commit ed7a48a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions static/builddetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ bt.buildDetails.columns = [

bt.buildDetails.createdRow = function (row, data) {
$('td', row).filter((i) => i < 2)
.wrapInner(`<a href="/build/${data.ResultID}"></a>`);
.wrapInner(`<a href="${bt.basePath}build/${data.ResultID}"></a>`);
};

bt.buildDetails.init = function () {
var buildNo = window.location.pathname.slice(-2).replaceAll("/", "");
$('.table').dataTable({
ajax: {
url: `/json/pkgsbreakingmostothers/${buildNo}`,
url: `${bt.basePath}json/pkgsbreakingmostothers/${buildNo}`,
dataSrc: ""
},
columns: bt.buildDetails.columns,
// createdRow: bt.buildDetails.createdRow,
order: [[3, 'desc']],
createdRow: function (row, data, dataIndex) {
$('td:eq(1)', row).wrapInner('<a href="/pkg/' + data.ResultID + '"></a>');
$('td:eq(1)', row).wrapInner(`<a href="${bt.basePath}pkg/${data.ResultID}"></a>`);
$('td:eq(2)', row).addClass(classes[data.BuildStatus]);
}
});
Expand Down
4 changes: 2 additions & 2 deletions static/builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ bt.builds.columns = [

bt.builds.createdRow = function (row, data) {
$('td', row).filter(function (i) { return i < 3 })
.wrapInner(`<a href="/build/${data.BuildID}"></a>`);
.wrapInner(`<a href="${bt.basePath}build/${data.BuildID}"></a>`);
};

bt.builds.init = function () {
$('.table').dataTable({
ajax: {
url: "/json/allbuilds/",
url: `${bt.BasePath}json/allbuilds/`,
dataSrc: ""
},
columns: bt.builds.columns,
Expand Down
6 changes: 3 additions & 3 deletions templates/table_builds.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<tr>
<td>
<a href="/build/{{.BuildID}}">{{.Date}}</a>
<a href="{{.BasePath}}build/{{.BuildID}}">{{.Date}}</a>
</td>
<td>
<a href="/build/{{.BuildID}}">{{.Branch}}</a>
<a href="{{.BasePath}}build/{{.BuildID}}">{{.Branch}}</a>
</td>
<td>
<a href="/build/{{.BuildID}}">{{.Platform}}</a>
<a href="{{.BasePath}}build/{{.BuildID}}">{{.Platform}}</a>
</td>
<td>
<span class="text-danger">{{.NumFailed}} failed</span> /
Expand Down
9 changes: 8 additions & 1 deletion templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ func TableBegin(w io.Writer, columns ...string) {
}

func TableBuilds(w io.Writer, b *ddao.Build) {
t.ExecuteTemplate(w, "table_builds.html", b)
s := struct {
*ddao.Build
bp
}{
Build: b,
bp: bp{},
}
t.ExecuteTemplate(w, "table_builds.html", s)
}

func TablePkgs(w io.Writer, rows []ddao.GetResultsInCategoryRow) {
Expand Down

0 comments on commit ed7a48a

Please sign in to comment.