0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-19 00:11:24 +01:00

Add placeholder and aria attributes to release and wiki edit page (#24031)

- Add placeholders and aria-label all input fields on these two pages
- Add margin before wiki change message
- Remove labels from release page, replacing them with aria-label
This commit is contained in:
silverwind 2023-04-10 17:56:57 +02:00 committed by GitHub
parent cb1536471b
commit d7552c27d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 18 deletions

View file

@ -1746,6 +1746,8 @@ wiki.create_first_page = Create the First Page
wiki.page = Page wiki.page = Page
wiki.filter_page = Filter page wiki.filter_page = Filter page
wiki.new_page = Page wiki.new_page = Page
wiki.page_title = Page title
wiki.page_content = Page content
wiki.default_commit_message = Write a note about this page update (optional). wiki.default_commit_message = Write a note about this page update (optional).
wiki.save_page = Save Page wiki.save_page = Save Page
wiki.last_commit_info = %s edited this page %s wiki.last_commit_info = %s edited this page %s
@ -2311,9 +2313,9 @@ release.target = Target
release.tag_helper = Choose an existing tag or create a new tag. release.tag_helper = Choose an existing tag or create a new tag.
release.tag_helper_new = New tag. This tag will be created from the target. release.tag_helper_new = New tag. This tag will be created from the target.
release.tag_helper_existing = Existing tag. release.tag_helper_existing = Existing tag.
release.title = Title release.title = Release title
release.title_empty = Title cannot be empty. release.title_empty = Title cannot be empty.
release.content = Content release.message = Describe this release
release.prerelease_desc = Mark as Pre-Release release.prerelease_desc = Mark as Pre-Release
release.prerelease_helper = Mark this release unsuitable for production use. release.prerelease_helper = Mark this release unsuitable for production use.
release.cancel = Cancel release.cancel = Cancel

View file

@ -19,7 +19,7 @@
{{if .PageIsEditRelease}} {{if .PageIsEditRelease}}
<b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong> <b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong>
{{else}} {{else}}
<input id="tag-name" name="tag_name" value="{{.tag_name}}" placeholder="{{.locale.Tr "repo.release.tag_name"}}" autofocus required maxlength="255"> <input id="tag-name" name="tag_name" value="{{.tag_name}}" aria-label="{{.locale.Tr "repo.release.tag_name"}}" placeholder="{{.locale.Tr "repo.release.tag_name"}}" autofocus required maxlength="255">
<input id="tag-name-editor" type="hidden" data-existing-tags={{Json .Tags}} data-tag-helper={{.locale.Tr "repo.release.tag_helper"}} data-tag-helper-new={{.locale.Tr "repo.release.tag_helper_new"}} data-tag-helper-existing={{.locale.Tr "repo.release.tag_helper_existing"}}> <input id="tag-name-editor" type="hidden" data-existing-tags={{Json .Tags}} data-tag-helper={{.locale.Tr "repo.release.tag_helper"}} data-tag-helper-new={{.locale.Tr "repo.release.tag_helper_new"}} data-tag-helper-existing={{.locale.Tr "repo.release.tag_helper_existing"}}>
<div id="tag-target-selector" class="gt-dib"> <div id="tag-target-selector" class="gt-dib">
<span class="at">@</span> <span class="at">@</span>
@ -39,25 +39,24 @@
</div> </div>
</div> </div>
<div> <div>
<span id="tag-helper" class="help gt-mt-2">{{.locale.Tr "repo.release.tag_helper"}}</span> <span id="tag-helper" class="help gt-mt-3 gt-pb-0">{{.locale.Tr "repo.release.tag_helper"}}</span>
</div> </div>
{{end}} {{end}}
</div> </div>
</div> </div>
<div class="eleven wide column"> <div class="eleven wide column gt-pt-0">
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">
<label>{{.locale.Tr "repo.release.title"}}</label> <input name="title" aria-label="{{.locale.Tr "repo.release.title"}}" placeholder="{{.locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255">
<input name="title" placeholder="{{.locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255">
</div> </div>
<div class="field"> <div class="field">
<label>{{.locale.Tr "repo.release.content"}}</label>
{{template "shared/combomarkdowneditor" (dict {{template "shared/combomarkdowneditor" (dict
"locale" $.locale "locale" $.locale
"MarkdownPreviewUrl" (print .Repository.Link "/markup") "MarkdownPreviewUrl" (print .Repository.Link "/markup")
"MarkdownPreviewContext" .RepoLink "MarkdownPreviewContext" .RepoLink
"TextareaName" "content" "TextareaName" "content"
"TextareaContent" .content "TextareaContent" .content
"TextareaPlaceholder" (.locale.Tr "repo.release.message")
"TextareaAriaLabel" (.locale.Tr "repo.release.message")
"DropzoneParentContainer" "form" "DropzoneParentContainer" "form"
)}} )}}
</div> </div>

View file

@ -14,7 +14,7 @@
<form class="ui form" action="{{.Link}}?action={{if .PageIsWikiEdit}}_edit{{else}}_new{{end}}" method="post"> <form class="ui form" action="{{.Link}}?action={{if .PageIsWikiEdit}}_edit{{else}}_new{{end}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">
<input name="title" value="{{.title}}" autofocus required> <input name="title" value="{{.title}}" aria-label="{{.locale.Tr "repo.wiki.page_title"}}" placeholder="{{.locale.Tr "repo.wiki.page_title"}}" autofocus required>
</div> </div>
<div class="help"> <div class="help">
{{.locale.Tr "repo.wiki.page_name_desc"}} {{.locale.Tr "repo.wiki.page_name_desc"}}
@ -29,11 +29,13 @@
"MarkdownPreviewUrl" (print .Repository.Link "/markup") "MarkdownPreviewUrl" (print .Repository.Link "/markup")
"MarkdownPreviewContext" .RepoLink "MarkdownPreviewContext" .RepoLink
"TextareaName" "content" "TextareaName" "content"
"TextareaPlaceholder" (.locale.Tr "repo.wiki.page_content")
"TextareaAriaLabel" (.locale.Tr "repo.wiki.page_content")
"TextareaContent" $content "TextareaContent" $content
)}} )}}
<div class="field"> <div class="field gt-mt-4">
<input name="message" placeholder="{{.locale.Tr "repo.wiki.default_commit_message"}}"> <input name="message" aria-label="{{.locale.Tr "repo.wiki.default_commit_message"}}" placeholder="{{.locale.Tr "repo.wiki.default_commit_message"}}">
</div> </div>
<div class="text right"> <div class="text right">
<button class="ui green button"> <button class="ui green button">

View file

@ -1,10 +1,15 @@
{{/* {{/*
Template Attributes: Template Attributes:
* locale * locale: passed through for localization
* ContainerId / ContainerClasses : for the container element * ContainerId: id attribute for the container element
* MarkdownPreviewUrl / MarkdownPreviewContext: for the preview tab * ContainerClasses: additional classes for the container element
* TextareaName / TextareaContent / TextareaPlaceholder: for the main textarea * MarkdownPreviewUrl: preview url for the preview tab
* DropzoneParentContainer: for file upload (leave it empty if no upload) * MarkdownPreviewContext: preview context for the preview tab
* TextareaName: name attribute for the textarea
* TextareaContent: content for the textarea
* TextareaPlaceholder: placeholder attribute for the textarea
* TextareaAriaLabel: aria-label attribute for the textarea
* DropzoneParentContainer: container for file upload (leave it empty if no upload)
*/}} */}}
<div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}"> <div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}">
{{if .MarkdownPreviewUrl}} {{if .MarkdownPreviewUrl}}
@ -40,7 +45,7 @@ Template Attributes:
</div> </div>
</markdown-toolbar> </markdown-toolbar>
<text-expander keys=": @"> <text-expander keys=": @">
<textarea class="markdown-text-editor js-quick-submit" name="{{.TextareaName}}" placeholder="{{.TextareaPlaceholder}}">{{.TextareaContent}}</textarea> <textarea class="markdown-text-editor js-quick-submit"{{if .TextareaName}} name="{{.TextareaName}}"{{end}}{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end}}{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end}}>{{.TextareaContent}}</textarea>
</text-expander> </text-expander>
</div> </div>
<div class="ui tab markup" data-tab-panel="markdown-previewer"> <div class="ui tab markup" data-tab-panel="markdown-previewer">