From 72e0f445fda5f706f959a89931f4bcaf7642bd84 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 26 Feb 2022 10:33:09 +0300 Subject: [PATCH] Rename attachment to media --- help/en/attachment.myco | 34 ------------------------ help/en/hypha.myco | 13 ++++----- help/en/media.myco | 33 +++++++++++++++++++++++ help/en/mycomarkup.myco | 2 +- history/operations.go | 6 ++--- hyphae/files.go | 2 +- l18n/en/help.json | 2 +- l18n/en/ui.json | 54 +++++++++++++++++++------------------- l18n/ru/help.json | 2 +- l18n/ru/ui.json | 56 +++++++++++++++++++-------------------- shroom/can.go | 4 +-- shroom/log.go | 8 +++--- shroom/shroom.go | 2 +- shroom/unattach.go | 6 ++--- shroom/upload.go | 2 +- static/shortcuts.js | 4 +-- user/user.go | 2 +- views/hypha.qtpl | 6 ++--- views/hypha.qtpl.go | 24 ++++++++--------- views/nav.qtpl | 2 +- views/nav.qtpl.go | 2 +- views/readers.qtpl | 36 ++++++++++++------------- views/readers.qtpl.go | 58 ++++++++++++++++++++--------------------- views/stuff.qtpl | 2 +- views/stuff.qtpl.go | 4 +-- web/mutators.go | 2 +- web/readers.go | 12 ++++----- 27 files changed, 190 insertions(+), 190 deletions(-) delete mode 100644 help/en/attachment.myco create mode 100644 help/en/media.myco diff --git a/help/en/attachment.myco b/help/en/attachment.myco deleted file mode 100644 index 39ce297..0000000 --- a/help/en/attachment.myco +++ /dev/null @@ -1,34 +0,0 @@ -= Help: Attachment -In hyphae, an **attachment** is some content represented by something that is not [[/help/en/mycomarkup | Mycomarkup]]. Usually, an image, a video, or an audio. - -== Supported attachment types -You can upload any file, but only those listed below will be displayed on the website. You can download unsupported attachments, though. - -* **Images:** jpg, gif, png, webp, svg, ico -* **Video:** ogg, webm, mp4 -* **Audio:** ogg, webm, mp3 - -== How to add an attachment? -For non-existent hyphae, upload a file in the //Upload a media// section. - -For any hyphae, upload a file in the //Manage attachment// tab. - -== Attachment management -Every hypha has the //Manage attachment// section. Click it to see what is out there. - -You can upload a new file, you can //delete// the attachment (it is called //unattaching//) and see some file stats (size and type). - -== On naming hyphae with attachments -The hypha name should not just copy the file name in most cases. If you are uploading a photo of a rose, do not call it `rose.jpg`, no. Call it `photo of rose` or `rose photo` or whatever. You rarely need to think of file extensions when using Mycorrhiza Wiki. - -This is not a rule, of course, just a convention. - -== What to put in the text part? -If a hypha has an attachment, here is what the text part might be about: -* A textual description or representation of the picture. -* A transcript of the song. -* An analysis of the attachment. -* Some meta data. -* Things above combined. - -The attachment //should not// be an illustration of the text part. In this case it is better to put it into a subhypha and embed it into the markup. \ No newline at end of file diff --git a/help/en/hypha.myco b/help/en/hypha.myco index 27d1a8c..712dc74 100644 --- a/help/en/hypha.myco +++ b/help/en/hypha.myco @@ -1,15 +1,16 @@ = Help: Hypha A **hypha** (//plural:// hyphae) is the main content unit used in Mycorrhiza Wiki. -== The structure of hypha -A hypha consists of two parts: -* **Attachment.** Some form of media. There is only one attachment. See [[/help/en/attachment | Attachment]] for more information about attachments. -* **Text part.** Either a description of the attachment or a stand-alone text unit such as an article, a diary or a poem. It is written in a special markup, called [[/help/en/mycomarkup | Mycomarkup]]. +== The ontology +There are two types of hyphae: -Both parts are optional. You can have a picture without description, an article without an attachment, etc. You can have them both. You must have at least one part, though. +*. **Textual hypha.** This is a stand-alone text unit such as an article, a diary or a poem. It is written in a special markup, called [[/help/en/mycomarkup | Mycomarkup]]. +*. **Media hypha.** This is a media resource such as an image. Media hyphae also have descriptions, also written in Mycomarkup. See [[/help/en/media | media]]. + +Understanding the difference between the two is really important, as it is one of the defining features of the engine. It can be confusing at first. == How to create a hypha? -Some links on wiki are red. It means that they link a hypha that does not exist yet. If you follow this link, you will see a special page where you can upload an attachment or open the text editor. This is how you create hyphae. +Some links on wiki are red. It means that they link a hypha that does not exist yet. If you follow this link, you will see a special page where you can upload a media or open the text editor. This is how you create hyphae. You can create such red links and follow them to create hyphae. diff --git a/help/en/media.myco b/help/en/media.myco new file mode 100644 index 0000000..f618d49 --- /dev/null +++ b/help/en/media.myco @@ -0,0 +1,33 @@ += Help: Media +You can upload **media** such as images, audio or video to your wiki in form of **media hyphae**. The word //media// is short for //multimedia//. Media hyphae are not just media files, they can also have a description in [[/help/en/mycomarkup | Mycomarkup]]. + +== Supported media types +You can upload any media file, but only those listed below will be displayed on the wiki. You can download unsupported medias, though. + +* **Images:** jpg, gif, png, webp, svg, ico +* **Video:** ogg, webm, mp4 +* **Audio:** ogg, webm, mp3 + +== How to upload media? +For non-existent hyphae, upload a file in the //Upload media// section. + +For textual hyphae and already uploaded media hyphae, click the //Manage media// link on the bottom and upload a new media file. + +== Media management +Every hypha has the //Manage media// section. Click it to see what is out there. + +You can upload a new file, you can //remove// the media and see some file stats (size and type). + +== On naming media hyphae +The hypha name should not just copy the file name. If you are uploading a photo of a rose, do not call it `rose.jpg`, no. Call it `photo of rose` or `rose photo` or whatever. You rarely need to think of file extensions when using Mycorrhiza Wiki. + +This is not a rule, of course, just a convention. + +== What to put in the description? +* A textual description or representation of the picture. +* A transcript of the song. +* An analysis of the media. +* Some meta data. +* Things above combined. + +The media //should not// be an illustration of the description. In this case it is better to put it into a subhypha and embed it into the markup. \ No newline at end of file diff --git a/help/en/mycomarkup.myco b/help/en/mycomarkup.myco index 36e36b2..1dd3bd8 100644 --- a/help/en/mycomarkup.myco +++ b/help/en/mycomarkup.myco @@ -413,7 +413,7 @@ The //selector// specifies what part of the //target// to transclude. The parser * `full` Transclude the whole document. * `text` Transclude all text. -* `attachment` Transclude attachment only. +* `attachment` Transclude media only. * `description` Transclude first paragraph only. * `overview` Short for both `attachment` and `description`. diff --git a/history/operations.go b/history/operations.go index 1d30871..1081017 100644 --- a/history/operations.go +++ b/history/operations.go @@ -23,14 +23,14 @@ const ( TypeNone OpType = iota // TypeEditText represents an edit of hypha text part. TypeEditText - // TypeEditBinary represents an addition or replacement of hypha attachment. + // TypeEditBinary represents an addition or replacement of hypha media. TypeEditBinary // TypeDeleteHypha represents a hypha deletion TypeDeleteHypha // TypeRenameHypha represents a hypha renaming TypeRenameHypha - // TypeUnattachHypha represents a hypha attachment deletion - TypeUnattachHypha + // TypeRemoveMedia represents media removal + TypeRemoveMedia // TypeMarkupMigration represents a wikimind-powered automatic markup migration procedure TypeMarkupMigration ) diff --git a/hyphae/files.go b/hyphae/files.go index 12a64cd..f1bc400 100644 --- a/hyphae/files.go +++ b/hyphae/files.go @@ -56,7 +56,7 @@ func Index(path string) { } // indexHelper finds all hypha files in the full `path` and sends them to the -// channel. Handling of duplicate entries and attachment and counting them is +// channel. Handling of duplicate entries and media and counting them is // up to the caller. func indexHelper(path string, nestLevel uint, ch chan ExistingHypha) { nodes, err := os.ReadDir(path) diff --git a/l18n/en/help.json b/l18n/en/help.json index f57c4d9..e7dfbc4 100644 --- a/l18n/en/help.json +++ b/l18n/en/help.json @@ -10,7 +10,7 @@ "topics": "Help topics", "main": "Main", "hypha": "Hypha", - "attachment": "Attachment", + "media": "Media", "mycomarkup": "Mycomarkup", "interface": "Interface", "prevnext": "Previous/next", diff --git a/l18n/en/ui.json b/l18n/en/ui.json index 480ea32..1f199d3 100644 --- a/l18n/en/ui.json +++ b/l18n/en/ui.json @@ -24,7 +24,7 @@ "rename_link": "Rename", "delete_link": "Delete", "text_link": "View markup", - "attachment_link": "Manage attachment", + "media_link": "Manage media", "backlinks_link": "{{.n}} backlink%s", "backlinks_link+one": "", "backlinks_link+other": "s", @@ -51,25 +51,25 @@ "rename_badname": "Invalid name", "rename_badname_tip": "Invalid new name. Names cannot contain characters {{.chars}}.", - "act_noattachment": "No attachment", - "act_noattachment_tip": "Cannot unattach this hypha because it has no attachment", + "act_no_media": "No media", + "act_no_media_tip": "Cannot remove media because this is not a media hypha", "act_norights": "Not enough rights", "act_notexist": "Does not exist", "act_norights_delete": "Not enough rights to delete, you must be a moderator", "act_notexist_delete": "Cannot delete this hypha because it does not exist", "act_norights_rename": "Not enough rights to rename, you must be a trusted editor", "act_notexist_rename": "Cannot rename this hypha because it does not exist", - "act_norights_unattach": "Not enough rights to unattach, you must be a trusted editor", - "act_notexist_unattach": "Cannot unattach this hypha because it does not exist", + "act_norights_remove_media": "Not enough rights to remove media, you must be a trusted editor", + "act_notexist_remove_media": "Cannot remove media because this hypha does not exist", "act_norights_edit": "You must be an editor to edit a hypha", - "act_norights_attach": "You must be an editor to attach a hypha", + "act_norights_upload_media": "You must be an editor to upload media", "ask_delete": "Delete %s?", "ask_delete_tip": "In this version of Mycorrhiza Wiki you cannot undelete a deleted hypha but the history can still be accessed.", - "ask_unattach": "Unattach %s?", + "ask_remove_media": "Remove media from %s?", "ask_really": "Do you really want to {{.verb}} hypha {{.name}}?", "ask_delete_verb": "delete", - "ask_unattach_verb": "unattach", + "ask_remove_media_verb": "remove_media", "history_title": "History of %s", @@ -86,7 +86,7 @@ "diff_title": "Diff of {{.name}} at {{.rev}}", "revision_title": "{{.name}} at {{.rev}}", - "revision_warning": "Please note that viewing attachments of hyphae is not supported in history for now.", + "revision_warning": "Please note that viewing media is not supported in history for now.", "revision_link": "Get Mycomarkup source of this revision", "revision_no_text": "This hypha had no text at this revision.", @@ -126,24 +126,24 @@ "media_noaudio": "Your browser does not support audio.", "media_noaudio_link": "Download audio", - "attach_title": "Attachment of {{.name}}", - "attach_empty": "This hypha has no attachment, you can upload it here.", - "attach_tip": "You can manage the hypha's attachment on this page.", - "attach_link": "What are attachments?", - "attach_upload": "Upload", - "attach_stat": "Stat", - "attach_stat_size": "File size:", - "attach_size_value": "{{.n}} byte%s", - "attach_size_value+one": "", - "attach_size_value+other": "s", - "attach_stat_mime": "MIME type:", - "attach_include": "Include", - "attach_include_tip": "This attachment is an image. To include it in a hypha, use a syntax like this:", - "attach_new": "Attach", - "attach_new_tip": "You can upload a new attachment. Please do not upload too big pictures unless you need to because may not want to wait for big pictures to load.", - "attach_remove": "Unattach", - "attach_remove_tip": "Please note that you don't have to unattach before uploading a new attachment.", - "attach_remove_button": "Unattach", + "media_title": "Media of {{.name}}", + "media_empty": "This hypha has no media, you can upload it here.", + "media_tip": "You can manage the hypha's media on this page.", + "media_what_is": "What is media?", + "media_upload": "Upload", + "media_stat": "Stat", + "media_stat_size": "File size:", + "media_size_value": "{{.n}} byte%s", + "media_size_value+one": "", + "media_size_value+other": "s", + "media_stat_mime": "MIME type:", + "media_include": "Include", + "media_include_tip": "This media is an image. To include it in a hypha, use a syntax like this:", + "media_new": "media", + "media_new_tip": "You can upload a new media. Please do not upload too big pictures unless you need to because may not want to wait for big pictures to load.", + "media_remove": "Remove media", + "media_remove_tip": "Please note that you don't have to remove media before uploading a new media.", + "media_remove_button": "Remove media", "close_dialog": "Close this dialog", "confirm": "Confirm", diff --git a/l18n/ru/help.json b/l18n/ru/help.json index 7dadb3a..50e94bd 100644 --- a/l18n/ru/help.json +++ b/l18n/ru/help.json @@ -10,7 +10,7 @@ "topics": "Темы справки", "main": "Введение", "hypha": "Гифа", - "attachment": "Вложение", + "media": "Медиа", "mycomarkup": "Микоразметка", "interface": "Интерфейс", "prevnext": "Назад/далее", diff --git a/l18n/ru/ui.json b/l18n/ru/ui.json index 9ce8728..015b2bc 100644 --- a/l18n/ru/ui.json +++ b/l18n/ru/ui.json @@ -25,7 +25,7 @@ "rename_link": "Переименовать", "delete_link": "Удалить", "text_link": "Посмотреть разметку", - "attachment_link": "Вложение", + "media_link": "Медиа", "backlinks_link": "{{.n}} %s сюда", "backlinks_link+one": "ссылка", "backlinks_link+few": "ссылки", @@ -53,25 +53,25 @@ "rename_badname": "Некорректное название", "rename_badname_tip": "Новое название некорректно. Названия не могут содержать символы {{.chars}}.", - "act_noattachment": "Нет вложения", - "act_noattachment_tip": "Не могу открепить гифу, потому что в ней нет вложения", + "act_no_media": "Нет медиа", + "act_no_media_tip": "Невозможно убрать медиа, потому что медиа нету", "act_norights": "Недостаточно прав", "act_notexist": "Не существует", "act_norights_delete": "Недостаточно прав для удаления, вы должны быть модератором", "act_norights_rename": "Недостаточно прав для переименования, вы должны быть доверенным редактором", - "act_norights_unattach": "Недостаточно прав для открепления, вы должны быть доверенным редактором", + "act_norights_remove_media": "Недостаточно прав для открепления, вы должны быть доверенным редактором", "act_norights_edit": "Вы должны быть редактором, чтобы редактировать гифы", - "act_norights_attach": "Вы должны быть редактором, чтобы прикреплять гифы", + "act_norights_media": "Вы должны быть редактором, чтобы прикреплять гифы", "act_notexist_delete": "Нельзя удалить эту гифу, потому что она не существует", "act_notexist_rename": "Нельзя переименовать эту гифу, потому что она не существует", - "act_notexist_unattach": "Нельзя открепить эту гифу, потому что она не существует", + "act_notexist_remove_media": "Нельзя убрать медиа, потому что нет такой гифы", "ask_delete": "Удалить «%s»?", "ask_delete_tip": "В этой версии Микоризы нельзя отменить удаление гифы, но её история останется доступной.", - "ask_unattach": "Открепить «%s»?", + "ask_remove_media": "Убрать медиа у «%s»?", "ask_really": "Вы действительно хотите {{.verb}} гифу «{{.name}}»?", "ask_delete_verb": "удалить", - "ask_unattach_verb": "открепить", + "ask_remove_media_verb": "убрать медиа", "history_title": "История «%s»", @@ -89,7 +89,7 @@ "diff_title": "Разница для «{{.name}}» из {{.rev}}", "revision_title": "{{.name}} из {{.rev}}", - "revision_warning": "Обратите внимание, просмотр вложений в истории гифы пока что недоступен.", + "revision_warning": "Обратите внимание, просмотр медиа в истории пока что недоступен.", "revision_link": "Посмотреть код микоразметки для этой ревизии", "revision_no_text": "В этой ревизии гифы не было текста.", @@ -129,25 +129,25 @@ "media_noaudio": "Ваш браузер не поддерживает аудио.", "media_noaudio_link": "Скачать аудио", - "attach_title": "Вложение «{{.name}}»", - "attach_empty": "Эта гифа не имеет вложения, здесь вы можете его загрузить.", - "attach_tip": "На этой странице вы можете управлять вложением.", - "attach_link": "Что такое вложение?", - "attach_upload": "Загрузить", - "attach_stat": "Свойства", - "attach_stat_size": "Размер файла:", - "attach_size_value": "{{.n}} %s", - "attach_size_value+one": "байт", - "attach_size_value+few": "байта", - "attach_size_value+many": "байт", - "attach_stat_mime": "MIME-тип:", - "attach_include": "Добавление", - "attach_include_tip": "Это вложение – изображение. Чтобы добавить его в текст гифы, используйте синтаксис ниже:", - "attach_new": "Прикрепить", - "attach_new_tip": "Вы можете загрузить новое вложение. Пожалуйста, не загружайте слишком большие изображения без необходимости, чтобы впоследствии не ждать её долгую загрузку.", - "attach_remove": "Открепить", - "attach_remove_tip": "Заметьте, чтобы заменить вложение, вам не нужно его перед этим откреплять.", - "attach_remove_button": "Открепить", + "media_title": "Медиа «{{.name}}»", + "media_empty": "Эта гифа не имеет медиа, здесь вы можете его загрузить.", + "media_tip": "На этой странице вы можете управлять медиа.", + "media_what_is": "Что такое медиа?", + "media_upload": "Загрузить", + "media_stat": "Свойства", + "media_stat_size": "Размер файла:", + "media_size_value": "{{.n}} %s", + "media_size_value+one": "байт", + "media_size_value+few": "байта", + "media_size_value+many": "байт", + "media_stat_mime": "MIME-тип:", + "media_include": "Добавление", + "media_include_tip": "Это медиа – изображение. Чтобы добавить его в текст гифы, используйте синтаксис ниже:", + "media_new": "Прикрепить", + "media_new_tip": "Вы можете загрузить новое медиа. Пожалуйста, не загружайте слишком большие изображения без необходимости, чтобы впоследствии не ждать её долгую загрузку.", + "media_remove": "Открепить", + "media_remove_tip": "Заметьте, чтобы заменить медиа, вам не нужно его перед этим откреплять.", + "media_remove_button": "Открепить", "close_dialog": "Закрыть этот диалог", "confirm": "Применить", diff --git a/shroom/can.go b/shroom/can.go index 59d3291..b3885e7 100644 --- a/shroom/can.go +++ b/shroom/can.go @@ -55,10 +55,10 @@ var ( ) CanAttach = canFactory( - rejectAttachLog, + rejectUploadMediaLog, "upload-binary", nil, - "ui.act_norights_attach", + "ui.act_norights_media", "You cannot attach a hypha that does not exist", false, ) diff --git a/shroom/log.go b/shroom/log.go index d86bc9f..ecda380 100644 --- a/shroom/log.go +++ b/shroom/log.go @@ -13,12 +13,12 @@ func rejectDeleteLog(h hyphae.Hypha, u *user.User, errmsg string) { func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) { log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) } -func rejectUnattachLog(h hyphae.Hypha, u *user.User, errmsg string) { - log.Printf("Reject unattach ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) +func rejectRemoveMediaLog(h hyphae.Hypha, u *user.User, errmsg string) { + log.Printf("Reject remove media ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) } func rejectEditLog(h hyphae.Hypha, u *user.User, errmsg string) { log.Printf("Reject edit ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) } -func rejectAttachLog(h hyphae.Hypha, u *user.User, errmsg string) { - log.Printf("Reject attach ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) +func rejectUploadMediaLog(h hyphae.Hypha, u *user.User, errmsg string) { + log.Printf("Reject upload media ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) } diff --git a/shroom/shroom.go b/shroom/shroom.go index f422116..74a5234 100644 --- a/shroom/shroom.go +++ b/shroom/shroom.go @@ -30,7 +30,7 @@ func init() { rawText, err = FetchTextFile(h) case *hyphae.MediaHypha: rawText, err = FetchTextFile(h) - binaryBlock = views.AttachmentHTMLRaw(h) + binaryBlock = views.MediaHTMLRaw(h) } return } diff --git a/shroom/unattach.go b/shroom/unattach.go index ca702d9..e62ce02 100644 --- a/shroom/unattach.go +++ b/shroom/unattach.go @@ -11,14 +11,14 @@ import ( // RemoveMedia removes media from the media hypha and makes a history record about that. If it only had media, the hypha will be deleted. If it also had text, the hypha will become textual. func RemoveMedia(u *user.User, h *hyphae.MediaHypha) error { hop := history. - Operation(history.TypeUnattachHypha). + Operation(history.TypeRemoveMedia). WithFilesRemoved(h.MediaFilePath()). - WithMsg(fmt.Sprintf("Unattach ‘%s’", h.CanonicalName())). + WithMsg(fmt.Sprintf("Remove media from ‘%s’", h.CanonicalName())). WithUser(u). Apply() if len(hop.Errs) > 0 { - rejectUnattachLog(h, u, "fail") + rejectRemoveMediaLog(h, u, "fail") // FIXME: something may be wrong here return fmt.Errorf("Could not unattach this hypha due to internal server errors: %v", hop.Errs) } diff --git a/shroom/upload.go b/shroom/upload.go index 04045f4..74e2ba5 100644 --- a/shroom/upload.go +++ b/shroom/upload.go @@ -164,7 +164,7 @@ func UploadBinary(h hyphae.Hypha, mime string, file multipart.File, u *user.User // Privilege check if !u.CanProceed("upload-binary") { - rejectAttachLog(h, u, "no rights") + rejectUploadMediaLog(h, u, "no rights") return errors.New("ui.act_no_rights") } diff --git a/static/shortcuts.js b/static/shortcuts.js index 6dea429..8630f6b 100644 --- a/static/shortcuts.js +++ b/static/shortcuts.js @@ -327,9 +327,9 @@ window.addEventListener('load', () => { this.bindElement('e, ' + (isMac ? "Meta+Enter" : "Ctrl+Enter"), '.btn__link_navititle[href^="/edit/"]', 'Edit this hypha'); this.bindElement('v', '.hypha-info__link[href^="/hypha/"]', 'Go to hypha′s page'); - this.bindElement('a', '.hypha-info__link[href^="/attachment/"]', 'Go to attachment'); + this.bindElement('a', '.hypha-info__link[href^="/media/"]', 'Go to media management'); this.bindElement('h', '.hypha-info__link[href^="/history/"]', 'Go to history'); - this.bindElement('r', '.hypha-info__link[href^="/rename-ask/"]', 'Rename this hypha'); + this.bindElement('r', '.hypha-info__link[href^="/rename/"]', 'Rename this hypha'); }); } else { diff --git a/user/user.go b/user/user.go index fe35bf1..8764d20 100644 --- a/user/user.go +++ b/user/user.go @@ -34,7 +34,7 @@ var minimalRights = map[string]int{ "text": 0, "backlinks": 0, "history": 0, - "attachment": 1, + "media": 1, "edit": 1, "upload-binary": 1, "upload-text": 1, diff --git a/views/hypha.qtpl b/views/hypha.qtpl index 366a280..8c4f075 100644 --- a/views/hypha.qtpl +++ b/views/hypha.qtpl @@ -39,7 +39,7 @@ - + @@ -75,9 +75,9 @@ {% endfunc %} -{% func AttachmentHTMLRaw(h *hyphae.MediaHypha) %}{%= AttachmentHTML(h, l18n.New("en", "en")) %}{% endfunc %} +{% func MediaHTMLRaw(h *hyphae.MediaHypha) %}{%= MediaHTML(h, l18n.New("en", "en")) %}{% endfunc %} -{% func AttachmentHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) %} +{% func MediaHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) %} {% switch filepath.Ext(h.MediaFilePath()) %} {% case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico" %} diff --git a/views/hypha.qtpl.go b/views/hypha.qtpl.go index 0832a78..29c68c3 100644 --- a/views/hypha.qtpl.go +++ b/views/hypha.qtpl.go @@ -213,7 +213,7 @@ func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u * @@ -349,29 +349,29 @@ func NaviTitleHTML(h hyphae.Hypha) string { } //line views/hypha.qtpl:78 -func StreamAttachmentHTMLRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) { +func StreamMediaHTMLRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) { //line views/hypha.qtpl:78 - StreamAttachmentHTML(qw422016, h, l18n.New("en", "en")) + StreamMediaHTML(qw422016, h, l18n.New("en", "en")) //line views/hypha.qtpl:78 } //line views/hypha.qtpl:78 -func WriteAttachmentHTMLRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) { +func WriteMediaHTMLRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) { //line views/hypha.qtpl:78 qw422016 := qt422016.AcquireWriter(qq422016) //line views/hypha.qtpl:78 - StreamAttachmentHTMLRaw(qw422016, h) + StreamMediaHTMLRaw(qw422016, h) //line views/hypha.qtpl:78 qt422016.ReleaseWriter(qw422016) //line views/hypha.qtpl:78 } //line views/hypha.qtpl:78 -func AttachmentHTMLRaw(h *hyphae.MediaHypha) string { +func MediaHTMLRaw(h *hyphae.MediaHypha) string { //line views/hypha.qtpl:78 qb422016 := qt422016.AcquireByteBuffer() //line views/hypha.qtpl:78 - WriteAttachmentHTMLRaw(qb422016, h) + WriteMediaHTMLRaw(qb422016, h) //line views/hypha.qtpl:78 qs422016 := string(qb422016.B) //line views/hypha.qtpl:78 @@ -382,7 +382,7 @@ func AttachmentHTMLRaw(h *hyphae.MediaHypha) string { } //line views/hypha.qtpl:80 -func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) { +func StreamMediaHTML(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) { //line views/hypha.qtpl:80 qw422016.N().S(` `) @@ -486,22 +486,22 @@ func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l } //line views/hypha.qtpl:109 -func WriteAttachmentHTML(qq422016 qtio422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) { +func WriteMediaHTML(qq422016 qtio422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) { //line views/hypha.qtpl:109 qw422016 := qt422016.AcquireWriter(qq422016) //line views/hypha.qtpl:109 - StreamAttachmentHTML(qw422016, h, lc) + StreamMediaHTML(qw422016, h, lc) //line views/hypha.qtpl:109 qt422016.ReleaseWriter(qw422016) //line views/hypha.qtpl:109 } //line views/hypha.qtpl:109 -func AttachmentHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) string { +func MediaHTML(h *hyphae.MediaHypha, lc *l18n.Localizer) string { //line views/hypha.qtpl:109 qb422016 := qt422016.AcquireByteBuffer() //line views/hypha.qtpl:109 - WriteAttachmentHTML(qb422016, h, lc) + WriteMediaHTML(qb422016, h, lc) //line views/hypha.qtpl:109 qs422016 := string(qb422016.B) //line views/hypha.qtpl:109 diff --git a/views/nav.qtpl b/views/nav.qtpl index 592d34f..39c6115 100644 --- a/views/nav.qtpl +++ b/views/nav.qtpl @@ -26,7 +26,7 @@ {%= hyphaInfoEntry(h, u, "rename", lc.Get("ui.rename_link")) %} {%= hyphaInfoEntry(h, u, "delete", lc.Get("ui.delete_link")) %} {%= hyphaInfoEntry(h, u, "text", lc.Get("ui.text_link")) %} - {%= hyphaInfoEntry(h, u, "attachment", lc.Get("ui.attachment_link")) %} + {%= hyphaInfoEntry(h, u, "media", lc.Get("ui.media_link")) %} {%= hyphaInfoEntry(h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) %} diff --git a/views/nav.qtpl.go b/views/nav.qtpl.go index 5ce4d5c..d167cca 100644 --- a/views/nav.qtpl.go +++ b/views/nav.qtpl.go @@ -137,7 +137,7 @@ func streamhyphaInfo(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha qw422016.N().S(` `) //line views/nav.qtpl:29 - streamhyphaInfoEntry(qw422016, h, u, "attachment", lc.Get("ui.attachment_link")) + streamhyphaInfoEntry(qw422016, h, u, "media", lc.Get("ui.media_link")) //line views/nav.qtpl:29 qw422016.N().S(` `) diff --git a/views/readers.qtpl b/views/readers.qtpl index 25a12ee..dd0ee53 100644 --- a/views/readers.qtpl +++ b/views/readers.qtpl @@ -11,18 +11,18 @@ {% import "github.com/bouncepaw/mycorrhiza/user" %} {% import "github.com/bouncepaw/mycorrhiza/util" %} -{% func AttachmentMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) %} +{% func MediaMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) %} {% code lc := l18n.FromRequest(rq) %}
-
-

