forked from UKSOURCE/cms.lams
Refactor the CMS page content system to use a more modular configuration-driven approach. This replaces the monolithic `pageContentConfig.js` with individual configuration files for each page and introduces a shared field utility to standardize editor components. Key changes: - Implement a generic `_renderSingletonPageView` helper to reduce duplication across controllers. - Enhance `_createPageContentController` with `normalizeForEditor`, `normalizeForApi`, and `preparePayload` hooks for custom data transformation. - Create dedicated configuration and view structures for Partnerships, History, Accreditation, Admissions, and Policies pages. - Add a specialized section editor for Policies to manage complex nested content. - Improve the frontend `page-content-editor.js` with support for visibility logic, auto-sequencing for arrays, and URL synchronization for active tabs. - Update data JSON files to align with the new schema.
69 lines
2.5 KiB
Plaintext
69 lines
2.5 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/process-tab", { activeTab }) %>
|
|
<%- include("partials/eligibility-tab", { activeTab }) %>
|
|
<%- include("partials/tuition-tab", { activeTab }) %>
|
|
<%- include("partials/key-dates-tab", { activeTab }) %>
|
|
<%- include("partials/calculator-tab", { activeTab }) %>
|
|
<%- include("partials/scholarships-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>
|
|
window.pageEditorConfig = <%- JSON.stringify(editorConfig) %>;
|
|
window.pageEditorData = <%- JSON.stringify(data) %>;
|
|
window.pageEditorBackendUrl = <%- JSON.stringify(backendUrl) %>;
|
|
</script>
|
|
<%- include("partials/editor-script") %>
|
|
|
|
|
|
|
|
|