OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Update custom journal formatter styling
Mir Bhatiab82823a5253e
diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 4037ef9429b..c9d902563c5 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1000,6 +1000,9 @@ en:hour:one: "%{count} hour"other: "%{count} hours"+ hour_html:+ one: "<i>%{count} hour</i>"+ other: "<i>%{count} hours</i>"updated: "changed from %{first} to %{last}"logged_for: "Logged for"filter:diff --git a/lib/open_project/journal_formatter/time_entry_hours.rb b/lib/open_project/journal_formatter/time_entry_hours.rbindex d5401cf969b..c70333961c2 100644--- a/lib/open_project/journal_formatter/time_entry_hours.rb+++ b/lib/open_project/journal_formatter/time_entry_hours.rb@@ -32,21 +32,20 @@ class OpenProject::JournalFormatter::TimeEntryHours < JournalFormatter::Baselabel_text << ':' if !values.firstlabel_text = content_tag(:strong, label_text) if options[:html]- # TODO - Italicize+ html = options[:html] ? '_html' : ''first = format_float(values.first) if values.firstlast = format_float(values.last)- value = \+ value =if firstI18n.t(:'activity.item.time_entry.updated',- first: I18n.t(:'activity.item.time_entry.hour', count: first),- last: I18n.t(:'activity.item.time_entry.hour', count: last))+ first: I18n.t(:"activity.item.time_entry.hour#{html}", count: first),+ last: I18n.t(:"activity.item.time_entry.hour#{html}", count: last))else- I18n.t(:'activity.item.time_entry.hour',+ I18n.t(:"activity.item.time_entry.hour#{html}",count: last)end- # value = content_tag(:i, value) if options[:html]I18n.t(:text_journal_of, label: label_text, value:)enddiff --git a/lib/open_project/journal_formatter/time_entry_named_association.rb b/lib/open_project/journal_formatter/time_entry_named_association.rbindex 69227640a63..266fa76294b 100644--- a/lib/open_project/journal_formatter/time_entry_named_association.rb+++ b/lib/open_project/journal_formatter/time_entry_named_association.rb@@ -30,35 +30,20 @@ class OpenProject::JournalFormatter::TimeEntryNamedAssociation < JournalFormatteprivatedef format_details(key, values, cache:)- # TODO - Confirm wording-- label = if values.first.nil?- label(key)- elsif values.last.nil?- I18n.t("activity.item.time_entry.logged_for")- # else- # I18n.t("activity.item.time_entry.logged_for")- end+ label = I18n.t("activity.item.time_entry.logged_for")old_value, value = *format_values(values, key, cache:)[label, old_value, value]end- # def format_html_details(label, old_value, value)- # label = content_tag(:strong, label)- # old_value = content_tag('i', h(old_value)) if old_value.present?- # value = content_tag('i', h(value)) if value.present?- # value ||= ''-- # [label, old_value, value]- # end+ def format_html_details(label, old_value, value)+ label = content_tag(:strong, label)- # def render_ternary_detail_text(label, value, old_value, options)- # binding.pry- # return I18n.t(:text_journal_deleted_subproject, label:, old: old_value) if value.blank?- # return I18n.t(:text_journal_of, label:, value:) if old_value.blank?+ [label, old_value, value]+ end- # super- # end+ def render_ternary_detail_text(label, value, _old_value, _options)+ I18n.t(:text_journal_of, label:, value:)+ endenddiff --git a/spec/components/activities/item_subtitle_component_spec.rb b/spec/components/activities/item_subtitle_component_spec.rbindex 67c722f82f1..ed82a384c86 100644--- a/spec/components/activities/item_subtitle_component_spec.rb+++ b/spec/components/activities/item_subtitle_component_spec.rb@@ -68,4 +68,6 @@ RSpec.describe Activities::ItemSubtitleComponent, type: :component doit { is_expected.to have_text("updated on #{format_time(datetime)}") }end++ # TODO - Add for TimeEntryend