{%s= lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}

+
+

{%s= lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}

{% switch h.(type) %} {% case *hyphae.MediaHypha %} -

{%s lc.Get("ui.attach_tip") %} {%s lc.Get("ui.attach_link") %}

+

{%s lc.Get("ui.media_tip") %} {%s lc.Get("ui.media_what_is") %}

{% default %} -

{%s lc.Get("ui.attach_empty") %} {%s lc.Get("ui.attach_link") %}

+

{%s lc.Get("ui.media_empty") %} {%s lc.Get("ui.media_what_is") %}

{% endswitch %}
@@ -33,16 +33,16 @@ fileinfo, err := os.Stat(h.MediaFilePath()) %} {% if err == nil %}
- {%s lc.Get("ui.attach_stat") %} - -

{%s lc.Get("ui.attach_stat_mime") %} {%s mime %}

+ {%s lc.Get("ui.media_stat") %} + +

{%s lc.Get("ui.media_stat_mime") %} {%s mime %}

{% endif %} {% if strings.HasPrefix(mime, "image/") %}
- {%s lc.Get("ui.attach_include") %} - + {%s lc.Get("ui.media_include") %} +
img { {%s h.CanonicalName() %} }
{% endif %} @@ -53,12 +53,12 @@ method="post" enctype="multipart/form-data" class="upload-binary modal amnt-menu-block"> {% endif %} @@ -66,12 +66,12 @@ {% switch h := h.(type) %} {% case *hyphae.MediaHypha %} - {% if u.CanProceed("unattach-confirm") %} - {% endif %} diff --git a/views/readers.qtpl.go b/views/readers.qtpl.go index 87b26cf..9e02bd5 100644 --- a/views/readers.qtpl.go +++ b/views/readers.qtpl.go @@ -51,7 +51,7 @@ var ( ) //line views/readers.qtpl:14 -func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) { +func StreamMediaMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) { //line views/readers.qtpl:14 qw422016.N().S(` `) @@ -61,10 +61,10 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp //line views/readers.qtpl:17 qw422016.N().S(`
-
+

