Move the scopes form/list view into a partial.
- The list of scopes that's displayed while creating a personal access token is identical to the list that's displayed while creating an OAuth application. Extract these into a partial. - The list of scopes that's displayed while in the show page for an OAuth token in the profile settings and admin settings are identical. Extract these into a partial.
This commit is contained in:
parent
4d6da770de
commit
990ae6b8e5
6 changed files with 19 additions and 30 deletions
|
@ -23,16 +23,7 @@
|
|||
%div
|
||||
%span.monospace= uri
|
||||
|
||||
- if @application.scopes.present?
|
||||
%tr
|
||||
%td
|
||||
Scopes
|
||||
%td
|
||||
%ul.scopes-list.append-bottom-0
|
||||
- @application.scopes.each do |scope|
|
||||
%li
|
||||
%span.scope-name= scope
|
||||
= "(#{t(scope, scope: [:doorkeeper, :scopes])})"
|
||||
= render partial: "shared/tokens/scopes_list"
|
||||
|
||||
.form-actions
|
||||
= link_to 'Edit', edit_admin_application_path(@application), class: 'btn btn-primary wide pull-left'
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
|
||||
.form-group
|
||||
= f.label :scopes, class: 'label-light'
|
||||
- @scopes.each do |scope|
|
||||
%fieldset
|
||||
= check_box_tag 'doorkeeper_application[scopes][]', scope, application.scopes.include?(scope), id: "doorkeeper_application_scopes_#{scope}"
|
||||
= label_tag "doorkeeper_application_scopes_#{scope}", scope
|
||||
%span= "(#{t(scope, scope: [:doorkeeper, :scopes])})"
|
||||
= render partial: 'shared/tokens/scopes_form', locals: { prefix: 'doorkeeper_application', token: application }
|
||||
|
||||
.prepend-top-default
|
||||
= f.submit 'Save application', class: "btn btn-create"
|
||||
|
|
|
@ -23,16 +23,7 @@
|
|||
%div
|
||||
%span.monospace= uri
|
||||
|
||||
- if @application.scopes.present?
|
||||
%tr
|
||||
%td
|
||||
Scopes
|
||||
%td
|
||||
%ul.scopes-list.append-bottom-0
|
||||
- @application.scopes.each do |scope|
|
||||
%li
|
||||
%span.scope-name= scope
|
||||
= "(#{t(scope, scope: [:doorkeeper, :scopes])})"
|
||||
= render partial: "shared/tokens/scopes_list"
|
||||
|
||||
.form-actions
|
||||
= link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary wide pull-left'
|
||||
|
|
|
@ -12,11 +12,7 @@
|
|||
|
||||
.form-group
|
||||
= f.label :scopes, class: 'label-light'
|
||||
- @scopes.each do |scope|
|
||||
%fieldset
|
||||
= check_box_tag 'personal_access_token[scopes][]', scope, @personal_access_token.scopes.include?(scope), id: "personal_access_token_scopes_#{scope}"
|
||||
= label_tag "personal_access_token_scopes_#{scope}", scope
|
||||
%span= "(#{t(scope, scope: [:doorkeeper, :scopes])})"
|
||||
= render partial: 'shared/tokens/scopes_form', locals: { prefix: 'personal_access_token', token: @personal_access_token }
|
||||
|
||||
.prepend-top-default
|
||||
= f.submit 'Create Personal Access Token', class: "btn btn-create"
|
||||
|
|
5
app/views/shared/tokens/_scopes_form.html.haml
Normal file
5
app/views/shared/tokens/_scopes_form.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- @scopes.each do |scope|
|
||||
%fieldset
|
||||
= check_box_tag "#{prefix}[scopes][]", scope, token.scopes.include?(scope), id: "#{prefix}_scopes_#{scope}"
|
||||
= label_tag "#{prefix}_scopes_#{scope}", scope
|
||||
%span= "(#{t(scope, scope: [:doorkeeper, :scopes])})"
|
10
app/views/shared/tokens/_scopes_list.html.haml
Normal file
10
app/views/shared/tokens/_scopes_list.html.haml
Normal file
|
@ -0,0 +1,10 @@
|
|||
- if @application.scopes.present?
|
||||
%tr
|
||||
%td
|
||||
Scopes
|
||||
%td
|
||||
%ul.scopes-list.append-bottom-0
|
||||
- @application.scopes.each do |scope|
|
||||
%li
|
||||
%span.scope-name= scope
|
||||
= "(#{t(scope, scope: [:doorkeeper, :scopes])})"
|
Loading…
Reference in a new issue