Commit 01b5d885 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '29414-fix-toggle-discussion-link-jump' into 'master'

Fix link togglers jumping to top

Closes #29414

See merge request !9918
parents 520f7cd0 cf3c4398
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// Button does not change visibility. If button has icon - it changes chevron style. // Button does not change visibility. If button has icon - it changes chevron style.
// //
// %div.js-toggle-container // %div.js-toggle-container
// %a.js-toggle-button // %button.js-toggle-button
// %div.js-toggle-content // %div.js-toggle-content
// //
$('body').on('click', '.js-toggle-button', function(e) { $('body').on('click', '.js-toggle-button', function(e) {
......
...@@ -431,6 +431,21 @@ ...@@ -431,6 +431,21 @@
border-bottom: none; border-bottom: none;
} }
.diff-stats-summary-toggler {
padding: 0;
background-color: transparent;
border: 0;
color: $gl-link-color;
transition: color 0.1s linear;
&:hover,
&:focus {
outline: none;
text-decoration: underline;
color: $gl-link-hover-color;
}
}
// Mobile // Mobile
@media (max-width: 480px) { @media (max-width: 480px) {
.diff-title { .diff-title {
......
...@@ -60,7 +60,17 @@ ...@@ -60,7 +60,17 @@
} }
.modify-merge-commit-link { .modify-merge-commit-link {
padding: 0;
background-color: transparent;
border: 0;
color: $gl-text-color; color: $gl-text-color;
&:hover,
&:focus {
text-decoration: underline;
}
} }
.merge-param-checkbox { .merge-param-checkbox {
......
...@@ -410,8 +410,22 @@ ul.notes { ...@@ -410,8 +410,22 @@ ul.notes {
} }
.discussion-toggle-button { .discussion-toggle-button {
padding: 0;
background-color: transparent;
border: 0;
line-height: 20px; line-height: 20px;
font-size: 13px; font-size: 13px;
transition: color 0.1s linear;
&:hover {
color: $gl-link-color;
}
&:focus {
text-decoration: underline;
outline: none;
color: $gl-link-color;
}
.fa { .fa {
margin-right: 3px; margin-right: 3px;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
.discussion.js-toggle-container{ class: discussion.id, data: { discussion_id: discussion.id } } .discussion.js-toggle-container{ class: discussion.id, data: { discussion_id: discussion.id } }
.discussion-header .discussion-header
.discussion-actions .discussion-actions
= link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do %button.note-action-button.discussion-toggle-button.js-toggle-button{ type: "button" }
- if expanded - if expanded
= icon("chevron-up") = icon("chevron-up")
- else - else
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
.visible-xs-inline .visible-xs-inline
= render_commit_status(commit, ref: ref) = render_commit_status(commit, ref: ref)
- if commit.description? - if commit.description?
%a.text-expander.hidden-xs.js-toggle-button ... %button.text-expander.hidden-xs.js-toggle-button{ type: "button" } ...
- if commit.description? - if commit.description?
%pre.commit-row-description.js-toggle-content %pre.commit-row-description.js-toggle-content
......
.js-toggle-container .js-toggle-container
.commit-stat-summary .commit-stat-summary
Showing Showing
= link_to '#', class: 'js-toggle-button' do %button.diff-stats-summary-toggler.js-toggle-button{ type: "button" }
%strong= pluralize(diff_files.size, "changed file") %strong= pluralize(diff_files.size, "changed file")
with with
%strong.cgreen #{diff_files.sum(&:added_lines)} additions %strong.cgreen #{diff_files.sum(&:added_lines)} additions
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
= check_box_tag :should_remove_source_branch = check_box_tag :should_remove_source_branch
Remove source branch Remove source branch
.accept-control .accept-control
= link_to "#", class: "modify-merge-commit-link js-toggle-button" do %button.modify-merge-commit-link.js-toggle-button{ type: "button" }
= icon('edit') = icon('edit')
Modify commit message Modify commit message
.js-toggle-content.hide.prepend-top-default .js-toggle-content.hide.prepend-top-default
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
Gitea Gitea
%div %div
- if git_import_enabled? - if git_import_enabled?
= link_to "#", class: 'btn js-toggle-button import_git' do %button.btn.js-toggle-button.import_git{ type: "button" }
= icon('git', text: 'Repo by URL') = icon('git', text: 'Repo by URL')
.import_gitlab_project .import_gitlab_project
- if gitlab_project_import_enabled? - if gitlab_project_import_enabled?
......
---
title: Update toggle buttons to be <button>
merge_request:
author:
...@@ -19,7 +19,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps ...@@ -19,7 +19,7 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
expect(page).to have_link('Bitbucket') expect(page).to have_link('Bitbucket')
expect(page).to have_link('GitLab.com') expect(page).to have_link('GitLab.com')
expect(page).to have_link('Google Code') expect(page).to have_link('Google Code')
expect(page).to have_link('Repo by URL') expect(page).to have_button('Repo by URL')
expect(page).to have_link('GitLab export') expect(page).to have_link('GitLab export')
end end
......
...@@ -382,7 +382,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -382,7 +382,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I modify merge commit message' do step 'I modify merge commit message' do
find('.modify-merge-commit-link').click click_button "Modify commit message"
fill_in 'commit_message', with: 'wow such merge' fill_in 'commit_message', with: 'wow such merge'
end end
......
...@@ -296,7 +296,7 @@ feature 'Diff notes resolve', feature: true, js: true do ...@@ -296,7 +296,7 @@ feature 'Diff notes resolve', feature: true, js: true do
it 'displays next discussion even if hidden' do it 'displays next discussion even if hidden' do
page.all('.note-discussion').each do |discussion| page.all('.note-discussion').each do |discussion|
page.within discussion do page.within discussion do
click_link 'Toggle discussion' click_button 'Toggle discussion'
end end
end end
...@@ -477,13 +477,13 @@ feature 'Diff notes resolve', feature: true, js: true do ...@@ -477,13 +477,13 @@ feature 'Diff notes resolve', feature: true, js: true do
it 'shows resolved icon' do it 'shows resolved icon' do
expect(page).to have_content '1/1 discussion resolved' expect(page).to have_content '1/1 discussion resolved'
click_link 'Toggle discussion' click_button 'Toggle discussion'
expect(page).to have_selector('.line-resolve-btn.is-active') expect(page).to have_selector('.line-resolve-btn.is-active')
end end
it 'does not allow user to click resolve button' do it 'does not allow user to click resolve button' do
expect(page).to have_selector('.line-resolve-btn.is-disabled') expect(page).to have_selector('.line-resolve-btn.is-disabled')
click_link 'Toggle discussion' click_button 'Toggle discussion'
expect(page).to have_selector('.line-resolve-btn.is-disabled') expect(page).to have_selector('.line-resolve-btn.is-disabled')
end end
......
...@@ -41,7 +41,7 @@ feature 'Clicking toggle commit message link', feature: true, js: true do ...@@ -41,7 +41,7 @@ feature 'Clicking toggle commit message link', feature: true, js: true do
visit namespace_project_merge_request_path(project.namespace, project, merge_request) visit namespace_project_merge_request_path(project.namespace, project, merge_request)
expect(textbox).not_to be_visible expect(textbox).not_to be_visible
click_link "Modify commit message" click_button "Modify commit message"
expect(textbox).to be_visible expect(textbox).to be_visible
end end
......
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