Add Save Dialog with Change Author, Version, Date and description boxes.
Just need to fix the return code from API to ensure that when it saves, and returns OK, it will refresh the page.. #94
This commit is contained in:
parent
4f8d79c926
commit
62e21c1ceb
@ -9,6 +9,7 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js" type="text/javascript"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js" type="text/javascript"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/momentjs/2.10.6/moment.min.js" type="text/javascript"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/sammy.js/0.7.6/sammy.js" type="text/javascript"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/sammy.js/0.7.6/sammy.js" type="text/javascript"></script>
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||||
<link rel="stylesheet" href="css/easymde.min.css" />
|
<link rel="stylesheet" href="css/easymde.min.css" />
|
||||||
@ -118,41 +119,42 @@
|
|||||||
<textarea id="policyEditor"></textarea>
|
<textarea id="policyEditor"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div id="preview" class="tab-pane fade in">
|
<div id="preview" class="tab-pane fade in">
|
||||||
<div data-bind="html: previewHtml" class="well-lg"></div>
|
<div data-bind="html: policyData().Html" class="well-lg"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary pull-right" data-bind="click: $root.policySave">Save</button>
|
<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#saveDialog" >Save</button><!--data-bind="click: $root.policySave"-->
|
||||||
<button class="btn btn-secondary pull-right" data-bind="click: $root.policyReload">Cancel</button>
|
<button class="btn btn-secondary pull-right" data-bind="click: $root.policyReload">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="saveDialog" class="modal fade" role="dialog" data-bind="with: policyData">
|
<div id="saveDialog" class="modal fade" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 data-bind="text: ApplicationName"></h4>
|
<h4>Change Details</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Change Author</th>
|
<th>Change Author</th>
|
||||||
<td data-bind="text: ChangeAuthor"></td>
|
<td ><input class="form-control" id="changeAuthorInput" type="text" data-bind="value: policyData().ChangeAuthor"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Change Date</th>
|
<th>Change Date</th>
|
||||||
<td><input id="changeDatePicker" type="datetime" data-bind="value: ChangeDate"/></td>
|
<td><input class="form-control" id="changeDatePicker" type="datetime-local" data-bind="value: policyData().ChangeDate"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th >Version</th>
|
<th >Version</th>
|
||||||
<td data-bind="text: Version"></td>
|
<td ><input class="form-control" id="versionInput" type="text" data-bind="value: policyData().Version"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Database Provider</th>
|
<th>Change Description</th>
|
||||||
<td data-bind="text: DataBaseProvider"></td>
|
<td><input class="form-control" id="changeDescription" type="text" data-bind="value: policyData().ChangeDescription"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-primary pull-right" data-bind="click: $root.policySave">Save</button>
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
self.unassignedCardList = ko.observable(null);
|
self.unassignedCardList = ko.observable(null);
|
||||||
self.helpers = new Helpers();
|
self.helpers = new Helpers();
|
||||||
self.policyMarkdown = "";
|
self.policyMarkdown = "";
|
||||||
self.previewHtml = ko.observable("");
|
self.policyData = ko.observable({ChangeAuthor:"", ChangeDate:moment(), Version:1, ChangeDescription:"", Markdown:"", Html:""});
|
||||||
self.renderer = new marked.Renderer();
|
self.renderer = new marked.Renderer();
|
||||||
self.renderer.blockquote = function(quote) {
|
self.renderer.blockquote = function(quote) {
|
||||||
return "<blockquote class=\"blockquote\">" + quote + "</blockquote>";
|
return "<blockquote class=\"blockquote\">" + quote + "</blockquote>";
|
||||||
@ -66,7 +66,7 @@
|
|||||||
});
|
});
|
||||||
self.editor.codemirror.on("changes",
|
self.editor.codemirror.on("changes",
|
||||||
function () {
|
function () {
|
||||||
self.previewHtml(self.editor.options.previewRender(self.editor.value()));
|
self.policyData().Html=self.editor.options.previewRender(self.editor.value());
|
||||||
});
|
});
|
||||||
self.uiPages = {
|
self.uiPages = {
|
||||||
overview: "overview",
|
overview: "overview",
|
||||||
@ -168,9 +168,9 @@
|
|||||||
};
|
};
|
||||||
self.policySave = function () {
|
self.policySave = function () {
|
||||||
var url = self.helpers.createRequestUrl(self.apiEndpoints.savePolicy, null, false);
|
var url = self.helpers.createRequestUrl(self.apiEndpoints.savePolicy, null, false);
|
||||||
var policy = { markdown: self.editor.value(), html: self.previewHtml() };
|
self.policyData().Markdown = self.editor.value(); //make sure we update it, as it doesnt push the value back into the variable
|
||||||
console.log(policy);
|
console.log(self.policyData());
|
||||||
$.post(url, policy, function() {
|
$.post(url, self.policyData(), function() {
|
||||||
}, "json")
|
}, "json")
|
||||||
.done(function() {
|
.done(function() {
|
||||||
self.policyReload();
|
self.policyReload();
|
||||||
@ -185,7 +185,7 @@
|
|||||||
$.getJSON(url, function (res) {
|
$.getJSON(url, function (res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
self.editor.value(res.Markdown);
|
self.editor.value(res.Markdown);
|
||||||
self.previewHtml(res.Html);
|
self.policyData(res);
|
||||||
}).fail(function (resp, status, error) {
|
}).fail(function (resp, status, error) {
|
||||||
console.log("error - policyReload");
|
console.log("error - policyReload");
|
||||||
var errObj = self.helpers.processRequestFailure(resp, status, error);
|
var errObj = self.helpers.processRequestFailure(resp, status, error);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
Tools/Sentinel.zip
Normal file
BIN
Tools/Sentinel.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user