Commit 990ae6b8 authored by Timothy Andrew's avatar Timothy Andrew

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.
parent 4d6da770
......@@ -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"
- @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])})"
- 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])})"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment