Add Django site, Docker packaging, and beta/prod Gitea deploys.
Unignore site/ (was blocked by mkdocs /site rule), add compose/Docker/uv tooling, and split deploys so push to main goes to beta while prod stays manual.
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
{% extends "portal_base.html" %}
|
||||
{% block title %}Social accounts · Portal{% endblock %}
|
||||
{% block topbar_title %}Social accounts{% endblock %}
|
||||
{% block portal_content %}
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Add account</h2></div>
|
||||
<div class="panel-b">
|
||||
<div class="connect-grid">
|
||||
<button type="button" class="connect-card" disabled>
|
||||
<span class="platform-icon meta">f</span>
|
||||
<div>
|
||||
<strong>Facebook Page</strong>
|
||||
<p>Connect a Page you manage. OAuth wiring comes next.</p>
|
||||
</div>
|
||||
</button>
|
||||
<button type="button" class="connect-card" disabled>
|
||||
<span class="platform-icon ig">IG</span>
|
||||
<div>
|
||||
<strong>Instagram Business</strong>
|
||||
<p>Requires a Facebook Page linked to an IG business account.</p>
|
||||
</div>
|
||||
</button>
|
||||
<button type="button" class="connect-card" disabled>
|
||||
<span class="platform-icon li">in</span>
|
||||
<div>
|
||||
<strong>LinkedIn</strong>
|
||||
<p>Personal or organization page. Tokens expire — re-auth when prompted.</p>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Connected accounts</h2></div>
|
||||
<div class="panel-b" style="padding:0">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Account</th>
|
||||
<th>Platform</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for account in accounts %}
|
||||
<tr {% if not account.is_active %}class="row-warn"{% endif %}>
|
||||
<td>
|
||||
<strong>{{ account.label }}</strong><br>
|
||||
<span class="muted">{{ account.external_id }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="platform-pill {% if account.platform == 'facebook' %}meta{% elif account.platform == 'instagram' %}ig{% else %}li{% endif %}">
|
||||
{{ account.get_platform_display }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{% if account.is_active %}
|
||||
<span class="badge badge-delivered">Active</span>
|
||||
{% else %}
|
||||
<span class="badge badge-failed">Inactive</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="muted">Connect / disconnect in functionality pass</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="4" class="empty-state">No accounts connected yet.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split">
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>When to re-auth</h2></div>
|
||||
<div class="panel-b">
|
||||
<ul class="plain-list">
|
||||
<li>LinkedIn access tokens expire on a short cycle</li>
|
||||
<li>Meta password changes or app review updates</li>
|
||||
<li>Publishing fails with an auth error</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Health checks</h2></div>
|
||||
<div class="panel-b">
|
||||
<p class="muted">Token test buttons wire up with the connectors next.</p>
|
||||
<a class="btn btn-ghost btn-sm" href="{% url 'social:composer' %}">Open composer →</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,285 @@
|
||||
{% extends "portal_base.html" %}
|
||||
{% load static %}
|
||||
{% block title %}Compose · Social{% endblock %}
|
||||
{% block topbar_title %}Compose & preview{% endblock %}
|
||||
{% block portal_content %}
|
||||
<div class="auth-alert" id="li-warn">
|
||||
<strong>LinkedIn needs re-auth.</strong> Token expired —
|
||||
<a href="{% url 'social:account_list' %}">Re-authorize in Accounts</a> before scheduling to LinkedIn.
|
||||
</div>
|
||||
|
||||
<div class="designer-layout with-ai">
|
||||
<div class="designer-controls">
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Compose</h2><a class="btn btn-sm btn-ghost" href="{% url 'social:account_list' %}">Manage accounts</a></div>
|
||||
<div class="panel-b form-grid">
|
||||
<div class="field"><label>Caption</label>
|
||||
<textarea id="soc-caption" style="min-height:130px" oninput="syncSocial()">Open house this Saturday 11–1 at 412 Willow Lane. Quiet street, updated kitchen, walkable to Oakridge. DM or text me for details.
|
||||
|
||||
#JustListed #OpenHouse</textarea>
|
||||
<div class="hint"><span id="char-count">0</span> characters · IG soft limit ~2,200</div>
|
||||
</div>
|
||||
<div class="field"><label>Media</label>
|
||||
<select id="soc-media" onchange="syncSocial()">
|
||||
<option value="{% static "images/grid-layout-1-370x256.jpg" %}">Willow Lane exterior</option>
|
||||
<option value="{% static "images/grid-layout-2-370x256.jpg" %}">Kitchen</option>
|
||||
<option value="{% static "images/grid-layout-3-370x256.jpg" %}">Living room</option>
|
||||
<option value="">Text only (FB / LI)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field"><label>Platforms</label>
|
||||
<div class="platform-toggles">
|
||||
<label class="toggle-pill"><input type="checkbox" id="plat-fb" checked onchange="syncSocial()"> Facebook</label>
|
||||
<label class="toggle-pill"><input type="checkbox" id="plat-ig" checked onchange="syncSocial()"> Instagram</label>
|
||||
<label class="toggle-pill warn"><input type="checkbox" id="plat-li" onchange="syncSocial()"> LinkedIn <span class="muted">(re-auth)</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid cols-2">
|
||||
<div class="field"><label>Publish</label>
|
||||
<select id="soc-when-mode"><option>Schedule</option><option>Publish now</option></select>
|
||||
</div>
|
||||
<div class="field"><label>When</label><input type="datetime-local" value="2026-07-16T09:00"></div>
|
||||
</div>
|
||||
<div class="field"><label>Preview as</label>
|
||||
<div class="channel-tabs" style="margin:0">
|
||||
<a href="#" class="active" id="prev-fb" onclick="setPreview('fb');return false">Facebook</a>
|
||||
<a href="#" id="prev-ig" onclick="setPreview('ig');return false">Instagram</a>
|
||||
<a href="#" id="prev-li" onclick="setPreview('li');return false">LinkedIn</a>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary" type="button" onclick="alert('Mockup: SocialPost + SocialPostTargets enqueued')">Schedule to selected platforms</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ai-assist-col">
|
||||
<div class="ai-chat">
|
||||
<div class="ai-chat-h">
|
||||
<h2>AI post assistant</h2>
|
||||
<span class="ai-pill">Beta mockup</span>
|
||||
</div>
|
||||
<div class="ai-chat-messages" id="ai-messages">
|
||||
<div class="ai-msg bot">
|
||||
<div class="who">Assistant</div>
|
||||
<div class="bubble">
|
||||
I can draft or refine captions for Facebook, Instagram, and LinkedIn.
|
||||
Tell me the listing, tone (warm / bold / luxury), and any must-include details —
|
||||
or tap a quick prompt below.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-chat-prompts">
|
||||
<button type="button" class="chip" onclick="sendPrompt('Write an open-house post for 412 Willow Lane')">Open house draft</button>
|
||||
<button type="button" class="chip" onclick="sendPrompt('Make my caption shorter for Instagram')">Shorter for IG</button>
|
||||
<button type="button" class="chip" onclick="sendPrompt('Rewrite in a warmer, neighborly tone')">Warmer tone</button>
|
||||
<button type="button" class="chip" onclick="sendPrompt('Add 4 relevant hashtags')">Add hashtags</button>
|
||||
<button type="button" class="chip" onclick="sendPrompt('Make a LinkedIn-friendly professional version')">LinkedIn version</button>
|
||||
</div>
|
||||
<div class="ai-chat-input">
|
||||
<textarea id="ai-input" placeholder="Ask for a draft, rewrite, or hashtags…" rows="2"
|
||||
onkeydown="if(event.key==='Enter'&&!event.shiftKey){event.preventDefault();sendChat();}"></textarea>
|
||||
<button class="btn btn-primary" type="button" onclick="sendChat()">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="designer-preview-col">
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Live post preview</h2><span class="muted" style="font-size:12px" id="prev-label">Facebook</span></div>
|
||||
<div class="panel-b" style="background:#e8edf3;display:flex;justify-content:center;padding:24px">
|
||||
<div class="social-phone" id="preview-fb">
|
||||
<div class="soc-header">
|
||||
<div class="soc-avatar">MR</div>
|
||||
<div>
|
||||
<div class="soc-name">Monica Dhillon · MKDRealtor.com</div>
|
||||
<div class="soc-meta">Sponsored · Just now · 🌐</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="soc-caption" id="fb-caption"></div>
|
||||
<div class="soc-image" id="fb-image"></div>
|
||||
<div class="soc-actions">Like · Comment · Share</div>
|
||||
</div>
|
||||
<div class="social-phone ig" id="preview-ig" style="display:none">
|
||||
<div class="soc-header">
|
||||
<div class="soc-avatar round">MR</div>
|
||||
<div>
|
||||
<div class="soc-name">monicadhillonhomes</div>
|
||||
<div class="soc-meta">Metro Area</div>
|
||||
</div>
|
||||
<div class="soc-more">•••</div>
|
||||
</div>
|
||||
<div class="soc-image square" id="ig-image"></div>
|
||||
<div class="soc-actions ig-act">♥ 💬 ✉</div>
|
||||
<div class="soc-caption"><strong>monicadhillonhomes</strong> <span id="ig-caption"></span></div>
|
||||
</div>
|
||||
<div class="social-phone li" id="preview-li" style="display:none">
|
||||
<div class="soc-header">
|
||||
<div class="soc-avatar sq">MR</div>
|
||||
<div>
|
||||
<div class="soc-name">Monica Dhillon</div>
|
||||
<div class="soc-meta">Realtor · 1st · Just now</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="soc-caption" id="li-caption"></div>
|
||||
<div class="soc-image" id="li-image"></div>
|
||||
<div class="soc-actions">Like · Comment · Repost · Send</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Scheduled</h2></div>
|
||||
<div class="panel-b" style="padding:0">
|
||||
<table class="table">
|
||||
<thead><tr><th>Post</th><th>Platforms</th><th>Status</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Open house Willow Lane</td><td>FB · IG</td><td><span class="badge badge-scheduled">Scheduled</span></td></tr>
|
||||
<tr><td>Just sold — Birch Ave</td><td>FB · IG · LI</td><td><span class="badge badge-delivered">Published</span></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" style="margin-top:20px">
|
||||
<div class="panel-h"><h2>Save draft (server)</h2></div>
|
||||
<div class="panel-b form-grid">
|
||||
{% if error %}<ul class="portal-flash"><li class="error">{{ error }}</li></ul>{% endif %}
|
||||
{% if saved %}<ul class="portal-flash"><li>Saved draft <a href="{% url 'social:post_detail' saved.pk %}">{{ saved.pk }}</a></li></ul>{% endif %}
|
||||
<form method="post" class="form-grid">
|
||||
{% csrf_token %}
|
||||
<div class="field"><label>AI prompt (optional)</label><textarea name="prompt">{{ prompt }}</textarea></div>
|
||||
<div class="field"><label>Platform hint</label>
|
||||
<select name="platform">
|
||||
<option value="">Any</option>
|
||||
<option value="facebook">Facebook</option>
|
||||
<option value="instagram">Instagram</option>
|
||||
<option value="linkedin">LinkedIn</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field"><label>Body</label><textarea name="body" style="min-height:100px">{{ draft }}</textarea></div>
|
||||
<div style="display:flex;gap:8px;flex-wrap:wrap">
|
||||
<button class="btn btn-ghost" type="submit" name="action" value="generate">Generate draft</button>
|
||||
<button class="btn btn-primary" type="submit" name="action" value="save">Save draft</button>
|
||||
<a class="btn btn-ghost" href="{% url 'social:post_list' %}">Scheduled / drafts</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block extra_js %}
|
||||
<script>
|
||||
|
||||
let previewPlat = 'fb';
|
||||
let lastDraft = '';
|
||||
|
||||
function setPreview(p) {
|
||||
previewPlat = p;
|
||||
['fb','ig','li'].forEach(x => {
|
||||
document.getElementById('preview-' + x).style.display = x === p ? 'block' : 'none';
|
||||
document.getElementById('prev-' + x).classList.toggle('active', x === p);
|
||||
});
|
||||
document.getElementById('prev-label').textContent = ({fb:'Facebook',ig:'Instagram',li:'LinkedIn'})[p];
|
||||
}
|
||||
|
||||
function syncSocial() {
|
||||
const cap = document.getElementById('soc-caption').value;
|
||||
const media = document.getElementById('soc-media').value;
|
||||
document.getElementById('char-count').textContent = cap.length;
|
||||
document.getElementById('fb-caption').textContent = cap;
|
||||
document.getElementById('ig-caption').textContent = cap;
|
||||
document.getElementById('li-caption').textContent = cap;
|
||||
['fb','ig','li'].forEach(x => {
|
||||
const el = document.getElementById(x + '-image');
|
||||
if (!media) { el.style.display = 'none'; }
|
||||
else { el.style.display = 'block'; el.style.backgroundImage = 'url(' + media + ')'; }
|
||||
});
|
||||
document.getElementById('li-warn').style.display = document.getElementById('plat-li').checked ? 'block' : 'none';
|
||||
}
|
||||
|
||||
function escapeHtml(s) {
|
||||
return String(s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
}
|
||||
|
||||
function appendMsg(role, html) {
|
||||
const root = document.getElementById('ai-messages');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'ai-msg ' + role;
|
||||
div.innerHTML =
|
||||
'<div class="who">' + (role === 'user' ? 'You' : 'Assistant') + '</div>' +
|
||||
'<div class="bubble">' + html + '</div>';
|
||||
root.appendChild(div);
|
||||
root.scrollTop = root.scrollHeight;
|
||||
}
|
||||
|
||||
function draftActions(draft) {
|
||||
lastDraft = draft;
|
||||
const id = 'draft-' + Date.now();
|
||||
return (
|
||||
'<div class="ai-draft" id="' + id + '">' + escapeHtml(draft) + '</div>' +
|
||||
'<div class="ai-msg-actions">' +
|
||||
'<button type="button" class="btn btn-sm btn-primary" onclick="insertDraft(false)">Replace caption</button>' +
|
||||
'<button type="button" class="btn btn-sm btn-ghost" onclick="insertDraft(true)">Append</button>' +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
||||
function insertDraft(append) {
|
||||
const ta = document.getElementById('soc-caption');
|
||||
if (append && ta.value.trim()) ta.value = ta.value.replace(/\s*$/, '') + '\n\n' + lastDraft;
|
||||
else ta.value = lastDraft;
|
||||
syncSocial();
|
||||
}
|
||||
|
||||
function inventReply(prompt, current) {
|
||||
const p = prompt.toLowerCase();
|
||||
if (p.includes('shorter') || p.includes('instagram')) {
|
||||
return 'Open house Sat 11–1 · 412 Willow Lane\nUpdated kitchen, quiet street, walk to Oakridge.\nDM for details 🏡\n\n#JustListed #OpenHouse #WillowLane';
|
||||
}
|
||||
if (p.includes('warm') || p.includes('neighbor')) {
|
||||
return 'I\'d love to show you around this Saturday.\n\n412 Willow Lane is open 11–1 — quiet street, bright kitchen, and an easy walk to Oakridge schools. Come say hi, no pressure.\n\nText me anytime if you want a private look first.';
|
||||
}
|
||||
if (p.includes('hashtag')) {
|
||||
const base = current.trim() || 'Just listed — 412 Willow Lane. Open house Saturday 11–1.';
|
||||
return base.replace(/\s*#\S+/g, '').trim() + '\n\n#JustListed #OpenHouse #RealEstate #HomeTour';
|
||||
}
|
||||
if (p.includes('linkedin') || p.includes('professional')) {
|
||||
return 'Hosting an open house this Saturday, 11–1, at 412 Willow Lane.\n\nUpdated kitchen, walkable to Oakridge schools, asking $449,000. Happy to arrange a private showing for clients who can\'t make the window.\n\n#RealEstate #OpenHouse';
|
||||
}
|
||||
if (p.includes('open house') || p.includes('willow') || p.includes('draft')) {
|
||||
return 'Open house this Saturday 11–1 at 412 Willow Lane.\n\nQuiet street · updated kitchen · walkable to Oakridge.\nDM or text me for details — hope to see you there!\n\n#JustListed #OpenHouse';
|
||||
}
|
||||
if (p.includes('rewrite') || p.includes('improve') || current.trim()) {
|
||||
return 'Just listed: 412 Willow Lane.\n\nOpen Saturday 11–1. Updated kitchen, quiet street, walkable to Oakridge schools. Asking $449,000.\n\nMessage me for a private showing.\n\n#JustListed #OpenHouse';
|
||||
}
|
||||
return 'Tell me the address, price band, and vibe (warm / bold / luxury) and I\'ll draft a caption you can drop straight into the composer.';
|
||||
}
|
||||
|
||||
function respond(prompt) {
|
||||
const current = document.getElementById('soc-caption').value;
|
||||
const draft = inventReply(prompt, current);
|
||||
const needsDraft = !/tell me the address/i.test(draft);
|
||||
const body = needsDraft
|
||||
? 'Here\'s a draft you can use:' + draftActions(draft)
|
||||
: escapeHtml(draft);
|
||||
appendMsg('bot', body);
|
||||
}
|
||||
|
||||
function sendPrompt(text) {
|
||||
document.getElementById('ai-input').value = text;
|
||||
sendChat();
|
||||
}
|
||||
|
||||
function sendChat() {
|
||||
const input = document.getElementById('ai-input');
|
||||
const text = input.value.trim();
|
||||
if (!text) return;
|
||||
appendMsg('user', escapeHtml(text));
|
||||
input.value = '';
|
||||
setTimeout(() => respond(text), 350);
|
||||
}
|
||||
|
||||
syncSocial();
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,42 @@
|
||||
{% extends "portal_base.html" %}
|
||||
{% block title %}Post · Portal{% endblock %}
|
||||
{% block topbar_title %}Social post{% endblock %}
|
||||
{% block portal_content %}
|
||||
<div class="toolbar">
|
||||
<span class="badge badge-{{ post.status }}">{{ post.get_status_display }}</span>
|
||||
<a class="btn btn-sm btn-ghost" href="{% url 'social:post_list' %}">← All posts</a>
|
||||
</div>
|
||||
<div class="split">
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Caption</h2></div>
|
||||
<div class="panel-b">
|
||||
<div class="preview-pane" style="white-space:pre-wrap">{{ post.body }}</div>
|
||||
{% if post.scheduled_for %}
|
||||
<p class="hint-block">Scheduled {{ post.scheduled_for|date:"M j, Y g:i A" }}</p>
|
||||
{% endif %}
|
||||
{% if post.ollama_prompt %}
|
||||
<p class="hint-block">AI prompt: {{ post.ollama_prompt }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-h"><h2>Targets</h2></div>
|
||||
<div class="panel-b" style="padding:0">
|
||||
<table class="table">
|
||||
<thead><tr><th>Account</th><th>Platform</th><th>Status</th></tr></thead>
|
||||
<tbody>
|
||||
{% for target in post.targets.all %}
|
||||
<tr>
|
||||
<td>{{ target.account.label }}</td>
|
||||
<td>{{ target.get_platform_display }}</td>
|
||||
<td><span class="badge badge-{{ target.status }}">{{ target.get_status_display }}</span></td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="3" class="empty-state">No targets attached.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends "portal_base.html" %}
|
||||
{% block title %}Social posts · Portal{% endblock %}
|
||||
{% block topbar_title %}Scheduled & drafts{% endblock %}
|
||||
{% block portal_content %}
|
||||
<div class="toolbar">
|
||||
<p class="muted" style="margin:0">Posts saved from the composer.</p>
|
||||
<a class="btn btn-primary btn-sm" href="{% url 'social:composer' %}">Compose</a>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-b" style="padding:0">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Preview</th><th>Status</th><th>Scheduled</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in posts %}
|
||||
<tr>
|
||||
<td>{{ post.body|truncatechars:80 }}</td>
|
||||
<td><span class="badge badge-{{ post.status }}">{{ post.get_status_display }}</span></td>
|
||||
<td>{% if post.scheduled_for %}{{ post.scheduled_for|date:"M j, g:i A" }}{% else %}—{% endif %}</td>
|
||||
<td><a href="{% url 'social:post_detail' post.pk %}">Open</a></td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="4" class="empty-state">No posts yet. <a href="{% url 'social:composer' %}">Compose one</a>.</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user