refactor: replace Quill editor with read-only description preview
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Description is managed by portal admin (via CLI/DB), not editable in form. Office manager edits only structured fields (title, date, time, prices, etc). New events still get a plain textarea for initial description. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d687bd3a49
commit
ee61f5876d
@ -3,16 +3,20 @@
|
|||||||
{% block title %}Nowe wydarzenie - Norda Biznes Partner{% endblock %}
|
{% block title %}Nowe wydarzenie - Norda Biznes Partner{% endblock %}
|
||||||
|
|
||||||
{% block extra_css %}
|
{% block extra_css %}
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/quill.snow.css') }}">
|
|
||||||
<style>
|
<style>
|
||||||
.form-container {
|
.form-container {
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quill-container .ql-toolbar { border-radius: var(--radius) var(--radius) 0 0; border-color: var(--border); }
|
.description-preview {
|
||||||
.quill-container .ql-container { border-radius: 0 0 var(--radius) var(--radius); border-color: var(--border); min-height: 150px; font-size: var(--font-size-base); }
|
padding: var(--spacing-md); background: var(--background);
|
||||||
.quill-container .ql-editor { min-height: 150px; }
|
border: 1px solid var(--border); border-radius: var(--radius);
|
||||||
|
font-size: var(--font-size-sm); line-height: 1.6; max-height: 300px; overflow-y: auto;
|
||||||
|
}
|
||||||
|
.description-preview h3 { font-size: 1em; margin: 12px 0 4px; }
|
||||||
|
.description-preview ul, .description-preview ol { padding-left: 20px; margin: 4px 0; }
|
||||||
|
.description-preview p { margin: 4px 0; }
|
||||||
|
|
||||||
.form-header {
|
.form-header {
|
||||||
margin-bottom: var(--spacing-xl);
|
margin-bottom: var(--spacing-xl);
|
||||||
@ -149,10 +153,12 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Opis</label>
|
<label>Opis</label>
|
||||||
<div class="quill-container">
|
{% if event and event.description %}
|
||||||
<div id="quill-editor"></div>
|
<div class="description-preview">{{ event.description|safe }}</div>
|
||||||
</div>
|
<div class="form-hint">Opis wydarzenia jest zarządzany przez administratora portalu. Aby zmienić treść opisu, skontaktuj się z administratorem.</div>
|
||||||
<input type="hidden" id="description" name="description" value="">
|
{% else %}
|
||||||
|
<textarea id="description" name="description" rows="4" placeholder="Opisz co będzie się działo na wydarzeniu..."></textarea>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -286,37 +292,4 @@
|
|||||||
paidCb.addEventListener('change', togglePaid);
|
paidCb.addEventListener('change', togglePaid);
|
||||||
togglePaid();
|
togglePaid();
|
||||||
})();
|
})();
|
||||||
</script>
|
|
||||||
<script src="{{ url_for('static', filename='js/vendor/quill.js') }}"></script>
|
|
||||||
<script>
|
|
||||||
(function() {
|
|
||||||
var quill = new Quill('#quill-editor', {
|
|
||||||
theme: 'snow',
|
|
||||||
placeholder: 'Opisz co będzie się działo na wydarzeniu...',
|
|
||||||
modules: {
|
|
||||||
toolbar: [
|
|
||||||
[{'header': [2, 3, false]}],
|
|
||||||
['bold', 'italic', 'underline'],
|
|
||||||
[{'list': 'ordered'}, {'list': 'bullet'}],
|
|
||||||
['link'],
|
|
||||||
['clean']
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
{% if event and event.description %}
|
|
||||||
quill.clipboard.dangerouslyPasteHTML({{ event.description|tojson }});
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
// Sync Quill content to hidden input on form submit
|
|
||||||
var form = document.querySelector('.form-card form');
|
|
||||||
form.addEventListener('submit', function() {
|
|
||||||
// Read from Quill's getContents and convert back to HTML
|
|
||||||
// to preserve Quill's internal format (lists as class="ql-indent")
|
|
||||||
var html = quill.root.innerHTML;
|
|
||||||
// Don't save empty editor
|
|
||||||
if (html === '<p><br></p>') html = '';
|
|
||||||
document.getElementById('description').value = html;
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user