Feature #42684 » 0001-Add-sticky-issue-header.patch
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
div.issue div.subject>div>p { margin-top: 0.5em; }
|
||
|
div.issue div.subject h3 {margin: 0; margin-bottom: 0.1em;}
|
||
|
div.issue p.author {margin-top:0.5em; font-size: 93%}
|
||
|
div.issue span.private, div.journal span.private {font-size: 60%;}
|
||
|
div.issue:not(#sticky-issue-header) > span.private, div.journal span.private {font-size: 60%;}
|
||
|
div.issue .next-prev-links {color:#999;}
|
||
|
div.issue .attributes {margin-top: 2em;}
|
||
|
div.issue .attributes .attribute {padding-left:180px; clear:left; min-height: 1.8em;}
|
||
| ... | ... | |
|
div.issue .attribute.text_cf .value .wiki p:first-of-type {margin-top: 0;}
|
||
|
div.issue.overdue .due-date .value { color: #c22; }
|
||
|
body.controller-issues h2.inline-flex {padding-right: 0}
|
||
|
div#sticky-issue-header {
|
||
|
display: none;
|
||
|
position: fixed;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
background-color: white;
|
||
|
border-bottom: 1px solid #d0d7de;
|
||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||
|
font-size: 0.750rem;
|
||
|
align-items: center;
|
||
|
z-index: 1000;
|
||
|
padding: 10px 6px;
|
||
|
border-radius: 0px;
|
||
|
}
|
||
|
div#sticky-issue-header.is-visible {
|
||
|
display: flex;
|
||
|
}
|
||
|
div#sticky-issue-header .issue-heading {
|
||
|
flex-shrink: 0;
|
||
|
white-space: nowrap;
|
||
|
margin-right: 6px;
|
||
|
}
|
||
|
div#sticky-issue-header .subject {
|
||
|
font-weight: bold;
|
||
|
overflow: hidden;
|
||
|
text-overflow: ellipsis;
|
||
|
white-space: nowrap;
|
||
|
flex-grow: 1;
|
||
|
}
|
||
|
#issue_tree table.issues, #relations table.issues {border: 0;}
|
||
|
#issue_tree table.issues td, #relations table.issues td {border: 0;}
|
||
| app/assets/stylesheets/responsive.css | ||
|---|---|---|
|
font-size: 1.1em;
|
||
|
text-align: left;
|
||
|
}
|
||
|
/* Sticky issue header */
|
||
|
/* When project-jump.drdn is visible in mobile layout, offset the sticky header by its height to prevent it from being hidden. */
|
||
|
div#sticky-issue-header {
|
||
|
top: 64px;
|
||
|
}
|
||
|
}
|
||
|
@media all and (max-width: 599px) {
|
||
| app/assets/stylesheets/wiki_syntax.css | ||
|---|---|---|
|
.syntaxhl .s1 { background-color: #fff0f0 }
|
||
|
span.more_info { font-weight: normal; }
|
||
|
.markdown-alert {
|
||
|
border-left: 4px solid;
|
||
|
padding-left: 10px;
|
||
|
margin-left: 10px;
|
||
|
}
|
||
|
.markdown-alert-title {
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
.markdown-alert-tip { border-color: #5db651; }
|
||
|
.markdown-alert-tip .markdown-alert-title { color: #005f00; }
|
||
|
.markdown-alert-important { border-color: #800080; }
|
||
|
.markdown-alert-important .markdown-alert-title { color: #4b006e; }
|
||
|
.markdown-alert-caution { border-color: #c22; }
|
||
|
.markdown-alert-caution .markdown-alert-title { color: #880000; }
|
||
|
.markdown-alert-warning { border-color: #e4bc4b; }
|
||
|
.markdown-alert-warning .markdown-alert-title { color: #a7760c; }
|
||
|
.markdown-alert-note { border-color: #169; }
|
||
|
.markdown-alert-note .markdown-alert-title { color: #1e40af; }
|
||
| app/javascript/controllers/sticky_issue_header_controller.js | ||
|---|---|---|
|
import { Controller } from "@hotwired/stimulus";
|
||
|
export default class extends Controller {
|
||
|
static targets = ["original", "stickyHeader"];
|
||
|
connect() {
|
||
|
if (!this.originalTarget || !this.stickyHeaderTarget) return;
|
||
|
this.observer = new IntersectionObserver(
|
||
|
([entry]) => {
|
||
|
this.stickyHeaderTarget.classList.toggle("is-visible", !entry.isIntersecting);
|
||
|
},
|
||
|
{ threshold: 0 }
|
||
|
);
|
||
|
this.observer.observe(this.originalTarget);
|
||
|
}
|
||
|
disconnect() {
|
||
|
this.observer?.disconnect();
|
||
|
}
|
||
|
}
|
||
| app/views/issues/show.html.erb | ||
|---|---|---|
|
<%= assignee_avatar(@issue.assigned_to, :size => "22", :class => "gravatar-child") if @issue.assigned_to %>
|
||
|
</div>
|
||
|
<div class="subject">
|
||
|
<%= render_issue_subject_with_tree(@issue) %>
|
||
|
<div data-controller="sticky-issue-header">
|
||
|
<div class="subject" data-sticky-issue-header-target="original">
|
||
|
<%= render_issue_subject_with_tree(@issue) %>
|
||
|
</div>
|
||
|
<div id="sticky-issue-header" data-sticky-issue-header-target="stickyHeader" class="issue">
|
||
|
<span class="issue-heading"><%= issue_heading(@issue) %>:</span>
|
||
|
<span class="subject"><%= @issue.subject %></span>
|
||
|
</div>
|
||
|
</div>
|
||
|
<p class="author">
|
||
|
<%= authoring @issue.created_on, @issue.author %>.
|
||
|
<% if @issue.created_on != @issue.updated_on %>
|
||
| test/system/sticky_issue_header_test.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
# Redmine - project management software
|
||
|
# Copyright (C) 2006- Jean-Philippe Lang
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
require_relative '../application_system_test_case'
|
||
|
class StickyIssueHeaderSystemTest < ApplicationSystemTestCase
|
||
|
test "sticky issue header is hidden by default" do
|
||
|
issue = Issue.find(1)
|
||
|
visit issue_path(issue)
|
||
|
assert_no_selector "#sticky-issue-header", text: issue.subject
|
||
|
end
|
||
|
test "sticky issue header appears on scroll" do
|
||
|
issue = Issue.find(1)
|
||
|
visit issue_path(issue)
|
||
|
page.execute_script("window.scrollTo(0, 1000)")
|
||
|
assert_selector "#sticky-issue-header.is-visible", text: issue.subject
|
||
|
page.execute_script("window.scrollTo(0, 0)")
|
||
|
assert_no_selector "#sticky-issue-header", text: issue.subject
|
||
|
end
|
||
|
end
|
||