Style the line items like redmine_qbo's estimate and invoice editor

The issue form gets the editor's line table (numbered rows, borderless inputs until worked on,
hover delete, billed pill), its buttons, totals and phone cards. The issue page keeps Redmine's
list table, with amounts right-aligned and labelled cards on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-02 19:36:01 -05:00
1 parent 6858842407
commit fd3caf9839
4 files changed
+389 -104

No files matched your search

+55 -47
View File
@@ -8,57 +8,65 @@
<% @issue.line_items.build if @issue.line_items.empty? && !readonly && can_add %>
<div class="box tabular"
<%# Styled like redmine_qbo's estimate and invoice editor (see line_items.css) %>
<div class="box line-items-sheet"
data-nested-form
data-wrapper-selector=".line-item">
<strong><%= t :label_line_items %></strong>
<span class="line-items-title"><%= t :label_line_items %></span>
<table class="list line-items-table">
<thead>
<tr>
<th style="width:60%;"><%= t :label_description %></th>
<th style="width:10%;"><%= t :label_qty %></th>
<th style="width:10%;"><%= t :label_price %></th>
<th style="width:10%;"><%= t :label_total %></th>
<% unless readonly %>
<th style="width:80px;"></th>
<div class="line-items-wrap">
<table class="line-items-table line-items-editor">
<thead>
<tr>
<th class="line-item-number">#</th>
<th class="line-item-description-cell"><%= t :label_description %></th>
<th class="line-item-qty"><%= t :label_qty %></th>
<th class="line-item-price"><%= t :label_price %></th>
<th class="line-item-total"><%= t :label_total %></th>
<% unless readonly %>
<th class="actions"></th>
<% end %>
</tr>
</thead>
<tbody data-nested-form-container>
<%= f.fields_for :line_items do |item_form| %>
<%= render "line_items/line_item_fields",
f: item_form,
readonly: readonly,
**permissions %>
<% end %>
</tbody>
</table>
</div>
<div class="line-items-bottom">
<% if !readonly && can_add %>
<template data-nested-form-template>
<%= f.fields_for :line_items, LineItem.new, child_index: "NEW_RECORD" do |item_form| %>
<%= render "line_items/line_item_fields",
f: item_form,
readonly: false,
**permissions %>
<% end %>
</template>
<p class="line-items-buttons">
<button type="button"
class="line-items-button"
data-nested-form-add>
<%= l(:button_add) %>
</button>
</p>
<% end %>
<table class="line-items-totals">
<tr class="line-items-grand-total">
<th><%= t :label_total %></th>
<td id="line-items-grand-total">0.00</td>
</tr>
</thead>
</table>
</div>
<tbody data-nested-form-container>
<%= f.fields_for :line_items do |item_form| %>
<%= render "line_items/line_item_fields",
f: item_form,
readonly: readonly,
**permissions %>
<% end %>
</tbody>
</table>
<p class="line-items-grand-total">
<strong><%= t :label_total %>:</strong>
<span id="line-items-grand-total">0.00</span>
</p>
<% if !readonly && can_add %>
<template data-nested-form-template>
<%= f.fields_for :line_items, LineItem.new, child_index: "NEW_RECORD" do |item_form| %>
<%= render "line_items/line_item_fields",
f: item_form,
readonly: false,
**permissions %>
<% end %>
</template>
<p>
<button type="button"
class="icon icon-add"
data-nested-form-add>
<%= l(:button_add) %>
</button>
</p>
<% end %>
</div>
</div>
@@ -24,10 +24,10 @@
<% total += line_total %>
<tr>
<td><%= h item.description %></td>
<td><%= item.quantity %></td>
<td><%= number_to_currency(item.unit_price) %></td>
<td><%= number_to_currency(line_total) %></td>
<td data-label="<%= t :label_description %>"><%= h item.description %></td>
<td data-label="<%= t :label_qty %>"><%= item.quantity %></td>
<td data-label="<%= t :label_price %>"><%= number_to_currency(item.unit_price) %></td>
<td data-label="<%= t :label_total %>"><%= number_to_currency(line_total) %></td>
</tr>
<% end %>
</tbody>
+15 -11
View File
@@ -11,19 +11,22 @@
<%= f.hidden_field :_destroy %>
<%= f.hidden_field :item_id, class: "item-id-field" %>
<td data-label="<%= t :label_description %>">
<%# Numbered by a CSS counter, so removed (hidden) rows are skipped %>
<td class="line-item-number"></td>
<td class="line-item-description-cell" data-label="<%= t :label_description %>">
<% if billed %>
<span class="line-item-billed-badge" title="<%= l(:text_line_item_billed) %>"><%= l(:label_billed) %></span>
<% end %>
<%= f.text_field :description,
placeholder: l(:label_description),
class: "line-item-description",
autocomplete: "off",
no_label: true,
disabled: locked %>
<% if billed %>
<span class="line-item-billed-badge" title="<%= l(:text_line_item_billed) %>"><%= l(:label_billed) %></span>
<% end %>
</td>
<td data-label="<%= t :label_qty %>">
<td class="line-item-qty" data-label="<%= t :label_qty %>">
<%# Fractional quantities are allowed (e.g. 0.5 hours, 2.5 quarts) %>
<%= f.number_field :quantity,
step: "any",
@@ -34,8 +37,9 @@
disabled: locked %>
</td>
<td data-label="<%= t :label_price %>">
<td class="line-item-price" data-label="<%= t :label_price %>">
<%= f.text_field :unit_price,
value: (number_with_precision(item.unit_price, precision: 2) unless item.unit_price.nil?),
class: "price-field",
inputmode: "decimal",
autocomplete: "off",
@@ -43,7 +47,7 @@
disabled: locked %>
</td>
<td class="line-total" data-label="<%= t :label_total %>">
<td class="line-item-total line-total" data-label="<%= t :label_total %>">
0.00
</td>
@@ -51,11 +55,11 @@
<td class="actions">
<% if removable %>
<button type="button"
class="icon-only icon-del"
class="line-item-remove-button"
title="<%= l(:label_remove) %>"
data-nested-form-remove>
</button>
aria-label="<%= l(:label_remove) %>"
data-nested-form-remove><%= sprite_icon('del') %></button>
<% end %>
</td>
<% end %>
</tr>
</tr>