#19013: Fixing JSon formatting in widgets editor

Work Item: 19013

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-09-24 12:48:29 -07:00
parent bccf6ab3ce
commit 02939d0a24

View File

@@ -4,6 +4,11 @@
Script.Require("jQuery");
IEnumerable<LayerPart> layers = Model.Layers;
}
@functions {
static string EncodeLineBreaks(string text) {
return text.Replace(Environment.NewLine, "\\\\n");
}
}
<script type="text/javascript">
//<![CDATA[
document.write("<div id=\"widgets-layer-visibility\"><h3>@T("All Layers:")</h3></div>");
@@ -16,7 +21,7 @@
var currentLayerId = @Model.CurrentLayer.Id;
var layers = [
@foreach (var layer in layers) {
<text>{"name":"@layer.Name","description":"@layer.Description","id":@layer.Id}@(layer != layers.Last() ? "," : "")</text>
<text>{"name":"@layer.Name","description":"@EncodeLineBreaks(layer.Description)","id":@layer.Id}@(layer != layers.Last() ? "," : "")</text>
}
];
var visWrapper = $("#widgets-layer-visibility");