Patch #36742 » 36742.patch
| app/views/layouts/base.html.erb | ||
|---|---|---|
| 22 | 22 |
<%= call_hook :view_layouts_base_body_top %> |
| 23 | 23 |
<div id="wrapper"> |
| 24 | 24 | |
| 25 |
<div id="us-btn-up"><span class="chevron-up"></span></div> |
|
| 25 | 26 |
<div class="flyout-menu js-flyout-menu"> |
| 26 | 27 | |
| 27 | 28 |
<% if User.current.logged? || !Setting.login_required? %> |
| public/javascripts/application.js | ||
|---|---|---|
| 1219 | 1219 |
tribute.attach(element); |
| 1220 | 1220 |
} |
| 1221 | 1221 | |
| 1222 |
function setupUpButton() {
|
|
| 1223 |
$(window).scroll(function() {
|
|
| 1224 |
if ($(this).scrollTop() > 30) {
|
|
| 1225 |
$('#us-btn-up').addClass('showed');
|
|
| 1226 |
} else {
|
|
| 1227 |
$('#us-btn-up').removeClass('showed');
|
|
| 1228 |
} |
|
| 1229 |
}); |
|
| 1230 |
$('#us-btn-up').click(function () {
|
|
| 1231 |
$('html, body').animate({ scrollTop: 0 }, 300);
|
|
| 1232 |
}); |
|
| 1233 |
} |
|
| 1222 | 1234 | |
| 1223 | 1235 |
$(document).ready(setupAjaxIndicator); |
| 1224 | 1236 |
$(document).ready(hideOnLoad); |
| ... | ... | |
| 1231 | 1243 |
$(document).on('focus', '[data-auto-complete=true]', function(event) {
|
| 1232 | 1244 |
inlineAutoComplete(event.target); |
| 1233 | 1245 |
}); |
| 1246 |
$(document).ready(setupUpButton); |
|
| public/stylesheets/application.css | ||
|---|---|---|
| 1874 | 1874 |
display: inline; |
| 1875 | 1875 |
opacity: 1; |
| 1876 | 1876 |
} |
| 1877 | ||
| 1878 |
#us-btn-up {
|
|
| 1879 |
display: none; |
|
| 1880 |
} |
|
| 1881 |
@media all and (min-width: 900px) {
|
|
| 1882 |
#us-btn-up {
|
|
| 1883 |
display: block; |
|
| 1884 |
height: 0; |
|
| 1885 |
padding: 0; |
|
| 1886 |
overflow: hidden; |
|
| 1887 |
position: fixed; |
|
| 1888 |
bottom: 35px; |
|
| 1889 |
right: 35px; |
|
| 1890 |
z-index: 99; |
|
| 1891 |
border: none; |
|
| 1892 |
outline: none; |
|
| 1893 |
color: #888; |
|
| 1894 |
cursor: pointer; |
|
| 1895 |
border-radius: 4px; |
|
| 1896 |
transition: opacity .3s, background-color .3s; |
|
| 1897 |
opacity: 0; |
|
| 1898 |
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 0 30px 0 rgba(0, 0, 0, 0.15) inset; |
|
| 1899 |
background: #fff; |
|
| 1900 |
} |
|
| 1901 | ||
| 1902 |
#us-btn-up.showed {
|
|
| 1903 |
height: auto; |
|
| 1904 |
opacity: 0.7; |
|
| 1905 |
padding: 15px 20px; |
|
| 1906 |
} |
|
| 1907 | ||
| 1908 |
#us-btn-up:hover {
|
|
| 1909 |
background-color: #f5f5f5; |
|
| 1910 |
} |
|
| 1911 | ||
| 1912 |
.chevron-up {
|
|
| 1913 |
position: relative; |
|
| 1914 |
height: 16px; |
|
| 1915 |
width: 16px; |
|
| 1916 |
top: 1px; |
|
| 1917 |
display: inline-block; |
|
| 1918 |
background-image: url(../images/chevron-up.png); |
|
| 1919 |
background-size: cover; |
|
| 1920 |
margin: 0; |
|
| 1921 |
-webkit-font-smoothing: antialiased; |
|
| 1922 |
-moz-osx-font-smoothing: grayscale; |
|
| 1923 |
} |
|
| 1924 |
} |
|
| test/system/scroll_to_top_button_test.rb | ||
|---|---|---|
| 1 |
# frozen_string_literal: true |
|
| 2 | ||
| 3 |
# Redmine - project management software |
|
| 4 |
# Copyright (C) 2006-2022 Jean-Philippe Lang |
|
| 5 |
# |
|
| 6 |
# This program is free software; you can redistribute it and/or |
|
| 7 |
# modify it under the terms of the GNU General Public License |
|
| 8 |
# as published by the Free Software Foundation; either version 2 |
|
| 9 |
# of the License, or (at your option) any later version. |
|
| 10 |
# |
|
| 11 |
# This program is distributed in the hope that it will be useful, |
|
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 14 |
# GNU General Public License for more details. |
|
| 15 |
# |
|
| 16 |
# You should have received a copy of the GNU General Public License |
|
| 17 |
# along with this program; if not, write to the Free Software |
|
| 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
| 19 | ||
| 20 |
require File.expand_path('../../application_system_test_case', __FILE__)
|
|
| 21 | ||
| 22 |
class ScrollToTopButtonTest < ApplicationSystemTestCase |
|
| 23 |
fixtures :issues, :users, :projects, :trackers, :projects_trackers, :issue_statuses, :enumerations, :projects_trackers, |
|
| 24 |
:roles, :members, :member_roles, :enabled_modules |
|
| 25 | ||
| 26 |
def setup |
|
| 27 |
super |
|
| 28 |
100.times { Issue.generate! }
|
|
| 29 |
end |
|
| 30 | ||
| 31 |
def test_scroll_button |
|
| 32 |
log_user('admin', 'admin')
|
|
| 33 |
visit '/issues?per_page=100' |
|
| 34 | ||
| 35 |
# scroll to the page bottom |
|
| 36 |
page.execute_script "window.scrollBy(0,10000)" |
|
| 37 |
# button appears |
|
| 38 |
assert has_css? '#us-btn-up.showed' |
|
| 39 |
# scroll back to the top |
|
| 40 |
find('div#us-btn-up').click
|
|
| 41 |
# no button |
|
| 42 |
assert has_no_css? '#us-btn-up.showed' |
|
| 43 |
end |
|
| 44 |
end |
|
- « Previous
- 1
- 2
- Next »