Refactor repo-legacy.js, remove messy global variables. Fix errors. (#17646)

Refactor repo-legacy.js, remove messy global variables. Fix errors.
Fix an error in Sortable
Fix a incorrect call assignMenuAttributes from the template
This commit is contained in:
2021-11-19 00:45:00 +08:00
committed by GitHub
parent e1d655991b
commit 55be5fe339
4 changed files with 199 additions and 202 deletions

View File

@ -74,7 +74,7 @@ or if sqlite support is required:
The `build` target is split into two sub-targets:
- `make backend` which requires [Go 1.16](https://golang.org/dl/) or greater.
- `make frontend` which requires [Node.js 12.17](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
- `make frontend` which requires [Node.js LTS](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js and Internet connectivity.

View File

@ -9,7 +9,7 @@
<input type="hidden" name="diff_start_cid">
<input type="hidden" name="diff_end_cid">
<input type="hidden" name="diff_base_cid">
<div class="ui top tabular menu" {{if not $.hidden}}onload="assignMenuAttributes(this)" {{end}}data-write="write" data-preview="preview">
<div class="ui top tabular menu" data-write="write" data-preview="preview">
<a class="active item" data-tab="write">{{$.root.i18n.Tr "write"}}</a>
<a class="item" data-tab="preview" data-url="{{$.root.Repository.APIURL}}/markdown" data-context="{{$.root.RepoLink}}">{{$.root.i18n.Tr "preview"}}</a>
</div>

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@
const {csrfToken} = window.config;
async function initRepoProjectSortable() {
const els = document.getElementsByClassName('board');
if (!els.length) return;
const {Sortable} = await import(/* webpackChunkName: "sortable" */'sortablejs');
const boardColumns = document.getElementsByClassName('board-column');
new Sortable(
document.getElementsByClassName('board')[0],
els[0],
{
group: 'board-column',
draggable: '.board-column',