This commit is contained in:
Tomáš Dvořák
2025-10-16 13:32:05 +02:00
commit 12cba639b9
663 changed files with 168914 additions and 0 deletions
+220
View File
@@ -0,0 +1,220 @@
# Poll System - Quick Start Guide
## 🚀 Getting Started with Polls
The poll/voting system is now fully integrated into your article and activity admin pages!
### ✅ What's Integrated
1. **Article Admin Page** (`/admin/clanky`)
- Poll linker in the "Media" tab when editing an article
- Link existing polls or create new ones
- Polls auto-display at the end of published articles
2. **Activity Admin Page** (`/admin/aktivity`)
- Poll linker at the bottom of the activity edit modal
- Perfect for event feedback and engagement
- Polls auto-display at the end of event details
3. **Dedicated Poll Management** (`/admin/ankety`)
- Full poll creation and management
- Statistics and analytics
- Advanced settings and options
## 📝 How to Add a Poll to an Article
### Method 1: While Editing an Article
1. Go to `/admin/clanky`
2. Click on an existing article to edit (or create a new one and save it first)
3. Navigate to the **"Média"** tab
4. Scroll to the bottom - you'll see **"Ankety"** section
5. Click to expand it
6. Select a poll from the dropdown or create a new one in `/admin/ankety`
7. Click **"Připojit"** to link the poll
### Method 2: Create Poll First, Then Link
1. Go to `/admin/ankety`
2. Click **"Nová anketa"**
3. Fill in:
- **Název**: e.g., "Hráč zápasu"
- **Možnosti**: Add at least 2 options
- **Propojení s obsahem**: Enter the article ID
4. Set status to **"Aktivní"**
5. Save
## 📅 How to Add a Poll to an Activity/Event
### While Editing an Activity
1. Go to `/admin/aktivity`
2. Click to edit an existing activity (or create and save a new one first)
3. Scroll to the bottom of the modal
4. Find the **"Ankety"** section
5. Click to expand
6. Select a poll or create one first in `/admin/ankety`
7. Click **"Připojit"**
## 🎯 Common Use Cases
### 1. Man of the Match Poll (After Match Article)
**Step 1:** Publish match report article
**Step 2:** Go to `/admin/ankety` and create:
```
Title: "Hráč zápasu - Sparta vs Slavia"
Type: Single choice
Options:
- Jan Novák (link to player if available)
- Petr Svoboda
- Martin Dvořák
Status: Active
End Date: +24 hours from now
```
**Step 3:** In article admin → Media tab → Link the poll
**Result:** Poll appears at end of article automatically!
### 2. Event Feedback Poll (After Club Event)
**Step 1:** Create the event activity
**Step 2:** Create poll:
```
Title: "Jak se vám akce líbila?"
Options:
- Výborné! 😍
- Dobré 👍
- Průměrné 😐
- Mohlo být lepší 👎
Show Results: After end
```
**Step 3:** In activity edit modal → Link the poll
**Result:** Poll appears when users view event details!
### 3. Pre-Match Prediction Poll
**Step 1:** Create match preview article
**Step 2:** Create poll:
```
Title: "Předpověď: Kdo vyhraje?"
Start Date: Now
End Date: 30 minutes before match
Options:
- Domácí tým
- Remíza
- Hosté
Show Results: After end
```
**Step 3:** Link to article
**Result:** Fans can vote before match starts!
## 🔧 The PollLinker Component
The `PollLinker` component is embedded in both admin pages and provides:
-**View linked polls** - See which polls are connected
-**Link existing polls** - Choose from dropdown of available polls
-**Unlink polls** - Remove poll connections
-**Quick stats** - See vote counts at a glance
-**Collapsible** - Keeps UI clean when not in use
### Features:
- Shows poll title, status, and vote count
- Click expand to manage polls
- Only shows polls not already linked elsewhere
- One-click link/unlink functionality
## 📊 Where Polls Appear
### For Website Visitors:
1. **Article Pages** (`/news/:slug`)
- Polls appear after article content
- Before newsletter CTA
- Fully interactive with real-time voting
2. **Activity Pages** (`/aktivita/:id`)
- Polls appear after event details
- Great for gathering feedback
3. **Dedicated Polls Page** (`/ankety`)
- All active polls in one place
- Tabbed interface (All, Active, Featured)
## 🎨 Poll Display Features
- **Real-time results** with progress bars
- **Mobile responsive** - works on all devices
- **Dark mode support** - adapts to theme
- **Anonymous voting** - no login required (configurable)
- **Duplicate prevention** - IP + session tracking
- **Visual feedback** - shows when you've voted
## 💡 Tips & Best Practices
1. **Create polls before publishing** - Ensures they appear immediately
2. **Set end dates** - Auto-close polls after reasonable time
3. **Use featured flag** - Shows polls on homepage widget
4. **Link to players** - For MOTM polls, creates rich display
5. **Multiple polls** - You can link multiple polls to same content (max 3 shown)
6. **Monitor stats** - Check `/admin/ankety` for analytics
## 🔍 Finding Content IDs
### Article IDs
1. Go to `/admin/clanky`
2. Click article to edit
3. Look at the ID in the interface or URL
### Event IDs
1. Go to `/admin/aktivity`
2. Click event to edit
3. ID is shown in the interface
## ⚙️ Poll Settings Explained
- **Type**: Single (radio), Multiple (checkbox), Rating
- **Status**: Draft, Active, Closed, Archived
- **Allow Multiple**: Enable multi-select for multiple choice
- **Max Choices**: Limit selections (if multiple allowed)
- **Show Results**:
- Always: Everyone sees results
- After Vote: Only after user votes
- After End: Only when poll closes
- Never: Admin only
- **Require Auth**: Force login to vote
- **Allow Guest Vote**: Anonymous voting enabled
- **Featured**: Show on homepage
## 🆘 Troubleshooting
**Poll not showing in article?**
- Save the article first (poll linker only appears for saved articles)
- Check poll status is "active"
- Verify poll dates include current time
- Refresh the page
**Can't find poll to link?**
- Create the poll first in `/admin/ankety`
- Make sure poll isn't already linked elsewhere
- Check poll status is "active"
**Poll not appearing on public page?**
- Poll must be status "active"
- Check start/end dates
- Clear browser cache
- Verify article/event is published
## 📚 Related Documentation
- `POLL_SYSTEM_IMPLEMENTATION.md` - Complete technical documentation
- `POLL_INTEGRATION_GUIDE.md` - Content linking details
- `/admin/docs` - Admin panel help
## 🎉 You're Ready!
The poll system is now seamlessly integrated into your workflow. Just edit an article or activity, scroll to the poll section, and start engaging your fans!
---
**Need Help?** Check the admin documentation at `/admin/docs` or refer to the detailed guides in the project root.