Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 18:56:11 +01:00
forgejo/web_src/js/components
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
..
.eslintrc.yaml Fix eslint parsing errors, remove eslint-plugin-html (#20323) 2022-07-15 17:38:18 +08:00
ActivityHeatmap.vue Add pagination for dashboard and user activity feeds (#22937) 2023-02-24 16:15:10 -05:00
ContextPopup.vue Improve the frontend guideline (#23298) 2023-03-05 22:23:42 +08:00
DashboardRepoList.js Fix incorrect checkbox behaviors in the dashboard repolist's filter (#23147) 2023-03-01 10:22:14 +08:00
DiffFileList.vue Move helpers to be prefixed with gt- (#22879) 2023-02-13 17:59:59 +00:00
DiffFileTree.vue Refactor hiding-methods, remove jQuery show/hide, remove .hide class, remove inline style=display:none (#22950) 2023-02-19 12:06:14 +08:00
DiffFileTreeItem.vue Add title to PR file tree items (#22918) 2023-02-16 00:57:25 -05:00
PullRequestMergeForm.vue Add force_merge to merge request and fix checking mergable (#23010) 2023-02-21 08:42:07 -06:00
RepoActionView.vue Add run status in action view page (#23212) 2023-03-04 00:41:37 -05:00
RepoActivityTopAuthors.vue Split index.js to separate files (#17315) 2021-10-17 01:28:04 +08:00
RepoBranchTagDropdown.js Refactor from Vue2 to Vue3 (#20044) 2022-10-01 22:26:38 +08:00
VueComponentLoader.js Update JS dependencies and eslint config (#21388) 2022-10-10 20:02:20 +08:00