summaryrefslogtreecommitdiff
path: root/app/views/profiles
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-12-05 09:49:51 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-12-16 16:29:32 +0530
commitf706a973c26f9de9a1f1599d532b33e9e66a80bb (patch)
treeec89ae65e503bf24b9e32b01715c0b7efd0111d6 /app/views/profiles
parentf14d423dc7c9ec2d97c83f0c8893661922df4360 (diff)
downloadgitlab-ce-f706a973c26f9de9a1f1599d532b33e9e66a80bb.tar.gz
View-related (and other minor) changes to !5951 based on @rymai's review.
- The `scopes_form` partial can be used in the `admin/applications` view as well - Don't allow partials to access instance variables directly. Instead, pass in the instance variables as local variables, and use `local_assigns.fetch` to assert that the variables are passed in as expected. - Change a few instances of `render :partial` to `render` - Remove an instance of `required: false` in a view, since this is the default - Inline many instances of a local variable (`ip = 'ip'`) in `auth_spec`
Diffstat (limited to 'app/views/profiles')
-rw-r--r--app/views/profiles/personal_access_tokens/_form.html.haml11
-rw-r--r--app/views/profiles/personal_access_tokens/index.html.haml2
2 files changed, 8 insertions, 5 deletions
diff --git a/app/views/profiles/personal_access_tokens/_form.html.haml b/app/views/profiles/personal_access_tokens/_form.html.haml
index 5651b242129..3f6efa33953 100644
--- a/app/views/profiles/personal_access_tokens/_form.html.haml
+++ b/app/views/profiles/personal_access_tokens/_form.html.haml
@@ -1,6 +1,9 @@
-= form_for [:profile, @personal_access_token], method: :post, html: { class: 'js-requires-input' } do |f|
+- personal_access_token = local_assigns.fetch(:personal_access_token)
+- scopes = local_assigns.fetch(:scopes)
- = form_errors(@personal_access_token)
+= form_for [:profile, personal_access_token], method: :post, html: { class: 'js-requires-input' } do |f|
+
+ = form_errors(personal_access_token)
.form-group
= f.label :name, class: 'label-light'
@@ -8,11 +11,11 @@
.form-group
= f.label :expires_at, class: 'label-light'
- = f.text_field :expires_at, class: "datepicker form-control", required: false
+ = f.text_field :expires_at, class: "datepicker form-control"
.form-group
= f.label :scopes, class: 'label-light'
- = render partial: 'shared/tokens/scopes_form', locals: { prefix: 'personal_access_token', token: @personal_access_token }
+ = render 'shared/tokens/scopes_form', prefix: 'personal_access_token', token: personal_access_token, scopes: scopes
.prepend-top-default
= f.submit 'Create Personal Access Token', class: "btn btn-create"
diff --git a/app/views/profiles/personal_access_tokens/index.html.haml b/app/views/profiles/personal_access_tokens/index.html.haml
index 39eef0f6baf..bb4effeeeb1 100644
--- a/app/views/profiles/personal_access_tokens/index.html.haml
+++ b/app/views/profiles/personal_access_tokens/index.html.haml
@@ -29,7 +29,7 @@
%p.profile-settings-content
Pick a name for the application, and we'll give you a unique token.
- = render "form"
+ = render "form", personal_access_token: @personal_access_token, scopes: @scopes
%hr