mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enabled setting raw HTML for email signature
This commit is contained in:
parent
b7ed5e98af
commit
4c1402de4a
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1289,3 +1289,35 @@ function brewerColor(number) {
|
||||
|
||||
return colors[number];
|
||||
}
|
||||
|
||||
// https://gist.github.com/sente/1083506
|
||||
function formatXml(xml) {
|
||||
var formatted = '';
|
||||
var reg = /(>)(<)(\/*)/g;
|
||||
xml = xml.replace(reg, '$1\r\n$2$3');
|
||||
var pad = 0;
|
||||
jQuery.each(xml.split('\r\n'), function(index, node) {
|
||||
var indent = 0;
|
||||
if (node.match( /.+<\/\w[^>]*>$/ )) {
|
||||
indent = 0;
|
||||
} else if (node.match( /^<\/\w/ )) {
|
||||
if (pad != 0) {
|
||||
pad -= 1;
|
||||
}
|
||||
} else if (node.match( /^<\w[^>]*[^\/]>.*$/ )) {
|
||||
indent = 1;
|
||||
} else {
|
||||
indent = 0;
|
||||
}
|
||||
|
||||
var padding = '';
|
||||
for (var i = 0; i < pad; i++) {
|
||||
padding += ' ';
|
||||
}
|
||||
|
||||
formatted += padding + node + '\r\n';
|
||||
pad += indent;
|
||||
});
|
||||
|
||||
return formatted;
|
||||
}
|
||||
|
@ -96,6 +96,9 @@
|
||||
<div class="panel-body">
|
||||
{!! Former::textarea('email_footer')->style('display:none')->raw() !!}
|
||||
<div id="signatureEditor" class="form-control" style="min-height:160px" onclick="focusEditor()"></div>
|
||||
<div class="pull-right" style="padding-top:10px;text-align:right">
|
||||
{!! Button::normal(trans('texts.raw'))->withAttributes(['onclick' => 'showRaw()'])->small() !!}
|
||||
</div>
|
||||
@include('partials/quill_toolbar', ['name' => 'signature'])
|
||||
</div>
|
||||
</div>
|
||||
@ -106,6 +109,30 @@
|
||||
</center>
|
||||
@endif
|
||||
|
||||
<div class="modal fade" id="rawModal" tabindex="-1" role="dialog" aria-labelledby="rawModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="width:800px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="rawModalLabel">{{ trans('texts.raw_html') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||
<div class="panel panel-default">
|
||||
<div class="modal-body">
|
||||
<textarea id="raw-textarea" rows="20" style="width:100%"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }}</button>
|
||||
<button type="button" onclick="updateRaw()" class="btn btn-success" data-dismiss="modal">{{ trans('texts.update') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="designHelpModal" tabindex="-1" role="dialog" aria-labelledby="designHelpModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" style="min-width:150px">
|
||||
<div class="modal-content">
|
||||
@ -171,6 +198,18 @@
|
||||
editor.focus();
|
||||
}
|
||||
|
||||
function showRaw() {
|
||||
var signature = $('#email_footer').val();
|
||||
$('#raw-textarea').val(formatXml(signature));
|
||||
$('#rawModal').modal('show');
|
||||
}
|
||||
|
||||
function updateRaw() {
|
||||
var value = $('#raw-textarea').val();
|
||||
editor.setHTML(value);
|
||||
$('#email_footer').val(value);
|
||||
}
|
||||
|
||||
$('.email_design_id .input-group-addon').click(function() {
|
||||
$('#designHelpModal').modal('show');
|
||||
});
|
||||
|
@ -237,38 +237,6 @@
|
||||
refreshPreview();
|
||||
}
|
||||
|
||||
// https://gist.github.com/sente/1083506
|
||||
function formatXml(xml) {
|
||||
var formatted = '';
|
||||
var reg = /(>)(<)(\/*)/g;
|
||||
xml = xml.replace(reg, '$1\r\n$2$3');
|
||||
var pad = 0;
|
||||
jQuery.each(xml.split('\r\n'), function(index, node) {
|
||||
var indent = 0;
|
||||
if (node.match( /.+<\/\w[^>]*>$/ )) {
|
||||
indent = 0;
|
||||
} else if (node.match( /^<\/\w/ )) {
|
||||
if (pad != 0) {
|
||||
pad -= 1;
|
||||
}
|
||||
} else if (node.match( /^<\w[^>]*[^\/]>.*$/ )) {
|
||||
indent = 1;
|
||||
} else {
|
||||
indent = 0;
|
||||
}
|
||||
|
||||
var padding = '';
|
||||
for (var i = 0; i < pad; i++) {
|
||||
padding += ' ';
|
||||
}
|
||||
|
||||
formatted += padding + node + '\r\n';
|
||||
pad += indent;
|
||||
});
|
||||
|
||||
return formatted;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@include('partials.email_templates')
|
||||
|
Loading…
x
Reference in New Issue
Block a user