Skip to content

Commit 306ba96

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (28 commits) Update hacking-on-gitea-zh_cn documentation (go-gitea#23315) Fix broken code editor diff preview (go-gitea#23307) [skip ci] Updated translations via Crowdin Add context when rendering labels or emojis (go-gitea#23281) Change interactiveBorder to fix popup preview (go-gitea#23169) Improve the frontend guideline (go-gitea#23298) Scoped labels: set aria-disabled on muted Exclusive option for a11y (go-gitea#23306) Add basic documentation for labels, including scoped labels (go-gitea#23304) [skip ci] Updated translations via Crowdin Re-add accidentally removed `hacking-on-gitea.zh-cn.md` (go-gitea#23297) Add default owner team to privated_org and limited_org in unit test (go-gitea#23109) Improve sed detection in update-locales.sh (go-gitea#23254) Support sanitising the URL by removing extra slashes in the URL (go-gitea#21333) Make Ctrl+Enter submit a pending comment (starting review) instead of submitting a single comment (go-gitea#23245) Avoid panic caused by broken payload when creating commit status (go-gitea#23216) Add run status in action view page (go-gitea#23212) update to mermaid v10 (go-gitea#23178) Fix code wrap for unbroken lines (go-gitea#23268) Fix stray backticks appearing in pull request timeline (go-gitea#23282) Fill head commit to in payload when notifying push commits for mirroring (go-gitea#23215) ...
2 parents 5fc7a9e + e080013 commit 306ba96

File tree

109 files changed

+1507
-507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1507
-507
lines changed

build/update-locales.sh

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

3-
set -e
4-
5-
SED=sed
3+
# this script runs in alpine image which only has `sh` shell
64

7-
if [[ $OSTYPE == 'darwin'* ]]; then
8-
# for macOS developers, use "brew install gnu-sed"
9-
SED=gsed
5+
set +e
6+
if sed --version 2>/dev/null | grep -q GNU; then
7+
SED_INPLACE="sed -i"
8+
else
9+
SED_INPLACE="sed -i ''"
1010
fi
11+
set -e
1112

1213
if [ ! -f ./options/locale/locale_en-US.ini ]; then
1314
echo "please run this script in the root directory of the project"
@@ -32,7 +33,7 @@ mv ./options/locale/locale_en-US.ini ./options/
3233
# * remove the trailing quote
3334
# * unescape the quotes
3435
# * eg: key="...\"..." => key=..."...
35-
$SED -i -r -e '/^[-.A-Za-z0-9_]+[ ]*=[ ]*".*"$/ {
36+
$SED_INPLACE -r -e '/^[-.A-Za-z0-9_]+[ ]*=[ ]*".*"$/ {
3637
s/^([-.A-Za-z0-9_]+)[ ]*=[ ]*"/\1=/
3738
s/"$//
3839
s/\\"/"/g
@@ -41,8 +42,8 @@ $SED -i -r -e '/^[-.A-Za-z0-9_]+[ ]*=[ ]*".*"$/ {
4142
# * if the escaped line is incomplete like `key="...` or `key=..."`, quote it with backticks
4243
# * eg: key="... => key=`"...`
4344
# * eg: key=..." => key=`..."`
44-
$SED -i -r -e 's/^([-.A-Za-z0-9_]+)[ ]*=[ ]*(".*[^"])$/\1=`\2`/' ./options/locale/*.ini
45-
$SED -i -r -e 's/^([-.A-Za-z0-9_]+)[ ]*=[ ]*([^"].*")$/\1=`\2`/' ./options/locale/*.ini
45+
$SED_INPLACE -r -e 's/^([-.A-Za-z0-9_]+)[ ]*=[ ]*(".*[^"])$/\1=`\2`/' ./options/locale/*.ini
46+
$SED_INPLACE -r -e 's/^([-.A-Za-z0-9_]+)[ ]*=[ ]*([^"].*")$/\1=`\2`/' ./options/locale/*.ini
4647

4748
# Remove translation under 25% of en_us
4849
baselines=$(wc -l "./options/locale_en-US.ini" | cut -d" " -f1)

docs/content/doc/developers/guidelines-frontend.en-us.md

+18
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
4747
7. Clarify variable types, prefer `elem.disabled = true` instead of `elem.setAttribute('disabled', 'anything')`, prefer `$el.prop('checked', var === 'yes')` instead of `$el.prop('checked', var)`.
4848
8. Use semantic elements, prefer `<button class="ui button">` instead of `<div class="ui button">`.
4949
9. Avoid unnecessary `!important` in CSS, add comments to explain why it's necessary if it can't be avoided.
50+
10. Avoid mixing different events in one event listener, prefer to use individual event listeners for every event.
51+
11. Custom event names are recommended to use `ce-` prefix.
5052

5153
### Accessibility / ARIA
5254

@@ -109,6 +111,22 @@ However, there are still some special cases, so the current guideline is:
109111
* Vue components are recommended to use `v-if` and `v-show` to show/hide elements.
110112
* Go template code should use Gitea's `.gt-hidden` and `showElem()/hideElem()/toggleElem()`, see more details in `.gt-hidden`'s comment.
111113

114+
### Styles and Attributes in Go HTML Template
115+
116+
It's recommended to use:
117+
118+
```html
119+
<div class="gt-name1 gt-name2 {{if .IsFoo}}gt-foo{{end}}" {{if .IsFoo}}data-foo{{end}}></div>
120+
```
121+
122+
instead of:
123+
124+
```html
125+
<div class="gt-name1 gt-name2{{if .IsFoo}} gt-foo{{end}}"{{if .IsFoo}} data-foo{{end}}></div>
126+
```
127+
128+
to make the code more readable.
129+
112130
### Legacy Code
113131

114132
A lot of legacy code already existed before this document's written. It's recommended to refactor legacy code to follow the guidelines.

0 commit comments

Comments
 (0)