`) //line views/readers.qtpl:20 - qw422016.N().S(lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())})) + qw422016.N().S(lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())})) //line views/readers.qtpl:20 qw422016.N().S(`

`) @@ -76,11 +76,11 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp qw422016.N().S(`

`) //line views/readers.qtpl:23 - qw422016.E().S(lc.Get("ui.attach_tip")) + qw422016.E().S(lc.Get("ui.media_tip")) //line views/readers.qtpl:23 - qw422016.N().S(` `) + qw422016.N().S(` `) //line views/readers.qtpl:23 - qw422016.E().S(lc.Get("ui.attach_link")) + qw422016.E().S(lc.Get("ui.media_what_is")) //line views/readers.qtpl:23 qw422016.N().S(`

`) @@ -90,11 +90,11 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp qw422016.N().S(`

`) //line views/readers.qtpl:25 - qw422016.E().S(lc.Get("ui.attach_empty")) + qw422016.E().S(lc.Get("ui.media_empty")) //line views/readers.qtpl:25 - qw422016.N().S(` `) + qw422016.N().S(` `) //line views/readers.qtpl:25 - qw422016.E().S(lc.Get("ui.attach_link")) + qw422016.E().S(lc.Get("ui.media_what_is")) //line views/readers.qtpl:25 qw422016.N().S(`

`) @@ -126,21 +126,21 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
`) //line views/readers.qtpl:36 - qw422016.E().S(lc.Get("ui.attach_stat")) + qw422016.E().S(lc.Get("ui.media_stat")) //line views/readers.qtpl:36 qw422016.N().S(`

`) //line views/readers.qtpl:38 - qw422016.E().S(lc.Get("ui.attach_stat_mime")) + qw422016.E().S(lc.Get("ui.media_stat_mime")) //line views/readers.qtpl:38 qw422016.N().S(` `) //line views/readers.qtpl:38 @@ -162,12 +162,12 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp

`) //line views/readers.qtpl:44 - qw422016.E().S(lc.Get("ui.attach_include")) + qw422016.E().S(lc.Get("ui.media_include")) //line views/readers.qtpl:44 qw422016.N().S(`
img { `)
@@ -202,12 +202,12 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
 		
@@ -236,28 +236,28 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
 		qw422016.N().S(`
 		`)
 //line views/readers.qtpl:69
-		if u.CanProceed("unattach-confirm") {
+		if u.CanProceed("remove-media") {
 //line views/readers.qtpl:69
 			qw422016.N().S(`
-