Skip to content

Commit

Permalink
[58261] Version info shows html tag (#16900)
Browse files Browse the repository at this point in the history
* Mark the hours as html_safe so that they are shown correctly

* Remove unused functionas and classes

* Remove unused style definitions

---------

Co-authored-by: Oliver Günther <[email protected]>
  • Loading branch information
HDinger and oliverguenther committed Oct 7, 2024
1 parent bb0ff83 commit 4572465
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
6 changes: 0 additions & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,6 @@ def labeled_check_box_tags(name, collection, options = {})
end.join.html_safe
end

def html_hours(text)
html_safe_gsub(text,
%r{(\d+)\.(\d+)},
'<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>')
end

def html_safe_gsub(string, *gsub_args, &)
html_safe = string.html_safe?
result = string.gsub(*gsub_args, &)
Expand Down
4 changes: 2 additions & 2 deletions app/views/versions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ See COPYRIGHT and LICENSE files for more details.
<table>
<tr>
<td width="130px" align="right"><%= Version.human_attribute_name(:estimated_hours) %></td>
<td width="240px" class="total-hours" align="right"><%= html_hours(l_hours(@version.estimated_hours)) %></td>
<td width="240px" class="total-hours" align="right"><%= l_hours(@version.estimated_hours) %></td>
</tr>
<% if User.current.allowed_in_project?(:view_time_entries, @project) %>
<tr>
<td width="130px" align="right"><%= t(:label_spent_time) %></td>
<td width="240px" class="total-hours" align="right"><%= html_hours(l_hours(@version.spent_hours)) %></td>
<td width="240px" class="total-hours" align="right"><%= l_hours(@version.spent_hours) %></td>
</tr>
<% end %>
</table>
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/global_styles/content/_tables.sass
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ table
font-style: normal
font-weight: var(--base-text-weight-bold)
background-color: #EEEEEE
.hours-dec
font-size: 0.9em

#workflow_form
.generic-table--results-container
Expand Down Expand Up @@ -144,8 +142,6 @@ tr
td
&.hours
font-weight: var(--base-text-weight-bold)
.hours-dec
font-size: 0.9em
.date
.spot-drop-modal
display: block
Expand Down

0 comments on commit 4572465

Please sign in to comment.