mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-19 22:42:17 +00:00
Merge branch 'md-pretty-editor' into markdown
This commit is contained in:
@@ -36,6 +36,16 @@ function updatePrices() {
|
||||
$('#total').text(parseFloat(sum + vat).toFixed(2));
|
||||
}
|
||||
|
||||
function setupMDE(selector) {
|
||||
editor = new SimpleMDE({
|
||||
element: $(selector)[0],
|
||||
forceSync: true,
|
||||
toolbar: ["bold", "italic", "strikethrough", "|", "unordered-list", "ordered-list", "|", "link", "|", "preview", "guide"],
|
||||
status: true,
|
||||
});
|
||||
$(selector).data('mde_editor',editor);
|
||||
}
|
||||
|
||||
$('#item-table').on('click', '.item-delete', function () {
|
||||
delete objectitems[$(this).data('pk')]
|
||||
$('#item-' + $(this).data('pk')).remove();
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{% static "css/bootstrap-select.min.css" %}"/>
|
||||
<link rel="stylesheet" href="{% static "css/ajax-bootstrap-select.css" %}"/>
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block preload_js %}
|
||||
<script src="{% static "js/bootstrap-select.js" %}"></script>
|
||||
<script src="{% static "js/ajax-bootstrap-select.js" %}"></script>
|
||||
<script src="//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
@@ -40,6 +42,17 @@
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
setupMDE('#id_description');
|
||||
setupMDE('#id_notes');
|
||||
setupMDE('#item_description');
|
||||
|
||||
$('#itemModal').on('shown.bs.modal', function (e) {
|
||||
$('#item_description').data('mde_editor').value(
|
||||
$('#item_description').val()
|
||||
);
|
||||
});
|
||||
|
||||
{% if not object.pk and not form.errors %}
|
||||
|
||||
$('.form-hws').slideUp(function () {
|
||||
@@ -228,11 +241,8 @@
|
||||
<div class="panel-heading">Event Description</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group" data-toggle="tooltip" title="A short description of the event, shown on rigboard and on paperwork. MD enabled.">
|
||||
<label for="{{ form.description.id_for_label }}"
|
||||
class="col-sm-4 control-label">{{ form.description.label }}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
{% render_field form.description class+="form-control" %}
|
||||
<div class="col-sm-12">
|
||||
{% render_field form.description class+="form-control md-enabled" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -427,7 +437,7 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group" data-toggle="tooltip" title="Notes on the event. This is only visible to keyholders, and is not displayed on the paperwork. MD enabled.">
|
||||
<label for="{{ form.notes.id_for_label }}">{{ form.notes.label }}</label>
|
||||
{% render_field form.notes class+="form-control" %}
|
||||
{% render_field form.notes class+="form-control md-enabled" %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "RIGS/item_table.html" %}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<label for="item_description" class="col-sm-2 control-label">Description</label>
|
||||
|
||||
<div class="col-sm-10">
|
||||
<textarea type="text" placeholder="Description" class="form-control"
|
||||
<textarea type="text" placeholder="Description" class="form-control md-enabled"
|
||||
id="item_description" rows="8"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user