You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ A Moodle local plugin that syncs course content from a GitHub repository. Conten
15
15
-**GitHub webhook** endpoint for instant sync on push
16
16
-**CLI tool** for bulk syncing all configured courses
17
17
-**PAT encryption** at rest using Moodle's Sodium-based encryption
18
+
-**Built-in file editor** — browse, edit, and commit files back to GitHub directly from within Moodle
18
19
-**Per-course configuration** with capability-based access control
19
20
-**Sync history** with commit SHA tracking and detailed operation logs
20
21
@@ -279,6 +280,25 @@ Sync only auto-sync courses:
279
280
php local/githubsync/cli/sync_all.php --auto-only
280
281
```
281
282
283
+
### File Editor
284
+
285
+
The plugin includes a built-in file editor that lets you browse, view, edit, and commit repository files directly from Moodle — no need to switch to GitHub or a local IDE for quick content changes.
286
+
287
+
**Accessing the editor:** From the GitHub Sync configuration page for a course, click the **File Editor** link. Requires the `local/githubsync:configure` capability.
288
+
289
+
**What you can do:**
290
+
291
+
-**Browse** the full repository file tree in a collapsible sidebar
292
+
-**View** any text file by clicking it in the tree
293
+
-**Edit** file content in a textarea with keyboard shortcuts (Tab inserts spaces, Ctrl+S / Cmd+S saves)
294
+
-**Commit** changes back to GitHub with a commit message
295
+
296
+
**Conflict detection:** The editor tracks each file's Git blob SHA. If someone else modifies the file between your load and save, GitHub returns a conflict and the editor prompts you to reload before saving.
297
+
298
+
**Binary files** (images, PDFs, archives, fonts, media) are shown in the tree but are not editable.
299
+
300
+
**PAT requirements:** Your GitHub Personal Access Token must have **write access** to commit changes. For fine-grained tokens, set the "Contents" permission to "Read and write". For classic tokens, ensure the "repo" scope is enabled. Read-only tokens can still browse and view files but cannot save.
301
+
282
302
## Capabilities
283
303
284
304
| Capability | Description | Default roles |
@@ -387,6 +407,7 @@ local/githubsync/
387
407
lib.php # Navigation hooks and pluginfile handler
388
408
config.php # Per-course configuration page
389
409
sync.php # Sync trigger page
410
+
editor.php # File editor entry page
390
411
webhook.php # GitHub webhook endpoint
391
412
settings.php # Global admin settings
392
413
LICENSE # GNU GPL v3
@@ -398,14 +419,24 @@ local/githubsync/
398
419
db/
399
420
install.xml # Database schema
400
421
access.php # Capability definitions
422
+
services.php # External function (AJAX) registration
401
423
tasks.php # Scheduled task registration
402
424
lang/en/
403
425
local_githubsync.php # Language strings
426
+
templates/
427
+
editor.mustache # File editor UI template
428
+
amd/src/
429
+
editor.js # File editor frontend logic
430
+
repository.js # AJAX service calls
404
431
classes/
405
432
form/
406
433
config_form.php # Per-course config form (moodleform)
0 commit comments