forked from UKSOURCE/cms.lams
Replace the legacy section-based policy editor with a flexible block-based system. This transition enables real-time previews, a wider variety of content types (headings, quotes, callouts), and improved data normalization. - Implement `policies-block-editor.js` for dynamic content management - Add `normalizePoliciesDocument` and `validateContent` utilities to handle data migration and integrity - Update `policiesController.js` to support the new block structure and validation logic - Migrate `policies.json` from `sections` array to a `content.blocks` structure - Remove obsolete section editor views and partials - Update `policiesConfig.js` to reflect the new editor capabilities
63 lines
2.4 KiB
Plaintext
63 lines
2.4 KiB
Plaintext
<div class="container">
|
|
<div class="d-flex justify-content-between align-items-center mt-4 mb-4">
|
|
<div>
|
|
<h1 class="h3 mb-0" style="color: var(--primary-dark)"><%= title %></h1>
|
|
<p class="text-muted mb-0"><%= subtitle %></p>
|
|
</div>
|
|
<div>
|
|
<a href="<%= previewUrl %>" class="btn btn-outline-primary" target="_blank">
|
|
<i class="fas fa-external-link-alt me-2"></i>View Page
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<form action="<%= editorConfig.routeBase %>/update" method="POST" id="cmsEditorForm" class="content-with-fixed-buttons" novalidate>
|
|
<input type="hidden" name="pageJson" id="pageJson" />
|
|
<input type="hidden" name="activeTab" id="activeTabInput" value="<%= activeTab %>" />
|
|
|
|
<div class="card shadow-sm border-0 mb-4">
|
|
<div class="card-header bg-white border-bottom">
|
|
<ul class="nav nav-tabs card-header-tabs" role="tablist">
|
|
<% editorConfig.tabs.forEach((tab) => { %>
|
|
<li class="nav-item">
|
|
<a class="nav-link <%= activeTab === tab.key ? 'active' : '' %>" data-bs-toggle="tab" href="#<%= tab.key %>" role="tab" data-tab-key="<%= tab.key %>">
|
|
<i class="<%= tab.icon %> me-2"></i><%= tab.label %>
|
|
</a>
|
|
</li>
|
|
<% }) %>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="tab-content">
|
|
<%- include("partials/hero-tab", { activeTab }) %>
|
|
<%- include("partials/sidebar-tab", { activeTab }) %>
|
|
<%- include("partials/policies-tab", { activeTab }) %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="fixed-bottom-buttons">
|
|
<button type="reset" class="btn btn-secondary">
|
|
<i class="fas fa-undo"></i>
|
|
<span>Reset</span>
|
|
</button>
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="fas fa-save"></i>
|
|
<span>Save Changes</span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="application/json" id="pageEditorConfigData"><%- JSON.stringify(editorConfig) %></script>
|
|
<script type="application/json" id="pageEditorDataPayload"><%- JSON.stringify(data) %></script>
|
|
<script type="application/json" id="pageEditorBackendUrlData"><%- JSON.stringify(backendUrl) %></script>
|
|
<%- include("partials/editor-script") %>
|
|
|
|
|
|
|
|
|