diff options
-rw-r--r-- | app/helpers/application_helper.rb | 13 | ||||
-rw-r--r-- | app/views/versions/_overview.rhtml | 4 | ||||
-rw-r--r-- | lang/bg.yml | 2 | ||||
-rw-r--r-- | lang/ca.yml | 2 | ||||
-rw-r--r-- | lang/cs.yml | 2 | ||||
-rw-r--r-- | lang/da.yml | 2 | ||||
-rw-r--r-- | lang/de.yml | 2 | ||||
-rw-r--r-- | lang/en.yml | 2 | ||||
-rw-r--r-- | lang/es.yml | 2 | ||||
-rw-r--r-- | lang/fi.yml | 2 | ||||
-rw-r--r-- | lang/fr.yml | 2 | ||||
-rw-r--r-- | lang/he.yml | 2 | ||||
-rw-r--r-- | lang/hu.yml | 2 | ||||
-rw-r--r-- | lang/it.yml | 2 | ||||
-rw-r--r-- | lang/ja.yml | 2 | ||||
-rw-r--r-- | lang/ko.yml | 2 | ||||
-rw-r--r-- | lang/lt.yml | 2 | ||||
-rw-r--r-- | lang/nl.yml | 2 | ||||
-rw-r--r-- | lang/no.yml | 2 | ||||
-rw-r--r-- | lang/pl.yml | 2 | ||||
-rw-r--r-- | lang/pt-br.yml | 2 | ||||
-rw-r--r-- | lang/pt.yml | 2 | ||||
-rw-r--r-- | lang/ro.yml | 2 | ||||
-rw-r--r-- | lang/ru.yml | 2 | ||||
-rw-r--r-- | lang/sr.yml | 2 | ||||
-rw-r--r-- | lang/sv.yml | 2 | ||||
-rw-r--r-- | lang/th.yml | 2 | ||||
-rw-r--r-- | lang/tr.yml | 2 | ||||
-rw-r--r-- | lang/uk.yml | 2 | ||||
-rw-r--r-- | lang/zh-tw.yml | 2 | ||||
-rw-r--r-- | lang/zh.yml | 2 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 14 |
32 files changed, 57 insertions, 32 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cc26127d6..c3701b377 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -100,6 +100,19 @@ module ApplicationHelper @time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format) include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format) end + + def distance_of_date_in_words(from_date, to_date = 0) + from_date = from_date.to_date if from_date.respond_to?(:to_date) + to_date = to_date.to_date if to_date.respond_to?(:to_date) + distance_in_days = (to_date - from_date).abs + lwr(:actionview_datehelper_time_in_words_day, distance_in_days) + end + + def due_date_distance_in_words(date) + if date + l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date)) + end + end # Truncates and returns the string as a single line def truncate_single_line(string, *args) diff --git a/app/views/versions/_overview.rhtml b/app/views/versions/_overview.rhtml index d3aa6b18f..377e9178b 100644 --- a/app/views/versions/_overview.rhtml +++ b/app/views/versions/_overview.rhtml @@ -1,9 +1,7 @@ <% if version.completed? %> <p><%= format_date(version.effective_date) %></p> -<% elsif version.overdue? %> - <p><strong><%= l(:label_roadmap_overdue, distance_of_time_in_words(Time.now, version.effective_date)) %> (<%= format_date(version.effective_date) %>)</strong></p> <% elsif version.effective_date %> - <p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p> + <p><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</p> <% end %> <p><%=h version.description %></p> diff --git a/lang/bg.yml b/lang/bg.yml index e072ad93b..f8d2e5e2c 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -352,7 +352,7 @@ label_sort_higher: Премести по-горе label_sort_lower: Премести по-долу label_sort_lowest: Премести най-долу label_roadmap: Пътна карта -label_roadmap_due_in: Излиза след +label_roadmap_due_in: Излиза след %s label_roadmap_overdue: %s закъснение label_roadmap_no_issues: Няма задачи за тази версия label_search: Търсене diff --git a/lang/ca.yml b/lang/ca.yml index 895f213ca..30348b060 100644 --- a/lang/ca.yml +++ b/lang/ca.yml @@ -413,7 +413,7 @@ label_sort_higher: Mou cap amunt label_sort_lower: Mou cap avall label_sort_lowest: Mou a la part inferior label_roadmap: Planificació -label_roadmap_due_in: Venç en +label_roadmap_due_in: Venç en %s label_roadmap_overdue: %s tard label_roadmap_no_issues: No hi ha assumptes per a aquesta versió label_search: Cerca diff --git a/lang/cs.yml b/lang/cs.yml index 51486aec7..cf2cb0992 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -409,7 +409,7 @@ label_sort_higher: Přesunout nahoru label_sort_lower: Přesunout dolů label_sort_lowest: Přesunout na konec label_roadmap: Plán -label_roadmap_due_in: Zbývá +label_roadmap_due_in: Zbývá %s label_roadmap_overdue: %s pozdě label_roadmap_no_issues: Pro tuto verzi nejsou žádné úkoly label_search: Hledat diff --git a/lang/da.yml b/lang/da.yml index 631d58916..0ee1b2512 100644 --- a/lang/da.yml +++ b/lang/da.yml @@ -418,7 +418,7 @@ label_sort_higher: Flyt op label_sort_lower: Flyt ned label_sort_lowest: Flyt til bunden label_roadmap: Plan -label_roadmap_due_in: Deadline +label_roadmap_due_in: Deadline %s label_roadmap_overdue: %s forsinket label_roadmap_no_issues: Ingen sager i denne version label_search: Søg diff --git a/lang/de.yml b/lang/de.yml index 7ee142528..4135989ef 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -406,7 +406,7 @@ label_sort_higher: Eins höher label_sort_lower: Eins tiefer label_sort_lowest: Ans Ende label_roadmap: Roadmap -label_roadmap_due_in: Fällig in +label_roadmap_due_in: Fällig in %s label_roadmap_overdue: %s verspätet label_roadmap_no_issues: Keine Tickets für diese Version label_search: Suche diff --git a/lang/en.yml b/lang/en.yml index 5ad1e5588..8a73a3992 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -418,7 +418,7 @@ label_sort_higher: Move up label_sort_lower: Move down label_sort_lowest: Move to bottom label_roadmap: Roadmap -label_roadmap_due_in: Due in +label_roadmap_due_in: Due in %s label_roadmap_overdue: %s late label_roadmap_no_issues: No issues for this version label_search: Search diff --git a/lang/es.yml b/lang/es.yml index 320a169fa..ae367d842 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -344,7 +344,7 @@ label_sort_higher: Subir label_sort_lower: Bajar label_sort_lowest: Último label_roadmap: Roadmap -label_roadmap_due_in: Finaliza en +label_roadmap_due_in: Finaliza en %s label_roadmap_no_issues: No hay peticiones para esta versión label_search: Búsqueda label_result: %d resultado diff --git a/lang/fi.yml b/lang/fi.yml index 1953fdfe5..225563b37 100644 --- a/lang/fi.yml +++ b/lang/fi.yml @@ -373,7 +373,7 @@ label_sort_higher: Siirrä ylös label_sort_lower: Siirrä alas label_sort_lowest: Siirrä alimmaiseksi label_roadmap: Roadmap -label_roadmap_due_in: Määräaika +label_roadmap_due_in: Määräaika %s label_roadmap_overdue: %s myöhässä label_roadmap_no_issues: Ei tapahtumia tälle versiolle label_search: Haku diff --git a/lang/fr.yml b/lang/fr.yml index eb52d5a57..b64078068 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -417,7 +417,7 @@ label_sort_higher: Remonter label_sort_lower: Descendre label_sort_lowest: Descendre en dernier label_roadmap: Roadmap -label_roadmap_due_in: Echéance dans +label_roadmap_due_in: Echéance dans %s label_roadmap_overdue: En retard de %s label_roadmap_no_issues: Aucune demande pour cette version label_search: Recherche diff --git a/lang/he.yml b/lang/he.yml index 7a6c62ef6..07962d2de 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -357,7 +357,7 @@ label_sort_higher: הזז למעלה label_sort_lower: הזז למטה label_sort_lowest: הזז לתחתית label_roadmap: מפת הדרכים -label_roadmap_due_in: נגמר בעוד +label_roadmap_due_in: %s נגמר בעוד label_roadmap_overdue: %s מאחר label_roadmap_no_issues: אין נושאים לגירסא זו label_search: חפש diff --git a/lang/hu.yml b/lang/hu.yml index ad150b5f9..3a3d18a12 100644 --- a/lang/hu.yml +++ b/lang/hu.yml @@ -407,7 +407,7 @@ label_sort_higher: Eggyel feljebb label_sort_lower: Eggyel lejjebb label_sort_lowest: Az aljára label_roadmap: Életút -label_roadmap_due_in: Elkészültéig várhatóan még +label_roadmap_due_in: Elkészültéig várhatóan még %s label_roadmap_overdue: %s késésben label_roadmap_no_issues: Nincsenek feladatok ehhez a verzióhoz label_search: Keresés diff --git a/lang/it.yml b/lang/it.yml index 259135886..0178b62ba 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -352,7 +352,7 @@ label_sort_higher: Su label_sort_lower: Giù label_sort_lowest: Sposta in fondo label_roadmap: Roadmap -label_roadmap_due_in: Da ultimare in +label_roadmap_due_in: Da ultimare in %s label_roadmap_overdue: %s late label_roadmap_no_issues: Nessuna segnalazione per questa versione label_search: Ricerca diff --git a/lang/ja.yml b/lang/ja.yml index c38c2ef70..4e46212b2 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -353,7 +353,7 @@ label_sort_higher: 上へ label_sort_lower: 下へ label_sort_lowest: 一番下へ label_roadmap: ロードマップ -label_roadmap_due_in: 期日まで +label_roadmap_due_in: 期日まで %s label_roadmap_overdue: %s late label_roadmap_no_issues: このバージョンに向けてのチケットはありません label_search: 検索 diff --git a/lang/ko.yml b/lang/ko.yml index 27adf167c..c23ea71cd 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -359,7 +359,7 @@ label_sort_higher: 위로 label_sort_lower: 아래로 label_sort_lowest: 최하단으로 label_roadmap: 로드맵 -label_roadmap_due_in: 기한 +label_roadmap_due_in: 기한 %s label_roadmap_overdue: %s 지연 label_roadmap_no_issues: 이버전에 해당하는 이슈 없음 label_search: 검색 diff --git a/lang/lt.yml b/lang/lt.yml index 5110a6b6a..f29c28c4f 100644 --- a/lang/lt.yml +++ b/lang/lt.yml @@ -371,7 +371,7 @@ label_sort_higher: Perkelti į viršų label_sort_lower: Perkelti žemyn label_sort_lowest: Perkelti į apačią label_roadmap: Veiklos grafikas -label_roadmap_due_in: Baigiasi po +label_roadmap_due_in: Baigiasi po %s label_roadmap_overdue: %s vėluojama label_roadmap_no_issues: Jokio darbo šiai versijai nėra label_search: Ieškoti diff --git a/lang/nl.yml b/lang/nl.yml index 10d02cca7..8fd96d1c1 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -352,7 +352,7 @@ label_sort_higher: Verplaats naar boven label_sort_lower: Verplaats naar beneden label_sort_lowest: Verplaats naar eind label_roadmap: Roadmap -label_roadmap_due_in: Voldaan in +label_roadmap_due_in: Voldaan in %s label_roadmap_overdue: %s overtijd label_roadmap_no_issues: Geen issues voor deze versie label_search: Zoeken diff --git a/lang/no.yml b/lang/no.yml index 2b78826d0..8cd6952c6 100644 --- a/lang/no.yml +++ b/lang/no.yml @@ -410,7 +410,7 @@ label_sort_higher: Flytt opp label_sort_lower: Flytt ned label_sort_lowest: Flytt til bunnen label_roadmap: Veikart -label_roadmap_due_in: Frist om +label_roadmap_due_in: Frist om %s label_roadmap_overdue: %s over fristen label_roadmap_no_issues: Ingen saker for denne versjonen label_search: Søk diff --git a/lang/pl.yml b/lang/pl.yml index 6bdac481c..5003db739 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -344,7 +344,7 @@ label_sort_higher: Do góry label_sort_lower: Do dołu label_sort_lowest: Przesuń na dół label_roadmap: Mapa -label_roadmap_due_in: W czasie +label_roadmap_due_in: W czasie %s label_roadmap_no_issues: Brak zagadnień do tej wersji label_search: Szukaj label_result_plural: Rezultatów diff --git a/lang/pt-br.yml b/lang/pt-br.yml index a4bbefe01..3e314af8c 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -415,7 +415,7 @@ label_sort_higher: Mover para cima label_sort_lower: Mover para baixo label_sort_lowest: Mover para o fim label_roadmap: Planejamento -label_roadmap_due_in: Previsto para +label_roadmap_due_in: Previsto para %s label_roadmap_overdue: %s atrasado label_roadmap_no_issues: Sem tickets para esta versão label_search: Busca diff --git a/lang/pt.yml b/lang/pt.yml index 98cde780a..b68144cf4 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -352,7 +352,7 @@ label_sort_higher: Mover para cima label_sort_lower: Mover para baixo label_sort_lowest: Mover para o fim label_roadmap: Roadmap -label_roadmap_due_in: Termina em +label_roadmap_due_in: Termina em %s label_roadmap_overdue: %s late label_roadmap_no_issues: Sem tarefas para essa versão label_search: Busca diff --git a/lang/ro.yml b/lang/ro.yml index 855662c58..94278256e 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -352,7 +352,7 @@ label_sort_higher: Muta sus label_sort_lower: Mota jos label_sort_lowest: Mota ultima label_roadmap: Harta activitatiilor -label_roadmap_due_in: Rezolvat in +label_roadmap_due_in: Rezolvat in %s label_roadmap_overdue: %s intarziere label_roadmap_no_issues: Nu sunt tichete pentru aceasta reviziune label_search: Cauta diff --git a/lang/ru.yml b/lang/ru.yml index 0f705c0d3..ce5e43b7d 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -477,7 +477,7 @@ label_result_plural: Результаты label_reverse_chronological_order: В обратном порядке label_revision_plural: Редакции label_revision: Редакция -label_roadmap_due_in: Вовремя +label_roadmap_due_in: Вовремя %s label_roadmap_no_issues: Нет задач для данной версии label_roadmap_overdue: %s опоздание label_roadmap: Оперативный план diff --git a/lang/sr.yml b/lang/sr.yml index 574470e1b..720dfcdff 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -362,7 +362,7 @@ label_sort_higher: premesti na gore label_sort_lower: Premesti na dole label_sort_lowest: Premesti na dno label_roadmap: Roadmap -label_roadmap_due_in: Završava se za +label_roadmap_due_in: Završava se za %s label_roadmap_overdue: %s kasni label_roadmap_no_issues: Nema kartica za ovu verziju label_search: Traži diff --git a/lang/sv.yml b/lang/sv.yml index 1e7d292d6..393ade818 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -352,7 +352,7 @@ label_sort_higher: Flytta up label_sort_lower: Flytta ner label_sort_lowest: Flytta till botten label_roadmap: Roadmap -label_roadmap_due_in: Färdig om +label_roadmap_due_in: Färdig om %s label_roadmap_overdue: %s late label_roadmap_no_issues: Inga brister för denna version label_search: Sök diff --git a/lang/th.yml b/lang/th.yml index 0ad6b9b93..362e44756 100644 --- a/lang/th.yml +++ b/lang/th.yml @@ -408,7 +408,7 @@ label_sort_higher: ย้ายขึ้น label_sort_lower: ย้ายลง label_sort_lowest: ย้ายไปล่างสุด label_roadmap: แผนงาน -label_roadmap_due_in: ถึงกำหนดใน +label_roadmap_due_in: ถึงกำหนดใน %s label_roadmap_overdue: %s ช้ากว่ากำหนด label_roadmap_no_issues: ไม่มีปัญหาสำหรับรุ่นนี้ label_search: ค้นหา diff --git a/lang/tr.yml b/lang/tr.yml index 7cb2a9e63..ba9c0b41b 100644 --- a/lang/tr.yml +++ b/lang/tr.yml @@ -405,7 +405,7 @@ label_sort_higher: Yukarı taşı label_sort_lower: Aşağı taşı label_sort_lowest: Dibe taşı label_roadmap: Yol Haritası -label_roadmap_due_in: Due in +label_roadmap_due_in: Due in %s label_roadmap_overdue: %s geç label_roadmap_no_issues: Bu versiyon için ileti yok label_search: Ara diff --git a/lang/uk.yml b/lang/uk.yml index 055d27ed9..de5f65eb0 100644 --- a/lang/uk.yml +++ b/lang/uk.yml @@ -368,7 +368,7 @@ label_sort_higher: Вгору label_sort_lower: Вниз label_sort_lowest: У кінець label_roadmap: Оперативний план -label_roadmap_due_in: Строк +label_roadmap_due_in: Строк %s label_roadmap_overdue: %s запізнення label_roadmap_no_issues: Немає питань для даної версії label_search: Пошук diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml index db4615a39..6feb0a0e8 100644 --- a/lang/zh-tw.yml +++ b/lang/zh-tw.yml @@ -418,7 +418,7 @@ label_sort_higher: 往上移動 label_sort_lower: 往下移動 label_sort_lowest: 移動至結尾 label_roadmap: 版本藍圖 -label_roadmap_due_in: 倒數天數: +label_roadmap_due_in: 倒數天數 %s label_roadmap_overdue: %s 逾期 label_roadmap_no_issues: 此版本尚未包含任何項目 label_search: 搜尋 diff --git a/lang/zh.yml b/lang/zh.yml index 5c3cf06a1..d2e571b4d 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -418,7 +418,7 @@ label_sort_higher: 上移 label_sort_lower: 下移 label_sort_lowest: 置底 label_roadmap: 路线图 -label_roadmap_due_in: 截止日期到 +label_roadmap_due_in: 截止日期到 %s label_roadmap_overdue: %s 延期 label_roadmap_no_issues: 该版本没有问题 label_search: 搜索 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 7ef47f592..35e26ebd4 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -367,4 +367,18 @@ EXPECTED assert_equal Time.now.strftime('%d %m %Y %H %M'), format_time(now) assert_equal Time.now.strftime('%H %M'), format_time(now, false) end + + def test_due_date_distance_in_words + to_test = { Date.today => 'Due in 0 days', + Date.today + 1 => 'Due in 1 day', + Date.today + 100 => 'Due in 100 days', + Date.today + 20000 => 'Due in 20000 days', + Date.today - 1 => '1 day late', + Date.today - 100 => '100 days late', + Date.today - 20000 => '20000 days late', + } + to_test.each do |date, expected| + assert_equal expected, due_date_distance_in_words(date) + end + end end |