summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/application.css30
-rw-r--r--app/assets/stylesheets/responsive.css6
-rw-r--r--app/controllers/versions_controller.rb4
-rw-r--r--app/javascript/controllers/sticky_issue_header_controller.js22
-rw-r--r--app/models/version.rb2
-rw-r--r--app/views/issues/show.html.erb11
6 files changed, 70 insertions, 5 deletions
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 7dc97a8f9..8bcfb2fb1 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -680,6 +680,36 @@ div.issue .attribute.string_cf .value .wiki p {margin-top: 0; margin-bottom: 0;}
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.8125rem;
+ 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;}
diff --git a/app/assets/stylesheets/responsive.css b/app/assets/stylesheets/responsive.css
index c5278c87f..3a2eb46bb 100644
--- a/app/assets/stylesheets/responsive.css
+++ b/app/assets/stylesheets/responsive.css
@@ -848,6 +848,12 @@
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) {
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index d52b43ba3..328d3e56e 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -51,7 +51,7 @@ class VersionsController < ApplicationController
if @selected_tracker_ids.any? && @versions.any?
issues = Issue.visible.
includes(:project, :tracker).
- preload(:status, :priority, :fixed_version).
+ preload(:status, :priority, :fixed_version, {:assigned_to => :email_address}).
where(:tracker_id => @selected_tracker_ids, :project_id => project_ids, :fixed_version_id => @versions.map(&:id)).
order("#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id")
@issues_by_version = issues.group_by(&:fixed_version)
@@ -69,7 +69,7 @@ class VersionsController < ApplicationController
format.html do
@issues = @version.fixed_issues.visible.
includes(:status, :tracker, :priority).
- preload(:project).
+ preload(:project, {:assigned_to => :email_address}).
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
to_a
end
diff --git a/app/javascript/controllers/sticky_issue_header_controller.js b/app/javascript/controllers/sticky_issue_header_controller.js
new file mode 100644
index 000000000..aebc7d2dc
--- /dev/null
+++ b/app/javascript/controllers/sticky_issue_header_controller.js
@@ -0,0 +1,22 @@
+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();
+ }
+}
diff --git a/app/models/version.rb b/app/models/version.rb
index 707ed59dc..3ca4f2bff 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -106,7 +106,7 @@ module FixedIssuesExtension
done = self.open(open).sum do |c|
estimated = c.total_estimated_hours.to_f
estimated = estimated_average unless estimated > 0.0
- ratio = c.closed? ? 100 : (c.done_ratio || 0)
+ ratio = open ? (c.done_ratio || 0) : 100
estimated * ratio
end
progress = done / (estimated_average * issues_count)
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb
index 36111efa4..0a6da1098 100644
--- a/app/views/issues/show.html.erb
+++ b/app/views/issues/show.html.erb
@@ -37,9 +37,16 @@
<%= 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 %>