You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix project board bug and improve documents (go-gitea#17753)
* the project board was broken, this PR fixes it, and refactor the code, and we prevent the uncategorized column from being dragged.
* improve the frontend guideline (as discussed in go-gitea#17699)
Copy file name to clipboardExpand all lines: docs/content/doc/developers/guidelines-frontend.md
+26
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,19 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
40
40
7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue2 (or Vue3 in future).
41
41
42
42
43
+
### Framework Usage
44
+
45
+
Mixing different frameworks together is highly discouraged. A JavaScript module should follow one major framework and follow the framework's best practice.
46
+
47
+
Recommended implementations:
48
+
* Vue + Native
49
+
* Fomantic-UI (jQuery)
50
+
* Native only
51
+
52
+
Discouraged implementations:
53
+
* Vue + jQuery
54
+
* jQuery + Native
55
+
43
56
### `async` Functions
44
57
45
58
Only mark a function as `async` if and only if there are `await` calls
@@ -98,6 +111,19 @@ $('#el').on('click', async (e) => { // not recommended but acceptable
98
111
});
99
112
```
100
113
114
+
### HTML Attributes and `dataset`
115
+
116
+
We forbid `dataset` usage, its camel-casing behaviour makes it hard to grep for attributes. However there are still some special cases, so the current guideline is:
117
+
118
+
* For legacy code:
119
+
*`$.data()` should be refactored to `$.attr()`.
120
+
*`$.data()` can be used to bind some non-string data to elements in rare cases, but it is highly discouraged.
121
+
122
+
* For new code:
123
+
*`node.dataset` should not be used, use `node.getAttribute` instead.
124
+
* never bind any user data to a DOM node, use a suitable design pattern to describe the relation between node and data.
125
+
126
+
101
127
### Vue2/Vue3 and JSX
102
128
103
129
Gitea is using Vue2 now, we plan to upgrade to Vue3. We decided not to introduce JSX to keep the HTML and the JavaScript code separated.
0 commit comments