ui(admin): better handling of manual HTML rendering
This commit is contained in:
parent
b1fa3927c1
commit
0dad4c5a48
3 changed files with 30 additions and 12 deletions
|
@ -107,6 +107,12 @@
|
|||
@parent
|
||||
{!! Theme::js('vendor/lodash/lodash.js') !!}
|
||||
<script>
|
||||
function escapeHtml(str) {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(document.createTextNode(str));
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#pEggId').select2({placeholder: 'Select a Nest Egg'}).on('change', function () {
|
||||
var selectedEgg = _.isNull($(this).val()) ? $(this).find('option').first().val() : $(this).val();
|
||||
|
@ -149,15 +155,15 @@
|
|||
<div class="col-xs-12"> \
|
||||
<div class="box"> \
|
||||
<div class="box-header with-border"> \
|
||||
<h3 class="box-title">' + isRequired + item.name + '</h3> \
|
||||
<h3 class="box-title">' + isRequired + escapeHtml(item.name) + '</h3> \
|
||||
</div> \
|
||||
<div class="box-body"> \
|
||||
<input name="environment[' + item.env_variable + ']" class="form-control" type="text" id="egg_variable_' + item.env_variable + '" /> \
|
||||
<p class="no-margin small text-muted">' + item.description + '</p> \
|
||||
<input name="environment[' + escapeHtml(item.env_variable) + ']" class="form-control" type="text" id="egg_variable_' + escapeHtml(item.env_variable) + '" /> \
|
||||
<p class="no-margin small text-muted">' + escapeHtml(item.description) + '</p> \
|
||||
</div> \
|
||||
<div class="box-footer"> \
|
||||
<p class="no-margin text-muted small"><strong>Startup Command Variable:</strong> <code>' + item.env_variable + '</code></p> \
|
||||
<p class="no-margin text-muted small"><strong>Input Rules:</strong> <code>' + item.rules + '</code></p> \
|
||||
<p class="no-margin text-muted small"><strong>Startup Command Variable:</strong> <code>' + escapeHtml(item.env_variable) + '</code></p> \
|
||||
<p class="no-margin text-muted small"><strong>Input Rules:</strong> <code>' + escapeHtml(item.rules) + '</code></p> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue