diff options
author | silverwind <me@silverwind.io> | 2023-04-10 17:56:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-10 11:56:57 -0400 |
commit | d7552c27d38f5ad342fe1c17cedfb6e22ba4d5d8 (patch) | |
tree | 7122bbe1d50efba9bb623f8fae66782037147fc6 | |
parent | cb1536471bcef4d78a3fe5cbd738b9f60fabbcc2 (diff) | |
download | gitea-d7552c27d38f5ad342fe1c17cedfb6e22ba4d5d8.tar.gz gitea-d7552c27d38f5ad342fe1c17cedfb6e22ba4d5d8.zip |
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
-rw-r--r-- | options/locale/locale_en-US.ini | 6 | ||||
-rw-r--r-- | templates/repo/release/new.tmpl | 13 | ||||
-rw-r--r-- | templates/repo/wiki/new.tmpl | 8 | ||||
-rw-r--r-- | templates/shared/combomarkdowneditor.tmpl | 17 |
4 files changed, 26 insertions, 18 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index eb1ffebc37..7e9675ee73 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1746,6 +1746,8 @@ wiki.create_first_page = Create the First Page wiki.page = Page wiki.filter_page = Filter 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.save_page = Save Page 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_new = New tag. This tag will be created from the target. release.tag_helper_existing = Existing tag. -release.title = Title +release.title = Release title release.title_empty = Title cannot be empty. -release.content = Content +release.message = Describe this release release.prerelease_desc = Mark as Pre-Release release.prerelease_helper = Mark this release unsuitable for production use. release.cancel = Cancel diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index cd702d6aa6..7a4e28cffa 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -19,7 +19,7 @@ {{if .PageIsEditRelease}} <b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong> {{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"}}> <div id="tag-target-selector" class="gt-dib"> <span class="at">@</span> @@ -39,25 +39,24 @@ </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> {{end}} </div> </div> - <div class="eleven wide column"> + <div class="eleven wide column gt-pt-0"> <div class="field {{if .Err_Title}}error{{end}}"> - <label>{{.locale.Tr "repo.release.title"}}</label> - <input name="title" placeholder="{{.locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255"> + <input name="title" aria-label="{{.locale.Tr "repo.release.title"}}" placeholder="{{.locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255"> </div> <div class="field"> - <label>{{.locale.Tr "repo.release.content"}}</label> - {{template "shared/combomarkdowneditor" (dict "locale" $.locale "MarkdownPreviewUrl" (print .Repository.Link "/markup") "MarkdownPreviewContext" .RepoLink "TextareaName" "content" "TextareaContent" .content + "TextareaPlaceholder" (.locale.Tr "repo.release.message") + "TextareaAriaLabel" (.locale.Tr "repo.release.message") "DropzoneParentContainer" "form" )}} </div> diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index 57ab753e20..0765cb2c35 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -14,7 +14,7 @@ <form class="ui form" action="{{.Link}}?action={{if .PageIsWikiEdit}}_edit{{else}}_new{{end}}" method="post"> {{.CsrfTokenHtml}} <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 class="help"> {{.locale.Tr "repo.wiki.page_name_desc"}} @@ -29,11 +29,13 @@ "MarkdownPreviewUrl" (print .Repository.Link "/markup") "MarkdownPreviewContext" .RepoLink "TextareaName" "content" + "TextareaPlaceholder" (.locale.Tr "repo.wiki.page_content") + "TextareaAriaLabel" (.locale.Tr "repo.wiki.page_content") "TextareaContent" $content )}} - <div class="field"> - <input name="message" placeholder="{{.locale.Tr "repo.wiki.default_commit_message"}}"> + <div class="field gt-mt-4"> + <input name="message" aria-label="{{.locale.Tr "repo.wiki.default_commit_message"}}" placeholder="{{.locale.Tr "repo.wiki.default_commit_message"}}"> </div> <div class="text right"> <button class="ui green button"> diff --git a/templates/shared/combomarkdowneditor.tmpl b/templates/shared/combomarkdowneditor.tmpl index 887673e40e..38c7a48a3a 100644 --- a/templates/shared/combomarkdowneditor.tmpl +++ b/templates/shared/combomarkdowneditor.tmpl @@ -1,10 +1,15 @@ {{/* Template Attributes: -* locale -* ContainerId / ContainerClasses : for the container element -* MarkdownPreviewUrl / MarkdownPreviewContext: for the preview tab -* TextareaName / TextareaContent / TextareaPlaceholder: for the main textarea -* DropzoneParentContainer: for file upload (leave it empty if no upload) +* locale: passed through for localization +* ContainerId: id attribute for the container element +* ContainerClasses: additional classes for the container element +* MarkdownPreviewUrl: preview url for the preview tab +* 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}}"> {{if .MarkdownPreviewUrl}} @@ -40,7 +45,7 @@ Template Attributes: </div> </markdown-toolbar> <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> </div> <div class="ui tab markup" data-tab-panel="markdown-previewer"> |