diff --git a/README.md b/README.md index 7b52fe2..853a38a 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,23 @@ "Sanasto Wiki" is a web-based dictionary application for simultaneous translators in the living Christianity. The application provides publicly accessible translations while restricting editing and commenting to invited contributors. +--- + ## Core Concepts -### Supported languages -We currently support the following languages: -* Finnish -* English -* Swedish -* Norwegian -* Russian -* German +### Supported Languages + +Initial seed data: + +| Code | Name | Native Name | Sort Order | +|------|------|-------------|------------| +| fi | Finnish | Suomi | 1 | +| en | English | English | 2 | +| sv | Swedish | Svenska | 3 | +| no | Norwegian | Norsk | 4 | +| de | German | Deutsch | 5 | +| ru | Russian | Русский | 6 | + Language codes are fixed because translations are stored in columns on `entries`. The `supported_languages` table controls labels, ordering, and whether a language is active. To add a language, you must add a new column to `entries` and add a corresponding row to `supported_languages`. @@ -32,6 +39,8 @@ Each entry has translations in multiple languages. ### Suggested Meaning When translators disagree on a translation or want to suggest alternatives (regional variations, contextual meanings, etc.), they can submit a suggested meaning for community review. +--- + ## Technical Stack * Framework: Rails 8 @@ -42,6 +51,34 @@ When translators disagree on a translation or want to suggest alternatives (regi --- +## Authentication Flow + +### Public Access +- No authentication required for browsing and searching entries +- Read-only access to all dictionary content + +### Invitation-Only Registration +- Admins send email invitations with unique tokens +- Invited users register by setting name and password +- `invitation_token` cleared after successful registration + +### Login & Sessions +- Email + password authentication +- Session-based (encrypted cookies, Rails default) +- Optional "remember me" for extended sessions + +### Authorization +- **Contributor**: Create/edit entries, add comments, suggest translations +- **Reviewer**: All contributor actions + review suggestions, verify entries +- **Admin**: All actions + invite users, manage roles + +### Security +- Passwords hashed with bcrypt +- Rate limiting on login attempts +- Invitation tokens expire after 14 days + +--- + ## Database Schema ``` # db/schema.rb @@ -220,21 +257,6 @@ See 'public/Kristillisyyden sanasto ver 23.5.2013.xlsx' --- -## Supported Languages - -Initial seed data: - -| Code | Name | Native Name | Sort Order | -|------|------|-------------|------------| -| fi | Finnish | Suomi | 1 | -| en | English | English | 2 | -| sv | Swedish | Svenska | 3 | -| no | Norwegian | Norsk | 4 | -| de | German | Deutsch | 5 | -| ru | Russian | Русский | 6 | - ---- - ## User Interface ### Pages diff --git a/AGENTS.md b/docs/AGENTS.md similarity index 100% rename from AGENTS.md rename to docs/AGENTS.md diff --git a/DESIGN.md b/docs/DESIGN.md similarity index 100% rename from DESIGN.md rename to docs/DESIGN.md diff --git a/docs/TODO.md b/docs/TODO.md new file mode 100644 index 0000000..61f2eff --- /dev/null +++ b/docs/TODO.md @@ -0,0 +1,131 @@ +# Sanasto Wiki TODO + +## Authentication & Authorization + +- [ ] **Authentication system** + - [ ] Sessions controller and views (login/logout) + - [ ] Password reset flow + - [ ] Rate limiting on login attempts + - [ ] Session management (remember me, session timeout) +- [ ] **Invitation system** + - [ ] Invitations controller and mailer + - [ ] Invitation token generation and validation + - [ ] Registration via invitation link + - [ ] Token expiry (14 days) +- [ ] **Authorization & roles** + - [ ] Role-based access control middleware + - [ ] Contributor permissions enforcement + - [ ] Reviewer permissions enforcement + - [ ] Admin permissions enforcement + +## Core Features + +### Search & Browse +- [ ] **Full-text search** across all languages (FTS5 integration) +- [ ] **Filter by category** (word, phrase, proper_name, title, reference, other) +- [ ] **Alphabetical browsing** per language with tabs +- [ ] **Live search** (AJAX updates without page reload) + +### Entry Management +- [ ] **Create entry form** with all language fields +- [ ] **Edit entry form** (contributors only) +- [ ] **Delete entries** (admin only, with confirmation) +- [ ] **Bulk actions** (select multiple, bulk edit/delete) +- [ ] **Entry validation** (at least one language required, category required) + +### Suggested Meanings +- [ ] **Submit alternative translation** form +- [ ] **Review queue** for reviewers +- [ ] **Approve/reject** workflow +- [ ] **Display approved alternatives** on entry view +- [ ] **Notifications** when suggestions are reviewed + +### Comments & Discussion +- [ ] **Add comment** form on entry view +- [ ] **Edit/delete own comments** +- [ ] **Comment threading** (optional: replies to comments) +- [ ] **Comment notifications** for entry contributors + +### History & Audit +- [ ] **Entry version tracking** (record all changes in `entry_versions`) +- [ ] **View edit history** on entry page +- [ ] **Diff view** showing what changed +- [ ] **Revert to previous version** (admin/reviewer only) + +## User Management + +- [ ] **Admin dashboard** + - [ ] Send invitations by email + - [ ] Manage users (list, edit roles, deactivate) + - [ ] System statistics (users, entries, contributions) +- [ ] **User profile page** + - [ ] Edit name, email, password + - [ ] Set primary language preference + - [ ] View contribution history + - [ ] Personal statistics + +## Import/Export + +- [x] **XLSX export** of all entries +- [ ] **CSV import** for bulk entry creation +- [ ] **CSV export** as alternative to XLSX +- [ ] **Import validation** (check duplicates, validate data) + +## UI/UX Improvements + +- [ ] **Mobile-responsive design** (translators use phones during services) +- [ ] **Typography optimization** (easy to read quickly) +- [ ] **Visual distinction** for verified vs unverified entries +- [ ] **Keyboard shortcuts** (navigate search results, quick edit) +- [ ] **Loading states** and progress indicators +- [ ] **Error messages** and validation feedback +- [ ] **Toast notifications** for actions (saved, deleted, etc.) + +## Performance & Infrastructure + +- [ ] **Database indexes** review and optimization +- [ ] **N+1 query prevention** (check all controller actions) +- [ ] **Caching strategy** (page caching, fragment caching) +- [ ] **Background jobs** setup (Solid Queue for emails) +- [ ] **Database backup** strategy (Litestream configuration) + +## Testing + +- [ ] **Controller tests** for all actions +- [ ] **System tests** for critical user flows + - [ ] Public browsing and search + - [ ] Contributor creates/edits entry + - [ ] Reviewer workflow + - [ ] Admin user management +- [ ] **Integration tests** for authentication flows +- [ ] **Performance tests** for search queries + +## Deployment + +- [ ] **Kamal configuration** +- [ ] **Production environment** setup +- [ ] **SSL certificate** configuration +- [ ] **Monitoring** (error tracking, performance monitoring) +- [ ] **Backup automation** (Litestream to S3 or similar) + +## Future Considerations + +- [ ] **API endpoints** (REST API for mobile app) +- [ ] **PDF/print export** for offline use +- [ ] **Audio pronunciation** recordings +- [ ] **Mobile app** (native or PWA) +- [ ] **Offline mode** with sync +- [ ] **Additional languages** (requires schema migration) + +--- + +## Completed + +- [x] **Search input loses focus on filter change** +- [x] **Mismatched enum syntax** in models +- [x] **Replace hardcoded LANGUAGE_COLUMNS** with dynamic query +- [x] **Improve fixture quality** (resolved foreign key violations) +- [x] **XLSX download** button for entries +- [x] **FTS5 integration** (migration added) +- [x] **Database schema** implementation (all models and migrations) +- [x] **Supported languages** table with seed data