Commit cfc88c92 authored by Clement Ho's avatar Clement Ho

Merge branch 'add-js-prevent-default-on-click' into 'master'

Replace inline scripts in links to prevent default

See merge request gitlab-org/gitlab-ce!31838
parents 0d79fe7e 5088e316
...@@ -17,6 +17,8 @@ export default class Members { ...@@ -17,6 +17,8 @@ export default class Members {
} }
dropdownClicked(options) { dropdownClicked(options) {
options.e.preventDefault();
this.formSubmit(null, options.$el); this.formSubmit(null, options.$el);
} }
......
- if commit.has_signature? - if commit.has_signature?
%a{ href: 'javascript:void(0)', tabindex: 0, class: commit_signature_badge_classes('js-loading-gpg-badge'), data: { toggle: 'tooltip', placement: 'top', title: _('GPG signature (loading...)'), 'commit-sha' => commit.sha } } %button{ tabindex: 0, class: commit_signature_badge_classes('js-loading-gpg-badge'), data: { toggle: 'tooltip', placement: 'top', title: _('GPG signature (loading...)'), 'commit-sha' => commit.sha } }
...@@ -24,5 +24,5 @@ ...@@ -24,5 +24,5 @@
= link_to(_('Learn more about signing commits'), help_page_path('user/project/repository/gpg_signed_commits/index.md'), class: 'gpg-popover-help-link') = link_to(_('Learn more about signing commits'), help_page_path('user/project/repository/gpg_signed_commits/index.md'), class: 'gpg-popover-help-link')
%a{ href: 'javascript:void(0)', tabindex: 0, class: css_classes, data: { toggle: 'popover', html: 'true', placement: 'top', title: title, content: content } } %button{ tabindex: 0, class: css_classes, data: { toggle: 'popover', html: 'true', placement: 'top', title: title, content: content } }
= label = label
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
%ul %ul
- Gitlab::Access.options.each do |role, role_id| - Gitlab::Access.options.each do |role, role_id|
%li %li
= link_to role, "javascript:void(0)", = link_to role, '#',
class: ("is-active" if group_link.group_access == role_id), class: ("is-active" if group_link.group_access == role_id),
data: { id: role_id, el_id: dom_id } data: { id: role_id, el_id: dom_id }
.clearable-input.member-form-control.d-sm-inline-block .clearable-input.member-form-control.d-sm-inline-block
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
%ul %ul
- member.valid_level_roles.each do |role, role_id| - member.valid_level_roles.each do |role, role_id|
%li %li
= link_to role, "javascript:void(0)", = link_to role, '#',
class: ("is-active" if member.access_level == role_id), class: ("is-active" if member.access_level == role_id),
data: { id: role_id, el_id: dom_id(member) } data: { id: role_id, el_id: dom_id(member) }
= render_if_exists 'shared/members/ee/revert_ldap_group_sync_option', = render_if_exists 'shared/members/ee/revert_ldap_group_sync_option',
......
...@@ -15,8 +15,8 @@ describe 'GPG signed commits' do ...@@ -15,8 +15,8 @@ describe 'GPG signed commits' do
visit project_commit_path(project, ref) visit project_commit_path(project, ref)
expect(page).to have_link 'Unverified' expect(page).to have_button 'Unverified'
expect(page).not_to have_link 'Verified' expect(page).not_to have_button 'Verified'
# user changes his email which makes the gpg key verified # user changes his email which makes the gpg key verified
perform_enqueued_jobs do perform_enqueued_jobs do
...@@ -26,8 +26,8 @@ describe 'GPG signed commits' do ...@@ -26,8 +26,8 @@ describe 'GPG signed commits' do
visit project_commit_path(project, ref) visit project_commit_path(project, ref)
expect(page).not_to have_link 'Unverified' expect(page).not_to have_button 'Unverified'
expect(page).to have_link 'Verified' expect(page).to have_button 'Verified'
end end
it 'changes from unverified to verified when the user adds the missing gpg key' do it 'changes from unverified to verified when the user adds the missing gpg key' do
...@@ -36,8 +36,8 @@ describe 'GPG signed commits' do ...@@ -36,8 +36,8 @@ describe 'GPG signed commits' do
visit project_commit_path(project, ref) visit project_commit_path(project, ref)
expect(page).to have_link 'Unverified' expect(page).to have_button 'Unverified'
expect(page).not_to have_link 'Verified' expect(page).not_to have_button 'Verified'
# user adds the gpg key which makes the signature valid # user adds the gpg key which makes the signature valid
perform_enqueued_jobs do perform_enqueued_jobs do
...@@ -46,8 +46,8 @@ describe 'GPG signed commits' do ...@@ -46,8 +46,8 @@ describe 'GPG signed commits' do
visit project_commit_path(project, ref) visit project_commit_path(project, ref)
expect(page).not_to have_link 'Unverified' expect(page).not_to have_button 'Unverified'
expect(page).to have_link 'Verified' expect(page).to have_button 'Verified'
end end
context 'shows popover badges', :js do context 'shows popover badges', :js do
...@@ -136,7 +136,7 @@ describe 'GPG signed commits' do ...@@ -136,7 +136,7 @@ describe 'GPG signed commits' do
visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA) visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA)
# wait for the signature to get generated # wait for the signature to get generated
expect(page).to have_link 'Verified' expect(page).to have_button 'Verified'
user_1.destroy! user_1.destroy!
......
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