Skip to content

Commit

Permalink
Merge pull request '[v7.0/forgejo] [UI] Fix scoped-access-token' (#46…
Browse files Browse the repository at this point in the history
…71) from bp-v7.0/forgejo-aa5163d into v7.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4671
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
  • Loading branch information
Earl Warren committed Jul 24, 2024
2 parents d7686aa + 88426b5 commit 68ceacf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 6 additions & 8 deletions templates/user/settings/applications.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@
<p class="activity meta">
<i>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://forgejo.org/docs/latest/user/token-scope/" target="_blank"`|SafeHTML)}}</i>
</p>
<div class="scoped-access-token-mount">
<scoped-access-token-selector
:is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}"
read-label="{{ctx.Locale.Tr "settings.permission_read"}}"
write-label="{{ctx.Locale.Tr "settings.permission_write"}}"
></scoped-access-token-selector>
</div>
<div class="scoped-access-token"
data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
data-no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}"
data-read-label="{{ctx.Locale.Tr "settings.permission_read"}}"
data-write-label="{{ctx.Locale.Tr "settings.permission_write"}}"
></div>
</details>
<button id="scoped-access-submit" class="ui primary button">
{{ctx.Locale.Tr "settings.generate_token"}}
Expand Down
11 changes: 7 additions & 4 deletions web_src/js/components/ScopedAccessTokenSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ export default sfc;
* Initialize category toggle sections
*/
export function initScopedAccessTokenCategories() {
for (const el of document.getElementsByClassName('scoped-access-token-mount')) {
createApp({})
.component('scoped-access-token-selector', sfc)
.mount(el);
for (const el of document.getElementsByClassName('scoped-access-token')) {
createApp(sfc, {
isAdmin: el.getAttribute('data-is-admin') === 'true',
noAccessLabel: el.getAttribute('data-no-access-label'),
readLabel: el.getAttribute('data-read-label'),
writeLabel: el.getAttribute('data-write-label'),
}).mount(el);
}
}
Expand Down

0 comments on commit 68ceacf

Please sign in to comment.