mirror of
https://github.com/go-gitea/gitea
synced 2024-11-11 04:21:21 +01:00
parent
fe9a631939
commit
5d2afc6e4f
4 changed files with 28 additions and 21 deletions
|
@ -77,13 +77,13 @@
|
||||||
<p class="activity meta">
|
<p class="activity meta">
|
||||||
<i>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://docs.gitea.com/development/oauth2-provider#scopes" target="_blank"`|SafeHTML)}}</i>
|
<i>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://docs.gitea.com/development/oauth2-provider#scopes" target="_blank"`|SafeHTML)}}</i>
|
||||||
</p>
|
</p>
|
||||||
<div class="scoped-access-token-mount">
|
<div id="scoped-access-token-selector"
|
||||||
<scoped-access-token-selector
|
data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
|
||||||
:is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
|
data-no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}"
|
||||||
no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}"
|
data-read-label="{{ctx.Locale.Tr "settings.permission_read"}}"
|
||||||
read-label="{{ctx.Locale.Tr "settings.permission_read"}}"
|
data-write-label="{{ctx.Locale.Tr "settings.permission_write"}}"
|
||||||
write-label="{{ctx.Locale.Tr "settings.permission_write"}}"
|
data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}"
|
||||||
></scoped-access-token-selector>
|
>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
<button id="scoped-access-submit" class="ui primary button">
|
<button id="scoped-access-submit" class="ui primary button">
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script>
|
<script>
|
||||||
import {createApp} from 'vue';
|
|
||||||
import {hideElem, showElem} from '../utils/dom.js';
|
import {hideElem, showElem} from '../utils/dom.js';
|
||||||
|
|
||||||
const sfc = {
|
const sfc = {
|
||||||
|
@ -73,18 +72,6 @@ const sfc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sfc;
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-for="category in categories" :key="category" class="field tw-pl-1 tw-pb-1 access-token-category">
|
<div v-for="category in categories" :key="category" class="field tw-pl-1 tw-pb-1 access-token-category">
|
||||||
|
|
20
web_src/js/features/scoped-access-token.js
Normal file
20
web_src/js/features/scoped-access-token.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import {createApp} from 'vue';
|
||||||
|
|
||||||
|
export async function initScopedAccessTokenCategories() {
|
||||||
|
const el = document.querySelector('#scoped-access-token-selector');
|
||||||
|
if (!el) return;
|
||||||
|
|
||||||
|
const {default: ScopedAccessTokenSelector} = await import(/* webpackChunkName: "scoped-access-token-selector" */'../components/ScopedAccessTokenSelector.vue');
|
||||||
|
try {
|
||||||
|
const View = createApp(ScopedAccessTokenSelector, {
|
||||||
|
isAdmin: JSON.parse(el.getAttribute('data-is-admin')),
|
||||||
|
noAccessLabel: el.getAttribute('data-no-access-label'),
|
||||||
|
readLabel: el.getAttribute('data-read-label'),
|
||||||
|
writeLabel: el.getAttribute('data-write-label'),
|
||||||
|
});
|
||||||
|
View.mount(el);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('ScopedAccessTokenSelector failed to load', err);
|
||||||
|
el.textContent = el.getAttribute('data-locale-component-failed-to-load');
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,6 @@
|
||||||
import './bootstrap.js';
|
import './bootstrap.js';
|
||||||
|
|
||||||
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
|
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
|
||||||
import {initScopedAccessTokenCategories} from './components/ScopedAccessTokenSelector.vue';
|
|
||||||
import {initDashboardRepoList} from './components/DashboardRepoList.vue';
|
import {initDashboardRepoList} from './components/DashboardRepoList.vue';
|
||||||
|
|
||||||
import {initGlobalCopyToClipboardListener} from './features/clipboard.js';
|
import {initGlobalCopyToClipboardListener} from './features/clipboard.js';
|
||||||
|
@ -88,6 +87,7 @@ import {initDirAuto} from './modules/dirauto.js';
|
||||||
import {initRepositorySearch} from './features/repo-search.js';
|
import {initRepositorySearch} from './features/repo-search.js';
|
||||||
import {initColorPickers} from './features/colorpicker.js';
|
import {initColorPickers} from './features/colorpicker.js';
|
||||||
import {initAdminSelfCheck} from './features/admin/selfcheck.js';
|
import {initAdminSelfCheck} from './features/admin/selfcheck.js';
|
||||||
|
import {initScopedAccessTokenCategories} from './features/scoped-access-token.js';
|
||||||
|
|
||||||
// Init Gitea's Fomantic settings
|
// Init Gitea's Fomantic settings
|
||||||
initGiteaFomantic();
|
initGiteaFomantic();
|
||||||
|
|
Loading…
Reference in a new issue