Skip to content

Commit

Permalink
Enforce tab indendation in templates
Browse files Browse the repository at this point in the history
This adds editorconfig-checker [1] to lint the template files so they
conform the editorconfig files. I fixed all current identation issues
using the fix mode of eclint [2] and some manual corrections.

We can extend this linting to other files later, for now I'd like this
PR to focus on HTML template files only.

[1] https://github.com/editorconfig-checker/editorconfig-checker
[2] https://github.com/jedmao/eclint
  • Loading branch information
silverwind committed Apr 10, 2021
1 parent 84f5a0b commit 486d61f
Show file tree
Hide file tree
Showing 66 changed files with 677 additions and 608 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ insert_final_newline = true
[*.{go,tmpl,html}]
indent_style = tab

[templates/custom/*.tmpl]
insert_final_newline = false

[templates/swagger/v1_json.tmpl]
indent_style = space

[Makefile]
indent_style = tab

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ lint: lint-frontend lint-backend
lint-frontend: node_modules
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js
npx stylelint --color --max-warnings=0 web_src/less
npx editorconfig-checker templates

.PHONY: lint-backend
lint-backend: golangci-lint revive vet
Expand Down
70 changes: 70 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
},
"devDependencies": {
"eslint": "7.23.0",
"editorconfig-checker": "4.0.2",
"eslint-plugin-html": "6.1.2",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-unicorn": "29.0.0",
Expand Down
10 changes: 5 additions & 5 deletions templates/admin/auth/edit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
<input id="attribute_mail" name="attribute_mail" value="{{$cfg.AttributeMail}}" placeholder="e.g. mail" required>
</div>
<div class="field">
<label for="attribute_ssh_public_key">{{.i18n.Tr "admin.auths.attribute_ssh_public_key"}}</label>
<input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{$cfg.AttributeSSHPublicKey}}" placeholder="e.g. SshPublicKey">
<label for="attribute_ssh_public_key">{{.i18n.Tr "admin.auths.attribute_ssh_public_key"}}</label>
<input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{$cfg.AttributeSSHPublicKey}}" placeholder="e.g. SshPublicKey">
</div>
<div class="inline field">
<div class="ui checkbox">
Expand Down Expand Up @@ -215,9 +215,9 @@
<input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required>
</div>
<div class="optional field">
<label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
<input id="oauth2_icon_url" name="oauth2_icon_url" value="{{$cfg.IconURL}}">
</div>
<label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
<input id="oauth2_icon_url" name="oauth2_icon_url" value="{{$cfg.IconURL}}">
</div>
<div class="open_id_connect_auto_discovery_url required field">
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
<input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{$cfg.OpenIDConnectAutoDiscoveryURL}}">
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/auth/new.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
<span>{{.i18n.Tr "admin.auths.tip.nextcloud"}}</span>
<li>Yandex</li>
<span>{{.i18n.Tr "admin.auths.tip.yandex"}}</span>
<li>Mastodon</li>
<span>{{.i18n.Tr "admin.auths.tip.mastodon"}}</span>
<li>Mastodon</li>
<span>{{.i18n.Tr "admin.auths.tip.mastodon"}}</span>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/auth/source/ldap.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
<input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="e.g. mail">
</div>
<div class="field">
<label for="attribute_ssh_public_key">{{.i18n.Tr "admin.auths.attribute_ssh_public_key"}}</label>
<input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{.attribute_ssh_public_key}}" placeholder="e.g. SshPublicKey">
<label for="attribute_ssh_public_key">{{.i18n.Tr "admin.auths.attribute_ssh_public_key"}}</label>
<input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{.attribute_ssh_public_key}}" placeholder="e.g. SshPublicKey">
</div>
<div class="inline field">
<div class="ui checkbox">
Expand Down
6 changes: 3 additions & 3 deletions templates/admin/auth/source/oauth.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}">
</div>
<div class="optional field">
<label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
<input id="oauth2_icon_url" name="oauth2_icon_url" value="{{.oauth2_icon_url}}">
</div>
<label for="oauth2_icon_url">{{.i18n.Tr "admin.auths.oauth2_icon_url"}}</label>
<input id="oauth2_icon_url" name="oauth2_icon_url" value="{{.oauth2_icon_url}}">
</div>
<div class="open_id_connect_auto_discovery_url required field">
<label for="open_id_connect_auto_discovery_url">{{.i18n.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label>
<input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{.open_id_connect_auto_discovery_url}}">
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/base/search.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
<form class="ui form ignore-dirty" style="max-width: 90%">
<div class="ui fluid action input">
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
</div>
</form>
2 changes: 1 addition & 1 deletion templates/admin/repo/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{.i18n.Tr "admin.repos.repo_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}})
<div class="ui right">
<a class="ui blue tiny button" href="{{AppSubUrl}}/admin/repos/unadopted">{{.i18n.Tr "admin.repos.unadopted"}}</a>
</div>
</div>
</h4>
<div class="ui attached segment">
{{template "admin/repo/search" .}}
Expand Down
180 changes: 90 additions & 90 deletions templates/admin/repo/unadopted.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,98 +5,98 @@
{{template "base/alert" .}}
<h4 class="ui top attached header">
{{.i18n.Tr "admin.repos.unadopted"}}
<div class="ui right">
<a class="ui blue tiny button" href="{{AppSubUrl}}/admin/repos">{{.i18n.Tr "admin.repos.repo_manage_panel"}}</a>
</div>
<div class="ui right">
<a class="ui blue tiny button" href="{{AppSubUrl}}/admin/repos">{{.i18n.Tr "admin.repos.repo_manage_panel"}}</a>
</div>
</h4>
<div class="ui attached segment">
<form class="ui form ignore-dirty">
<div class="ui fluid action input">
<input name="search" value="true" type="hidden">
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.adopt_search"}}" autofocus>
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
</div>
</form>
<div class="ui attached segment">
<form class="ui form ignore-dirty">
<div class="ui fluid action input">
<input name="search" value="true" type="hidden">
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.adopt_search"}}" autofocus>
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
</div>
</form>
</div>
{{if .search}}
<div class="ui attached segment settings">
{{if .Dirs}}
<div class="ui middle aligned divided list">
{{range $dirI, $dir := .Dirs}}
<div class="item">
<div class="content">
<span class="icon">{{svg "octicon-file-directory"}}</span>
<span class="name">{{$dir}}</span>
<div class="right floated content">
<button class="ui button submit tiny green adopt show-modal" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{$.i18n.Tr "repo.adopt_preexisting_label"}}</span></button>
<div class="ui basic modal" id="adopt-unadopted-modal-{{$dirI}}">
{{svg "octicon-x" 16 "close inside"}}
<div class="header">
<span class="label">{{$.i18n.Tr "repo.adopt_preexisting"}}</span>
</div>
<div class="content">
<p>{{$.i18n.Tr "repo.adopt_preexisting_content" $dir}}</p>
</div>
<form class="ui form" method="POST" action="{{AppSubUrl}}/admin/repos/unadopted">
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="adopt">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
<div class="actions">
<div class="ui red basic inverted cancel button">
{{svg "octicon-trash" 16 "mr-2"}}
{{$.i18n.Tr "modal.no"}}
</div>
<button class="ui green basic inverted ok button">
{{svg "octicon-check" 16 "mr-2"}}
{{$.i18n.Tr "modal.yes"}}
</button>
</div>
</form>
</div>
<button class="ui button submit tiny red delete show-modal" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{$.i18n.Tr "repo.delete_preexisting_label"}}</span></button>
<div class="ui basic modal" id="delete-unadopted-modal-{{$dirI}}">
{{svg "octicon-x" 16 "close inside"}}
<div class="header">
<span class="label">{{$.i18n.Tr "repo.delete_preexisting"}}</span>
</div>
<div class="content">
<p>{{$.i18n.Tr "repo.delete_preexisting_content" $dir}}</p>
</div>
<form class="ui form" method="POST" action="{{AppSubUrl}}/admin/repos/unadopted">
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
<div class="actions">
<div class="ui red basic inverted cancel button">
{{svg "octicon-trash" 16 "mr-2"}}
{{$.i18n.Tr "modal.no"}}
</div>
<button class="ui green basic inverted ok button">
{{svg "octicon-check" 16 "mr-2"}}
{{$.i18n.Tr "modal.yes"}}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
{{end}}
</div>
{{template "base/paginate" .}}
{{else}}
<div class="item">
{{.i18n.Tr "admin.repos.unadopted.no_more"}}
</div>
{{template "base/paginate" .}}
{{end}}
</div>
{{end}}
</div>
{{if .search}}
<div class="ui attached segment settings">
{{if .Dirs}}
<div class="ui middle aligned divided list">
{{range $dirI, $dir := .Dirs}}
<div class="item">
<div class="content">
<span class="icon">{{svg "octicon-file-directory"}}</span>
<span class="name">{{$dir}}</span>
<div class="right floated content">
<button class="ui button submit tiny green adopt show-modal" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{$.i18n.Tr "repo.adopt_preexisting_label"}}</span></button>
<div class="ui basic modal" id="adopt-unadopted-modal-{{$dirI}}">
{{svg "octicon-x" 16 "close inside"}}
<div class="header">
<span class="label">{{$.i18n.Tr "repo.adopt_preexisting"}}</span>
</div>
<div class="content">
<p>{{$.i18n.Tr "repo.adopt_preexisting_content" $dir}}</p>
</div>
<form class="ui form" method="POST" action="{{AppSubUrl}}/admin/repos/unadopted">
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="adopt">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
<div class="actions">
<div class="ui red basic inverted cancel button">
{{svg "octicon-trash" 16 "mr-2"}}
{{$.i18n.Tr "modal.no"}}
</div>
<button class="ui green basic inverted ok button">
{{svg "octicon-check" 16 "mr-2"}}
{{$.i18n.Tr "modal.yes"}}
</button>
</div>
</form>
</div>
<button class="ui button submit tiny red delete show-modal" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{$.i18n.Tr "repo.delete_preexisting_label"}}</span></button>
<div class="ui basic modal" id="delete-unadopted-modal-{{$dirI}}">
{{svg "octicon-x" 16 "close inside"}}
<div class="header">
<span class="label">{{$.i18n.Tr "repo.delete_preexisting"}}</span>
</div>
<div class="content">
<p>{{$.i18n.Tr "repo.delete_preexisting_content" $dir}}</p>
</div>
<form class="ui form" method="POST" action="{{AppSubUrl}}/admin/repos/unadopted">
{{$.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{$dir}}">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}">
<div class="actions">
<div class="ui red basic inverted cancel button">
{{svg "octicon-trash" 16 "mr-2"}}
{{$.i18n.Tr "modal.no"}}
</div>
<button class="ui green basic inverted ok button">
{{svg "octicon-check" 16 "mr-2"}}
{{$.i18n.Tr "modal.yes"}}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
{{end}}
</div>
{{template "base/paginate" .}}
{{else}}
<div class="item">
{{.i18n.Tr "admin.repos.unadopted.no_more"}}
</div>
{{template "base/paginate" .}}
{{end}}
</div>
{{end}}
</div>
</div>

{{template "base/footer" .}}

0 comments on commit 486d61f

Please sign in to comment.