|
50 | 50 | </div>
|
51 | 51 | </div>
|
52 | 52 | <div class="ui bottom attached segment">
|
53 |
| - <h5 class="ui top header"> |
54 |
| - {{ctx.Locale.Tr "settings.generate_new_token"}} |
55 |
| - </h5> |
56 |
| - <form id="scoped-access-form" class="ui form ignore-dirty" action="{{.Link}}" method="post"> |
57 |
| - {{.CsrfTokenHtml}} |
58 |
| - <div class="field {{if .Err_Name}}error{{end}}"> |
59 |
| - <label for="name">{{ctx.Locale.Tr "settings.token_name"}}</label> |
60 |
| - <input id="name" name="name" value="{{.name}}" autofocus required maxlength="255"> |
61 |
| - </div> |
62 |
| - <div class="field"> |
63 |
| - <label>{{ctx.Locale.Tr "settings.repo_and_org_access"}}</label> |
64 |
| - <label class="tw-cursor-pointer"> |
65 |
| - <input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="{{$.AccessTokenScopePublicOnly}}"> |
66 |
| - {{ctx.Locale.Tr "settings.permissions_public_only"}} |
67 |
| - </label> |
68 |
| - <label class="tw-cursor-pointer"> |
69 |
| - <input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="" checked> |
70 |
| - {{ctx.Locale.Tr "settings.permissions_access_all"}} |
71 |
| - </label> |
72 |
| - </div> |
73 |
| - <details class="ui optional field"> |
74 |
| - <summary class="tw-pb-4 tw-pl-1"> |
75 |
| - {{ctx.Locale.Tr "settings.select_permissions"}} |
76 |
| - </summary> |
77 |
| - <p class="activity meta"> |
78 |
| - <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> |
79 |
| - </p> |
80 |
| - <div id="scoped-access-token-selector" |
81 |
| - data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}" |
82 |
| - data-no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}" |
83 |
| - data-read-label="{{ctx.Locale.Tr "settings.permission_read"}}" |
84 |
| - data-write-label="{{ctx.Locale.Tr "settings.permission_write"}}" |
85 |
| - data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}" |
86 |
| - > |
| 53 | + <details {{if or .name (not .Tokens)}}open{{end}}> |
| 54 | + <summary><h4 class="ui header tw-inline-block tw-my-2">{{ctx.Locale.Tr "settings.generate_new_token"}}</h4></summary> |
| 55 | + <form class="ui form ignore-dirty" action="{{.Link}}" method="post"> |
| 56 | + {{.CsrfTokenHtml}} |
| 57 | + <div class="field {{if .Err_Name}}error{{end}}"> |
| 58 | + <label for="name">{{ctx.Locale.Tr "settings.token_name"}}</label> |
| 59 | + <input id="name" name="name" value="{{.name}}" required maxlength="255"> |
87 | 60 | </div>
|
88 |
| - </details> |
89 |
| - <button id="scoped-access-submit" class="ui primary button"> |
90 |
| - {{ctx.Locale.Tr "settings.generate_token"}} |
91 |
| - </button> |
92 |
| - </form>{{/* Fomantic ".ui.form .warning.message" is hidden by default, so put the warning message out of the form*/}} |
93 |
| - <div id="scoped-access-warning" class="ui warning message center tw-hidden"> |
94 |
| - {{ctx.Locale.Tr "settings.at_least_one_permission"}} |
95 |
| - </div> |
| 61 | + <div class="field"> |
| 62 | + <div class="tw-my-2">{{ctx.Locale.Tr "settings.repo_and_org_access"}}</div> |
| 63 | + <label class="gt-checkbox"> |
| 64 | + <input type="radio" name="scope-public-only" value="{{$.AccessTokenScopePublicOnly}}"> {{ctx.Locale.Tr "settings.permissions_public_only"}} |
| 65 | + </label> |
| 66 | + <label class="gt-checkbox"> |
| 67 | + <input type="radio" name="scope-public-only" value="" checked> {{ctx.Locale.Tr "settings.permissions_access_all"}} |
| 68 | + </label> |
| 69 | + </div> |
| 70 | + <div> |
| 71 | + <div class="tw-my-2">{{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)}}</div> |
| 72 | + <table class="ui table unstackable tw-my-2"> |
| 73 | + {{range $category := .TokenCategories}} |
| 74 | + <tr> |
| 75 | + <td>{{$category}}</td> |
| 76 | + <td><label class="gt-checkbox"><input type="radio" name="scope-{{$category}}" value="" checked> {{ctx.Locale.Tr "settings.permission_no_access"}}</label></td> |
| 77 | + <td><label class="gt-checkbox"><input type="radio" name="scope-{{$category}}" value="read:{{$category}}"> {{ctx.Locale.Tr "settings.permission_read"}}</label></td> |
| 78 | + <td><label class="gt-checkbox"><input type="radio" name="scope-{{$category}}" value="write:{{$category}}"> {{ctx.Locale.Tr "settings.permission_write"}}</label></td> |
| 79 | + </tr> |
| 80 | + {{end}} |
| 81 | + </table> |
| 82 | + </div> |
| 83 | + <button class="ui primary button"> |
| 84 | + {{ctx.Locale.Tr "settings.generate_token"}} |
| 85 | + </button> |
| 86 | + </form> |
| 87 | + </details> |
96 | 88 | </div>
|
97 | 89 |
|
98 | 90 | {{if .EnableOAuth2}}
|
|
0 commit comments