Add layout designer and welcome page templates with embed support
- Introduced a new layout designer page template that supports an embeddable mode for integration within iframes in external applications. This includes hiding CMS navigation and sending postMessage events to the parent window. - Added a new welcome page template that serves as an onboarding guide for users, featuring step-by-step instructions for connecting displays, uploading content, designing layouts, and scheduling content. - Included CSS styles for both templates to enhance the user interface and experience. - Implemented JavaScript functionality for live statistics on the welcome page, fetching counts for displays, media files, layouts, and schedules.
This commit is contained in:
648
ots-signs/views/welcome-page.twig
Normal file
648
ots-signs/views/welcome-page.twig
Normal file
@@ -0,0 +1,648 @@
|
||||
{#
|
||||
/**
|
||||
* Copyright (C) 2026 OTS Signs
|
||||
*
|
||||
* Welcome / onboarding page for OTS Signs.
|
||||
*
|
||||
* Overrides Xibo's default welcome-page.twig. All cards are rendered
|
||||
* server-side in Twig — no dependency on the Xibo compiled JS bundle.
|
||||
* Inline JS populates live stat counts via the existing fetchCount pattern.
|
||||
*/
|
||||
#}
|
||||
{% extends "authed.twig" %}
|
||||
|
||||
{% block title %}{{ "Welcome"|trans }} | {% endblock %}
|
||||
|
||||
{% block pageContent %}
|
||||
<style nonce="{{ cspNonce }}">
|
||||
/* ── Welcome page layout ─────────────────────────────────────────────── */
|
||||
.ots-welcome-page {
|
||||
padding: 24px 32px 48px;
|
||||
max-width: 1100px;
|
||||
}
|
||||
|
||||
/* ── Hero ────────────────────────────────────────────────────────────── */
|
||||
.ots-welcome-hero {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
padding: 40px 48px;
|
||||
background: linear-gradient(135deg, var(--color-surface) 0%, #162035 100%);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 16px;
|
||||
margin-bottom: 40px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ots-welcome-hero::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
right: -60px;
|
||||
width: 280px;
|
||||
height: 280px;
|
||||
background: radial-gradient(circle, rgba(232, 120, 0, 0.12) 0%, transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-text h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-text-primary);
|
||||
margin: 0 0 12px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-text h1 span {
|
||||
color: #e87800;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-text p {
|
||||
font-size: 1rem;
|
||||
color: var(--color-text-tertiary);
|
||||
margin: 0 0 24px;
|
||||
max-width: 520px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ots-welcome-btn-primary {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 20px;
|
||||
background: #e87800;
|
||||
color: #fff;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
transition: background 0.15s, transform 0.1s;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.ots-welcome-btn-primary:hover,
|
||||
.ots-welcome-btn-primary:focus {
|
||||
background: #c96800;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.ots-welcome-btn-secondary {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 20px;
|
||||
background: transparent;
|
||||
color: var(--color-text-secondary);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
.ots-welcome-btn-secondary:hover,
|
||||
.ots-welcome-btn-secondary:focus {
|
||||
border-color: #e87800;
|
||||
color: #e87800;
|
||||
background: rgba(232, 120, 0, 0.06);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-icon {
|
||||
flex-shrink: 0;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(232, 120, 0, 0.1);
|
||||
border: 1px solid rgba(232, 120, 0, 0.2);
|
||||
border-radius: 24px;
|
||||
color: #e87800;
|
||||
font-size: 64px;
|
||||
}
|
||||
|
||||
/* ── Section heading ─────────────────────────────────────────────────── */
|
||||
.ots-welcome-section-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-tertiary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
/* ── Step cards ──────────────────────────────────────────────────────── */
|
||||
.ots-welcome-steps {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.ots-welcome-step-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 24px;
|
||||
padding: 24px 28px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 12px;
|
||||
margin-bottom: 16px;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ots-welcome-step-card:hover {
|
||||
border-color: rgba(232, 120, 0, 0.35);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.ots-step-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ots-step-num {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-surface-elevated);
|
||||
border: 1px solid var(--color-border);
|
||||
color: var(--color-text-tertiary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ots-step-icon {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 22px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ots-step-icon--green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
|
||||
.ots-step-icon--blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
|
||||
.ots-step-icon--purple { background: rgba(124, 58, 237, 0.15); color: #7c3aed; }
|
||||
.ots-step-icon--orange { background: rgba(232, 120, 0, 0.15); color: #e87800; }
|
||||
|
||||
.ots-step-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ots-step-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-primary);
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.ots-step-desc {
|
||||
font-size: 14px;
|
||||
color: var(--color-text-tertiary);
|
||||
margin: 0 0 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ots-step-links {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ots-step-links a {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
padding: 5px 12px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.ots-step-link-primary {
|
||||
background: rgba(232, 120, 0, 0.15);
|
||||
color: #e87800;
|
||||
border: 1px solid rgba(232, 120, 0, 0.25);
|
||||
}
|
||||
|
||||
.ots-step-link-primary:hover,
|
||||
.ots-step-link-primary:focus {
|
||||
background: rgba(232, 120, 0, 0.25);
|
||||
color: #e87800;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ots-step-link-secondary {
|
||||
color: var(--color-text-tertiary);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.ots-step-link-secondary:hover,
|
||||
.ots-step-link-secondary:focus {
|
||||
color: var(--color-text-secondary);
|
||||
border-color: var(--color-text-tertiary);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ots-step-stat {
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
padding-left: 16px;
|
||||
min-width: 64px;
|
||||
}
|
||||
|
||||
.ots-step-stat-num {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-text-primary);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ots-step-stat-label {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-tertiary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
/* ── Resource cards ──────────────────────────────────────────────────── */
|
||||
.ots-welcome-resources {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.ots-welcome-resource-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 16px;
|
||||
padding: 20px 22px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 12px;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.ots-welcome-resource-card:hover {
|
||||
border-color: rgba(232, 120, 0, 0.35);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.ots-resource-icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 10px;
|
||||
background: rgba(232, 120, 0, 0.12);
|
||||
color: #e87800;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ots-resource-body {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ots-resource-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-primary);
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.ots-resource-desc {
|
||||
font-size: 13px;
|
||||
color: var(--color-text-tertiary);
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* ── Light mode overrides ────────────────────────────────────────────── */
|
||||
.ots-light-mode .ots-welcome-hero {
|
||||
background: linear-gradient(135deg, #f8fafc 0%, #f0f6ff 100%);
|
||||
border-color: #e2e8f0;
|
||||
}
|
||||
|
||||
.ots-light-mode .ots-welcome-step-card,
|
||||
.ots-light-mode .ots-welcome-resource-card {
|
||||
background: #fff;
|
||||
border-color: #e2e8f0;
|
||||
}
|
||||
|
||||
.ots-light-mode .ots-step-num {
|
||||
background: #f1f5f9;
|
||||
border-color: #e2e8f0;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
/* ── Responsive ──────────────────────────────────────────────────────── */
|
||||
@media (max-width: 768px) {
|
||||
.ots-welcome-page {
|
||||
padding: 16px 16px 40px;
|
||||
}
|
||||
|
||||
.ots-welcome-hero {
|
||||
flex-direction: column;
|
||||
padding: 28px 24px;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
font-size: 36px;
|
||||
border-radius: 16px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.ots-welcome-hero-text h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.ots-welcome-step-card {
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.ots-step-stat {
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
padding-left: 0;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid var(--color-border);
|
||||
flex-direction: row;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ots-welcome-resources {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="ots-welcome-page">
|
||||
|
||||
{# ── Hero ─────────────────────────────────────────────────────────── #}
|
||||
{% set productName = theme.getThemeConfig('theme_title') %}
|
||||
<div class="ots-welcome-hero">
|
||||
<div class="ots-welcome-hero-text">
|
||||
<h1>{% trans %}Welcome to <span>{{ productName }}</span>{% endtrans %}</h1>
|
||||
<p>{% trans %}Your digital signage control centre. Connect your displays, upload content, design layouts, and schedule what plays — all from one place.{% endtrans %}</p>
|
||||
<div class="ots-welcome-hero-actions">
|
||||
<a href="{{ helpService.getLandingPage() }}" target="_blank" rel="noopener noreferrer" class="ots-welcome-btn-primary">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
{% trans "View Documentation" %}
|
||||
</a>
|
||||
<a href="{{ url_for("home") }}" class="ots-welcome-btn-secondary">
|
||||
<i class="fa fa-th-large" aria-hidden="true"></i>
|
||||
{% trans "Go to Dashboard" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-welcome-hero-icon" aria-hidden="true">
|
||||
<i class="fa fa-tv"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# ── Get Started steps ────────────────────────────────────────────── #}
|
||||
<div class="ots-welcome-steps">
|
||||
<p class="ots-welcome-section-title">{% trans "Get Started" %}</p>
|
||||
|
||||
{% if currentUser.featureEnabled("displays.view") %}
|
||||
<div class="ots-welcome-step-card">
|
||||
<div class="ots-step-left">
|
||||
<div class="ots-step-num">1</div>
|
||||
<div class="ots-step-icon ots-step-icon--green">
|
||||
<i class="fa fa-desktop" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-body">
|
||||
<div class="ots-step-title">{% trans "Connect a Display" %}</div>
|
||||
<p class="ots-step-desc">{% trans %}Install the player app on a screen, then authorise it here. Once connected, your display is ready to receive scheduled content.{% endtrans %}</p>
|
||||
<div class="ots-step-links">
|
||||
<a href="{{ url_for("display.view") }}" class="ots-step-link-primary">
|
||||
<i class="fa fa-arrow-right" aria-hidden="true"></i> {% trans "Manage Displays" %}
|
||||
</a>
|
||||
<a href="{{ helpService.getLandingPage() }}displays.html" target="_blank" rel="noopener noreferrer" class="ots-step-link-secondary">
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i> {% trans "Displays Guide" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-stat">
|
||||
<span class="ots-step-stat-num" id="ots-wc-stat-displays">—</span>
|
||||
<span class="ots-step-stat-label">{% trans "Displays" %}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if currentUser.featureEnabled("library.view") %}
|
||||
<div class="ots-welcome-step-card">
|
||||
<div class="ots-step-left">
|
||||
<div class="ots-step-num">2</div>
|
||||
<div class="ots-step-icon ots-step-icon--blue">
|
||||
<i class="fa fa-image" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-body">
|
||||
<div class="ots-step-title">{% trans "Upload Content" %}</div>
|
||||
<p class="ots-step-desc">{% trans %}Add images, videos, and other media files to your library. Supported formats include JPEG, PNG, MP4 and more.{% endtrans %}</p>
|
||||
<div class="ots-step-links">
|
||||
<a href="{{ url_for("library.view") }}" class="ots-step-link-primary">
|
||||
<i class="fa fa-arrow-right" aria-hidden="true"></i> {% trans "Open Library" %}
|
||||
</a>
|
||||
<a href="{{ helpService.getLandingPage() }}media_library.html" target="_blank" rel="noopener noreferrer" class="ots-step-link-secondary">
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i> {% trans "Library Guide" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-stat">
|
||||
<span class="ots-step-stat-num" id="ots-wc-stat-media">—</span>
|
||||
<span class="ots-step-stat-label">{% trans "Media Files" %}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if currentUser.featureEnabled("layout.view") %}
|
||||
<div class="ots-welcome-step-card">
|
||||
<div class="ots-step-left">
|
||||
<div class="ots-step-num">3</div>
|
||||
<div class="ots-step-icon ots-step-icon--purple">
|
||||
<i class="fa fa-columns" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-body">
|
||||
<div class="ots-step-title">{% trans "Design a Layout" %}</div>
|
||||
<p class="ots-step-desc">{% trans %}Create multi-zone screen layouts using the visual editor. Combine images, videos, text, and data widgets into a polished design.{% endtrans %}</p>
|
||||
<div class="ots-step-links">
|
||||
<a href="{{ url_for("layout.view") }}" class="ots-step-link-primary">
|
||||
<i class="fa fa-arrow-right" aria-hidden="true"></i> {% trans "Manage Layouts" %}
|
||||
</a>
|
||||
<a href="{{ helpService.getLandingPage() }}layouts_editor.html" target="_blank" rel="noopener noreferrer" class="ots-step-link-secondary">
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i> {% trans "Layout Editor Guide" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-stat">
|
||||
<span class="ots-step-stat-num" id="ots-wc-stat-layouts">—</span>
|
||||
<span class="ots-step-stat-label">{% trans "Layouts" %}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if currentUser.featureEnabled("schedule.view") %}
|
||||
<div class="ots-welcome-step-card">
|
||||
<div class="ots-step-left">
|
||||
<div class="ots-step-num">4</div>
|
||||
<div class="ots-step-icon ots-step-icon--orange">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-body">
|
||||
<div class="ots-step-title">{% trans "Schedule Content" %}</div>
|
||||
<p class="ots-step-desc">{% trans %}Assign layouts and campaigns to displays on a timed schedule. Set start and end times, repeat rules, and priorities.{% endtrans %}</p>
|
||||
<div class="ots-step-links">
|
||||
<a href="{{ url_for("schedule.view") }}" class="ots-step-link-primary">
|
||||
<i class="fa fa-arrow-right" aria-hidden="true"></i> {% trans "Open Schedule" %}
|
||||
</a>
|
||||
<a href="{{ helpService.getLandingPage() }}displays_configuration.html" target="_blank" rel="noopener noreferrer" class="ots-step-link-secondary">
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i> {% trans "Scheduling Guide" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ots-step-stat">
|
||||
<span class="ots-step-stat-num" id="ots-wc-stat-schedules">—</span>
|
||||
<span class="ots-step-stat-label">{% trans "Schedules" %}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>{# /ots-welcome-steps #}
|
||||
|
||||
{# ── Resources ────────────────────────────────────────────────────── #}
|
||||
<p class="ots-welcome-section-title">{% trans "Resources" %}</p>
|
||||
<div class="ots-welcome-resources">
|
||||
|
||||
<a href="{{ helpService.getLandingPage() }}" target="_blank" rel="noopener noreferrer" class="ots-welcome-resource-card">
|
||||
<div class="ots-resource-icon" aria-hidden="true">
|
||||
<i class="fa fa-book"></i>
|
||||
</div>
|
||||
<div class="ots-resource-body">
|
||||
<div class="ots-resource-title">{% trans "User Manual" %}</div>
|
||||
<p class="ots-resource-desc">{% trans "Step-by-step guides for every feature in OTS Signs." %}</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="{{ theme.getSetting('SUPPORT_ADDRESS', 'https://ots-signs.com/support') }}" target="_blank" rel="noopener noreferrer" class="ots-welcome-resource-card">
|
||||
<div class="ots-resource-icon" aria-hidden="true">
|
||||
<i class="fa fa-life-ring"></i>
|
||||
</div>
|
||||
<div class="ots-resource-body">
|
||||
<div class="ots-resource-title">{% trans "Support" %}</div>
|
||||
<p class="ots-resource-desc">{% trans "Get help from the OTS Signs support team." %}</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
{% if currentUser.isSuperAdmin() %}
|
||||
<a href="{{ url_for("settings") }}" class="ots-welcome-resource-card">
|
||||
<div class="ots-resource-icon" aria-hidden="true">
|
||||
<i class="fa fa-cog"></i>
|
||||
</div>
|
||||
<div class="ots-resource-body">
|
||||
<div class="ots-resource-title">{% trans "CMS Settings" %}</div>
|
||||
<p class="ots-resource-desc">{% trans "Configure your CMS installation and storage options." %}</p>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
</div>{# /ots-welcome-resources #}
|
||||
|
||||
</div>{# /ots-welcome-page #}
|
||||
{% endblock %}
|
||||
|
||||
{% block javaScript %}
|
||||
<script type="text/javascript" nonce="{{ cspNonce }}">
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var $ = window.jQuery;
|
||||
if (!$) return;
|
||||
|
||||
function fetchCount(url, elId) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
data: { start: 0, length: 1 },
|
||||
success: function (resp) {
|
||||
var count = 0;
|
||||
if (resp && typeof resp.recordsTotal !== 'undefined') {
|
||||
count = resp.recordsTotal;
|
||||
} else if (resp && Array.isArray(resp.data)) {
|
||||
count = resp.data.length;
|
||||
} else if (resp && typeof resp.total !== 'undefined') {
|
||||
count = resp.total;
|
||||
}
|
||||
var el = document.getElementById(elId);
|
||||
if (el) el.textContent = count.toLocaleString();
|
||||
},
|
||||
error: function () {
|
||||
var el = document.getElementById(elId);
|
||||
if (el) el.textContent = '—';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
{% if currentUser.featureEnabled("displays.view") %}
|
||||
fetchCount('{{ url_for("display.search") }}', 'ots-wc-stat-displays');
|
||||
{% endif %}
|
||||
{% if currentUser.featureEnabled("library.view") %}
|
||||
fetchCount('{{ url_for("library.search") }}', 'ots-wc-stat-media');
|
||||
{% endif %}
|
||||
{% if currentUser.featureEnabled("layout.view") %}
|
||||
fetchCount('{{ url_for("layout.search") }}', 'ots-wc-stat-layouts');
|
||||
{% endif %}
|
||||
{% if currentUser.featureEnabled("schedule.view") %}
|
||||
fetchCount('{{ url_for("schedule.search") }}', 'ots-wc-stat-schedules');
|
||||
{% endif %}
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user