1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-04 18:19:54 +00:00

Rename attachment to media

This commit is contained in:
Timur Ismagilov 2022-02-26 10:33:09 +03:00
parent d8699d46c0
commit 72e0f445fd
27 changed files with 190 additions and 190 deletions

View File

@ -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.

View File

@ -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.

33
help/en/media.myco Normal file
View File

@ -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.

View File

@ -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`.

View File

@ -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
)

View File

@ -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)

View File

@ -10,7 +10,7 @@
"topics": "Help topics",
"main": "Main",
"hypha": "Hypha",
"attachment": "Attachment",
"media": "Media",
"mycomarkup": "Mycomarkup",
"interface": "Interface",
"prevnext": "Previous/next",

View File

@ -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",

View File

@ -10,7 +10,7 @@
"topics": "Темы справки",
"main": "Введение",
"hypha": "Гифа",
"attachment": "Вложение",
"media": "Медиа",
"mycomarkup": "Микоразметка",
"interface": "Интерфейс",
"prevnext": "Назад/далее",

View File

@ -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": "Применить",

View File

@ -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,
)

View File

@ -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)
}

View File

@ -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
}

View File

@ -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: <code>%v</code>", hop.Errs)
}

View File

@ -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")
}

View File

@ -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 hyphas 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 {

View File

@ -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,

View File

@ -39,7 +39,7 @@
<label for="upload-binary__input"></label>
<input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.attach_upload")%}</button>
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.media_upload")%}</button>
</form>
</section>
</div>
@ -75,9 +75,9 @@
</h1>
{% 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" %}

View File

@ -213,7 +213,7 @@ func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u *
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
//line views/hypha.qtpl:42
qw422016.E().S(lc.Get("ui.attach_upload"))
qw422016.E().S(lc.Get("ui.media_upload"))
//line views/hypha.qtpl:42
qw422016.N().S(`</button>
</form>
@ -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

View File

@ -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)) %}
</ul>
</nav>

View File

@ -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(`
`)

View File

@ -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)
%}
<div class="layout">
<main class="main-width attachment-tab">
<h1>{%s= lc.Get("ui.attach_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}</h1>
<main class="main-width media-tab">
<h1>{%s= lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}) %}</h1>
{% switch h.(type) %}
{% case *hyphae.MediaHypha %}
<p class="explanation">{%s lc.Get("ui.attach_tip") %} <a href="/help/en/attachment" class="shy-link">{%s lc.Get("ui.attach_link") %}</a></p>
<p class="explanation">{%s lc.Get("ui.media_tip") %} <a href="/help/en/media" class="shy-link">{%s lc.Get("ui.media_what_is") %}</a></p>
{% default %}
<p class="explanation">{%s lc.Get("ui.attach_empty") %} <a href="/help/en/attachment" class="shy-link">{%s lc.Get("ui.attach_link") %}</a></p>
<p class="explanation">{%s lc.Get("ui.media_empty") %} <a href="/help/en/media" class="shy-link">{%s lc.Get("ui.media_what_is") %}</a></p>
{% endswitch %}
<section class="amnt-grid">
@ -33,16 +33,16 @@
fileinfo, err := os.Stat(h.MediaFilePath()) %}
{% if err == nil %}
<fieldset class="amnt-menu-block">
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_stat") %}</legend>
<p class="modal__confirmation-msg"><b>{%s lc.Get("ui.attach_stat_size") %}</b> {%s lc.GetPlural64("ui.attach_size_value", fileinfo.Size())%}</p>
<p><b>{%s lc.Get("ui.attach_stat_mime") %}</b> {%s mime %}</p>
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_stat") %}</legend>
<p class="modal__confirmation-msg"><b>{%s lc.Get("ui.media_stat_size") %}</b> {%s lc.GetPlural64("ui.media_size_value", fileinfo.Size())%}</p>
<p><b>{%s lc.Get("ui.media_stat_mime") %}</b> {%s mime %}</p>
</fieldset>
{% endif %}
{% if strings.HasPrefix(mime, "image/") %}
<fieldset class="amnt-menu-block">
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_include") %}</legend>
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_include_tip") %}</p>
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_include") %}</legend>
<p class="modal__confirmation-msg">{%s lc.Get("ui.media_include_tip") %}</p>
<pre class="codeblock"><code>img { {%s h.CanonicalName() %} }</code></pre>
</fieldset>
{% endif %}
@ -53,12 +53,12 @@
method="post" enctype="multipart/form-data"
class="upload-binary modal amnt-menu-block">
<fieldset class="modal__fieldset">
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_new") %}</legend>
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_new_tip") %}</p>
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_new") %}</legend>
<p class="modal__confirmation-msg">{%s lc.Get("ui.media_new_tip") %}</p>
<label for="upload-binary__input"></label>
<input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.attach_upload")%}</button>
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.media_upload")%}</button>
</fieldset>
</form>
{% endif %}
@ -66,12 +66,12 @@
{% switch h := h.(type) %}
{% case *hyphae.MediaHypha %}
{% if u.CanProceed("unattach-confirm") %}
<form action="/unattach-confirm/{%s h.CanonicalName() %}" method="post" class="modal amnt-menu-block">
{% if u.CanProceed("remove-media") %}
<form action="/remove-media/{%s h.CanonicalName() %}" method="post" class="modal amnt-menu-block" method="POST">
<fieldset class="modal__fieldset">
<legend class="modal__title modal__title_small">{%s lc.Get("ui.attach_remove") %}</legend>
<p class="modal__confirmation-msg">{%s lc.Get("ui.attach_remove_tip") %}</p>
<button type="submit" class="btn" value="Unattach">{%s lc.Get("ui.attach_remove_button") %}</button>
<legend class="modal__title modal__title_small">{%s lc.Get("ui.media_remove") %}</legend>
<p class="modal__confirmation-msg">{%s lc.Get("ui.media_remove_tip") %}</p>
<button type="submit" class="btn" value="Remove media">{%s lc.Get("ui.media_remove_button") %}</button>
</fieldset>
</form>
{% endif %}

