Skip to content
This repository was archived by the owner on Apr 6, 2024. It is now read-only.

Commit a57ec04

Browse files
authored
Merge pull request #134 from pascalberger/feature/gh-55
(GH-55) Add option to pass DevExtreme location to HtmlDxDataGrid template
2 parents b2eda63 + 02b1d45 commit a57ec04

File tree

2 files changed

+65
-5
lines changed

2 files changed

+65
-5
lines changed

src/Cake.Issues.Reporting.Generic/HtmlDxDataGridOption.cs

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,52 @@ public enum HtmlDxDataGridOption
254254
/// Value needs to be an instance of <see cref="FileLinkSettings"/>.
255255
/// Default value is <c>null</c>.
256256
/// </summary>
257-
FileLinkSettings
257+
FileLinkSettings,
258+
259+
/// <summary>
260+
/// Location where jQuery can be found.
261+
/// The following files need to be available:
262+
/// <list type="bullet">
263+
/// <item>
264+
/// <description><c>{JQueryLocation}/jquery-{JQueryVersion}.min.js</c></description>
265+
/// </item>
266+
/// </list>
267+
/// Default value is <c>https://ajax.aspnetcdn.com/ajax/jquery/</c>.
268+
/// </summary>
269+
JQueryLocation,
270+
271+
/// <summary>
272+
/// Version of jQuery which should be used.
273+
/// This version needs to match the version required by the selected <see cref="DevExtremeVersion"/>.
274+
/// Default value is <c>3.1.0</c>.
275+
/// </summary>
276+
JQueryVersion,
277+
278+
/// <summary>
279+
/// Location where the DevExtreme libraries can be found.
280+
/// Below the location there needs to be a folder matching <see cref="DevExtremeVersion"/> and
281+
/// inside there subfolders <c>js</c> and <c>css</c>.
282+
/// The following files need to be available:
283+
/// <list type="bullet">
284+
/// <item>
285+
/// <description><c>{DevExtremeLocation}/{DevExtremeVersion}/js/dx.all.js</c></description>
286+
/// </item>
287+
/// <item>
288+
/// <description><c>{DevExtremeLocation}/{DevExtremeVersion}/css/dx.common.css</c></description>
289+
/// </item>
290+
/// <item>
291+
/// <description><c>{DevExtremeLocation}/{DevExtremeVersion}/css/{Theme}</c></description>
292+
/// </item>
293+
/// </list>
294+
/// Default value is <c>https://cdn3.devexpress.com/jslib/</c>.
295+
/// </summary>
296+
DevExtremeLocation,
297+
298+
/// <summary>
299+
/// Version of the DevExtreme libraries which should be used.
300+
/// If setting this the matching <see cref="JQueryVersion"/> needs to also be set.
301+
/// Default value is <c>18.2.7</c>.
302+
/// </summary>
303+
DevExtremeVersion
258304
}
259305
}

src/Cake.Issues.Reporting.Generic/Templates/DxDataGrid.cshtml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
var sortedColumns = ViewBagHelper.ValueOrDefault(ViewBag.SortedColumns, new List<ReportColumn> { ReportColumn.PriorityName, ReportColumn.ProjectName, ReportColumn.FileDirectory, ReportColumn.FileName, ReportColumn.Line });
4444
FileLinkSettings fileLinkSettings = ViewBagHelper.ValueOrDefault(ViewBag.FileLinkSettings, new FileLinkSettings());
4545
List<HtmlDxDataGridColumnDescription> additionalColumns = ViewBagHelper.ValueOrDefault(ViewBag.AdditionalColumns, new List<HtmlDxDataGridColumnDescription>());
46+
string jQueryLocation = ViewBagHelper.ValueOrDefault(ViewBag.JQueryLocation, "https://ajax.aspnetcdn.com/ajax/jquery/");
47+
string jQueryVersion = ViewBagHelper.ValueOrDefault(ViewBag.JQueryVersion, "3.1.0");
48+
string devExtremeLocation = ViewBagHelper.ValueOrDefault(ViewBag.DevExtremeLocation, "https://cdn3.devexpress.com/jslib/");
49+
string devExtremeVersion = ViewBagHelper.ValueOrDefault(ViewBag.DevExtremeVersion, "18.2.7");
4650
}
4751

4852
@{
@@ -66,6 +70,16 @@
6670
addMessage: messageVisible,
6771
fileLinkSettings: fileLinkSettings,
6872
additionalValues: additionalColumns.ToDictionary(x => x.Id, x => x.ValueRetriever));
73+
74+
if (!jQueryLocation.EndsWith("/"))
75+
{
76+
jQueryLocation += "/";
77+
}
78+
79+
if (!devExtremeLocation.EndsWith("/"))
80+
{
81+
devExtremeLocation += "/";
82+
}
6983
}
7084

7185
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
@@ -74,12 +88,12 @@
7488
<title>@title</title>
7589

7690
@* DevExtreme dependencies *@
77-
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.1.0.min.js"></script>
91+
<script type="text/javascript" src="@(jQueryLocation)jquery-@(jQueryVersion).min.js"></script>
7892
@* DevExtreme themes *@
79-
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/18.2.7/css/dx.common.css" />
80-
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/18.2.7/css/@(theme.GetCssFileName())" />
93+
<link rel="stylesheet" type="text/css" href="@(devExtremeLocation)@(devExtremeVersion)/css/dx.common.css" />
94+
<link rel="stylesheet" type="text/css" href="@(devExtremeLocation)@(devExtremeVersion)/css/@(theme.GetCssFileName())" />
8195
@* DevExtreme library *@
82-
<script type="text/javascript" src="https://cdn3.devexpress.com/jslib/18.2.7/js/dx.all.js"></script>
96+
<script type="text/javascript" src="@(devExtremeLocation)@(devExtremeVersion)/js/dx.all.js"></script>
8397
</head>
8498
<body class="dx-viewport">
8599
@if (showHeader)

0 commit comments

Comments
 (0)