1
0
mirror of https://github.com/go-gitea/gitea synced 2024-11-17 09:45:53 +01:00
gitea/docs/content/doc/developers
wxiaoguang 21a1d76911
Improve the frontend guideline (#23298)
### The CustomEvent prefix

There was already `ce-quick-submit`, the `ce-` prefix seems better than
`us-`. Rename the only `us-` prefixed `us-load-context-popup` to `ce-`
prefixed.

### Styles and Attributes in Go HTML Template

https://github.com/go-gitea/gitea/pull/21855#issuecomment-1429643073

Suggest to stick to `class="c1 {{if $var}}c2{{end}}"`

The readability and maintainability should be applied to the code which
is read by developers, but not for the generated outputs.

The template code is the code for developers, while the generated HTML
are only for browsers.

The `class="c1 {{if $var}}c2{{end}}"` style is clearer for developers
and more intuitive, and the generated HTML also makes browsers happy (a
few spaces do not affect anything)

Think about a more complex case:

* `class="{{if $active}}active{{end}} menu item {{if $show}}show{{end}}
{{if $warn}}warn{{end}}"`
* --vs--
* `class="{{if $active}}active {{end}}menu item{{if $show}}
show{{end}}{{if $warn}} warn{{end}}"`

The first style make it clearer to see each CSS class name with its
`{{if}}` block.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-05 22:23:42 +08:00
..
api-usage.en-us.md Remove insecure flag from curl (#21074) 2022-09-05 14:22:44 +01:00
api-usage.zh-cn.md Update curl usage in API docs (#21071) 2022-09-05 03:22:03 -04:00
guidelines-backend.en-us.md Fix typo in guidelines-backend.en-us.md (#22690) 2023-01-31 21:43:12 +00:00
guidelines-frontend.en-us.md Improve the frontend guideline (#23298) 2023-03-05 22:23:42 +08:00
guidelines-refactoring.en-us.md Nest metadata in refactoring docs (#23087) 2023-02-23 16:25:18 +08:00
hacking-on-gitea.en-us.md inline gitpod image (#21494) 2022-10-18 09:55:57 +08:00
hacking-on-gitea.zh-cn.md Re-add accidentally removed hacking-on-gitea.zh-cn.md (#23297) 2023-03-04 22:34:02 +01:00
integrations.en-us.md Pre-fill suggested New File 'name' and 'content' with Query Params (#16556) 2021-07-29 05:39:46 +02:00
integrations.zh-tw.md docs: Fix broken anchors in links to awesome-gitea (#16331) 2021-07-03 21:42:33 +01:00
migrations.en-us.md Add markdownlint (#20512) 2022-07-28 09:22:47 +08:00
migrations.zh-tw.md Add markdownlint (#20512) 2022-07-28 09:22:47 +08:00
oauth2-provider.en-us.md Support scoped access tokens (#20908) 2023-01-17 15:46:03 -06:00
oauth2-provider.zh-tw.md Use neutral language in comments and docs (#20135) 2022-06-25 17:50:12 -05:00