View File

@ -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(`
<div class="layout">
<main class="main-width attachment-tab">
<main class="main-width media-tab">
<h1>`)
//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(`</h1>
`)
@ -76,11 +76,11 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
qw422016.N().S(`
<p class="explanation">`)
//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(` <a href="/help/en/attachment" class="shy-link">`)
qw422016.N().S(` <a href="/help/en/media" class="shy-link">`)
//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(`</a></p>
`)
@ -90,11 +90,11 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
qw422016.N().S(`
<p class="explanation">`)
//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(` <a href="/help/en/attachment" class="shy-link">`)
qw422016.N().S(` <a href="/help/en/media" class="shy-link">`)
//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(`</a></p>
`)
@ -126,21 +126,21 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
<fieldset class="amnt-menu-block">
<legend class="modal__title modal__title_small">`)
//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(`</legend>
<p class="modal__confirmation-msg"><b>`)
//line views/readers.qtpl:37
qw422016.E().S(lc.Get("ui.attach_stat_size"))
qw422016.E().S(lc.Get("ui.media_stat_size"))
//line views/readers.qtpl:37
qw422016.N().S(`</b> `)
//line views/readers.qtpl:37
qw422016.E().S(lc.GetPlural64("ui.attach_size_value", fileinfo.Size()))
qw422016.E().S(lc.GetPlural64("ui.media_size_value", fileinfo.Size()))
//line views/readers.qtpl:37
qw422016.N().S(`</p>
<p><b>`)
//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(`</b> `)
//line views/readers.qtpl:38
@ -162,12 +162,12 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
<fieldset class="amnt-menu-block">
<legend class="modal__title modal__title_small">`)
//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(`</legend>
<p class="modal__confirmation-msg">`)
//line views/readers.qtpl:45
qw422016.E().S(lc.Get("ui.attach_include_tip"))
qw422016.E().S(lc.Get("ui.media_include_tip"))
//line views/readers.qtpl:45
qw422016.N().S(`</p>
<pre class="codeblock"><code>img { `)
@ -202,12 +202,12 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
<fieldset class="modal__fieldset">
<legend class="modal__title modal__title_small">`)
//line views/readers.qtpl:56
qw422016.E().S(lc.Get("ui.attach_new"))
qw422016.E().S(lc.Get("ui.media_new"))
//line views/readers.qtpl:56
qw422016.N().S(`</legend>
<p class="modal__confirmation-msg">`)
//line views/readers.qtpl:57
qw422016.E().S(lc.Get("ui.attach_new_tip"))
qw422016.E().S(lc.Get("ui.media_new_tip"))
//line views/readers.qtpl:57
qw422016.N().S(`</p>
<label for="upload-binary__input"></label>
@ -215,7 +215,7 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
//line views/readers.qtpl:61
qw422016.E().S(lc.Get("ui.attach_upload"))
qw422016.E().S(lc.Get("ui.media_upload"))
//line views/readers.qtpl:61
qw422016.N().S(`</button>
</fieldset>
@ -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(`
<form action="/unattach-confirm/`)
<form action="/remove-media/`)
//line views/readers.qtpl:70
qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:70
qw422016.N().S(`" method="post" class="modal amnt-menu-block">
qw422016.N().S(`" method="post" class="modal amnt-menu-block" method="POST">
<fieldset class="modal__fieldset">
<legend class="modal__title modal__title_small">`)
//line views/readers.qtpl:72
qw422016.E().S(lc.Get("ui.attach_remove"))
qw422016.E().S(lc.Get("ui.media_remove"))
//line views/readers.qtpl:72
qw422016.N().S(`</legend>
<p class="modal__confirmation-msg">`)
//line views/readers.qtpl:73
qw422016.E().S(lc.Get("ui.attach_remove_tip"))
qw422016.E().S(lc.Get("ui.media_remove_tip"))
//line views/readers.qtpl:73
qw422016.N().S(`</p>
<button type="submit" class="btn" value="Unattach">`)
<button type="submit" class="btn" value="Remove media">`)
//line views/readers.qtpl:74
qw422016.E().S(lc.Get("ui.attach_remove_button"))
qw422016.E().S(lc.Get("ui.media_remove_button"))
//line views/readers.qtpl:74
qw422016.N().S(`</button>
</fieldset>
@ -281,22 +281,22 @@ func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h hyp
}
//line views/readers.qtpl:83
func WriteAttachmentMenuHTML(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
func WriteMediaMenuHTML(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
//line views/readers.qtpl:83
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:83
StreamAttachmentMenuHTML(qw422016, rq, h, u)
StreamMediaMenuHTML(qw422016, rq, h, u)
//line views/readers.qtpl:83
qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:83
}
//line views/readers.qtpl:83
func AttachmentMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) string {
func MediaMenuHTML(rq *http.Request, h hyphae.Hypha, u *user.User) string {
//line views/readers.qtpl:83
qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:83
WriteAttachmentMenuHTML(qb422016, rq, h, u)
WriteMediaMenuHTML(qb422016, rq, h, u)
//line views/readers.qtpl:83
qs422016 := string(qb422016.B)
//line views/readers.qtpl:83

View File

@ -168,7 +168,7 @@ It outputs a poorly formatted JSON, but it works and is valid.
<li><a href="/help/{%s lang %}">{%s lc.GetWithLocale(lang, "help.main") %}</a></li>
<li><a href="/help/{%s lang %}/hypha">{%s lc.GetWithLocale(lang, "help.hypha") %}</a>
<ul>
<li><a href="/help/{%s lang %}/attachment">{%s lc.GetWithLocale(lang, "help.attachment") %}</a></li>
<li><a href="/help/{%s lang %}/media">{%s lc.GetWithLocale(lang, "help.media") %}</a></li>
</ul>
</li>
<li><a href="/help/{%s lang %}/mycomarkup">{%s lc.GetWithLocale(lang, "help.mycomarkup") %}</a></li>

View File

@ -637,9 +637,9 @@ func streamhelpTopicsHTML(qw422016 *qt422016.Writer, lang string, lc *l18n.Local
//line views/stuff.qtpl:171
qw422016.E().S(lang)
//line views/stuff.qtpl:171
qw422016.N().S(`/attachment">`)
qw422016.N().S(`/media">`)
//line views/stuff.qtpl:171
qw422016.E().S(lc.GetWithLocale(lang, "help.attachment"))
qw422016.E().S(lc.GetWithLocale(lang, "help.media"))
//line views/stuff.qtpl:171
qw422016.N().S(`</a></li>
</ul>

View File

@ -228,7 +228,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
}
}
// handlerUploadBinary uploads a new attachment for the hypha.
// handlerUploadBinary uploads a new media for the hypha.
func handlerUploadBinary(w http.ResponseWriter, rq *http.Request) {
util.PrepareRq(rq)
rq.ParseMultipartForm(10 << 20) // Set upload limit

View File

@ -33,21 +33,21 @@ func initReaders(r *mux.Router) {
r.PathPrefix("/rev/").HandlerFunc(handlerRevision)
r.PathPrefix("/rev-text/").HandlerFunc(handlerRevisionText)
r.PathPrefix("/primitive-diff/").HandlerFunc(handlerPrimitiveDiff)
r.PathPrefix("/attachment/").HandlerFunc(handlerAttachment)
r.PathPrefix("/media/").HandlerFunc(handlerMedia)
}
func handlerAttachment(w http.ResponseWriter, rq *http.Request) {
func handlerMedia(w http.ResponseWriter, rq *http.Request) {
util.PrepareRq(rq)
var (
hyphaName = util.HyphaNameFromRq(rq, "attachment")
hyphaName = util.HyphaNameFromRq(rq, "media")
h = hyphae.ByName(hyphaName)
u = user.FromRequest(rq)
lc = l18n.FromRequest(rq)
)
util.HTTP200Page(w,
views.BaseHTML(
lc.Get("ui.attach_title", &l18n.Replacements{"name": util.BeautifulName(hyphaName)}),
views.AttachmentMenuHTML(rq, h, u),
lc.Get("ui.media_title", &l18n.Replacements{"name": util.BeautifulName(hyphaName)}),
views.MediaMenuHTML(rq, h, u),
lc,
u))
}
@ -216,7 +216,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
}
switch h := h.(type) {
case *hyphae.MediaHypha:
contents = views.AttachmentHTML(h, lc) + contents
contents = views.MediaHTML(h, lc) + contents
}
util.HTTP200Page(w,