[28419] Allow to hide percentage sign in progress bar

https://community.openproject.com/wp/28419
pull/6623/head
Oliver Günther 6 years ago
parent 7d300a9cea
commit 5f15debcab
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 1
      app/assets/javascripts/versions.js
  2. 3
      app/helpers/application_helper.rb
  3. 2
      app/views/versions/_work_package_counts.html.erb

@ -55,6 +55,7 @@
$.ajax({ url: url,
headers: { Accept: 'text/javascript' },
dataType: 'html',
data: data,
complete: function (jqXHR) {
form.replaceWith(jqXHR.responseText);

@ -405,13 +405,14 @@ module ApplicationHelper
width = options[:width] || '100px;'
legend = options[:legend] || ''
total_progress = options[:hide_total_progress] ? '' : t(:total_progress)
percent_sign = options[:hide_percent_sign] ? '' : '%'
content_tag :span do
progress = content_tag :span, class: 'progress-bar', style: "width: #{width}" do
concat content_tag(:span, '', class: 'inner-progress closed', style: "width: #{closed}%")
concat content_tag(:span, '', class: 'inner-progress done', style: "width: #{done}%")
end
progress + content_tag(:span, "#{legend}% #{total_progress}", class: 'progress-bar-legend')
progress + content_tag(:span, "#{legend}#{percent_sign} #{total_progress}", class: 'progress-bar-legend')
end
end

@ -62,6 +62,8 @@ See docs/COPYRIGHT.rdoc for more details.
<td width="240px">
<%= progress_bar((count[:closed].to_f / count[:total])*100,
legend: "#{count[:closed]}/#{count[:total]}",
hide_total_progress: true,
hide_percent_sign: true,
width: "#{(count[:total].to_f / max * 200).floor}px;") %>
</td>
</tr>

Loading…
Cancel
Save