From e4ce95c3a18496e8bc20787331d8f11c6b6b6e25 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang <%= e.event_datetime.strftime("%H:%M") %> <%= link_to truncate(e.event_title, 100), e.event_url %> <%= format_time(e.event_datetime, false) %> <%= link_to truncate(e.event_title, 100), e.event_url %><%= day_name(day.cwday) %> <%= day.day %>
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| %>
-
+
<% unless e.event_description.blank? %><%= truncate(e.event_description, 500) %>
<% end %>
-<%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '0'], ['ISO 8601 (YYYY-MM-DD)', '1']], Setting.date_format) %>
+<%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '']] + Setting::DATE_FORMATS.collect {|f| [Date.today.strftime(f), f]}, Setting.date_format) %> + ++<%= select_tag 'settings[time_format]', options_for_select( [[l(:label_language_based), '']] + Setting::TIME_FORMATS.collect {|f| [Time.now.strftime(f), f]}, Setting.time_format) %>
<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB
diff --git a/config/settings.yml b/config/settings.yml index 333203f03..c59a5242e 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -71,11 +71,10 @@ autologin: format: int default: 0 # date format -# 0: language based -# 1: ISO format date_format: - format: int - default: 0 + default: '' +time_format: + default: '' cross_project_issue_relations: default: 0 notified_events: diff --git a/lang/bg.yml b/lang/bg.yml index 06ad0c39d..09a943973 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/cs.yml b/lang/cs.yml index 261b41d8b..493bc77a5 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/de.yml b/lang/de.yml index c0389fb34..7463e93ec 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/en.yml b/lang/en.yml index 00a4886da..c51a76c80 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -186,6 +186,7 @@ setting_commit_ref_keywords: Referencing keywords setting_commit_fix_keywords: Fixing keywords setting_autologin: Autologin setting_date_format: Date format +setting_time_format: Time format setting_cross_project_issue_relations: Allow cross-project issue relations setting_issue_list_default_columns: Default columns displayed on the issue list setting_repositories_encodings: Repositories encodings @@ -425,7 +426,7 @@ label_month: Month label_week: Week label_date_from: From label_date_to: To -label_language_based: Language based +label_language_based: Based on user's language label_sort_by: Sort by %s label_send_test_email: Send a test email label_feeds_access_key_created_on: RSS access key created %s ago diff --git a/lang/es.yml b/lang/es.yml index ca4ede610..6807cacb9 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -540,3 +540,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/fr.yml b/lang/fr.yml index 345968088..a44604a0d 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -186,6 +186,7 @@ setting_commit_ref_keywords: Mot-clés de référencement setting_commit_fix_keywords: Mot-clés de résolution setting_autologin: Autologin setting_date_format: Format de date +setting_time_format: Format d'heure setting_cross_project_issue_relations: Autoriser les relations entre demandes de différents projets setting_issue_list_default_columns: Colonnes affichées par défaut sur la liste des demandes setting_repositories_encodings: Encodages des dépôts @@ -425,7 +426,7 @@ label_month: Mois label_week: Semaine label_date_from: Du label_date_to: Au -label_language_based: Basé sur la langue +label_language_based: Basé sur la langue de l'utilisateur label_sort_by: Trier par %s label_send_test_email: Envoyer un email de test label_feeds_access_key_created_on: Clé d'accès RSS créée il y a %s diff --git a/lang/he.yml b/lang/he.yml index 46015d6f9..089cfdc7d 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/it.yml b/lang/it.yml index 2cf222c1b..13c848935 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/ja.yml b/lang/ja.yml index 03544f971..6fd8dfcc6 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -538,3 +538,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/ko.yml b/lang/ko.yml index 020b70cd8..9998f2f64 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -537,3 +537,4 @@ label_nobody: nobody setting_protocol: Protocol mail_body_account_information: Your Redmine account information label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/nl.yml b/lang/nl.yml index 81f3f0aeb..ab1913e19 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -538,3 +538,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/pl.yml b/lang/pl.yml index 6ada8c3af..0b433bacb 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: Możesz użyÄ twojego "%s" konta do zal mail_body_account_information: Twoje konto w Redmine setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/pt-br.yml b/lang/pt-br.yml index 05bd4bcb8..d4f51b61d 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/pt.yml b/lang/pt.yml index b6c16b452..bfd89bbae 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/ro.yml b/lang/ro.yml index 0f3f5d144..049efa7b1 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -38,10 +38,10 @@ activerecord_error_circular_dependency: Aceasta relatie ar crea dependenta circu general_fmt_age: %d an general_fmt_age_plural: %d ani -general_fmt_date: %%m/%%d/%%A -general_fmt_datetime: %%m/%%d/%%A %%Z:%%L %%p -general_fmt_datetime_short: %%b %%d, %%Z:%%L %%p -general_fmt_time: %%Z:%%L %%p +general_fmt_date: %%m/%%d/%%Y +general_fmt_datetime: %%m/%%d/%%Y %%I:%%M %%p +general_fmt_datetime_short: %%b %%d, %%I:%%M %%p +general_fmt_time: %%I:%%M %%p general_text_No: 'Nu' general_text_Yes: 'Da' general_text_no: 'nu' @@ -74,9 +74,9 @@ notice_email_sent: Un e-mail a fost trimis la adresa %s notice_email_error: Eroare in trimiterea e-mailului (%s) notice_feeds_access_key_reseted: Parola de acces RSS a fost resetat. -mail_subject_lost_password: Parola clair.ro|PM +mail_subject_lost_password: Your Redmine password mail_body_lost_password: 'To change your Redmine password, click on the following link:' -mail_subject_register: Activare cont clair.ro|PM +mail_subject_register: Redmine account activation mail_body_register: 'To activate your Redmine account, click on the following link:' gui_validation_error: 1 eroare @@ -537,3 +537,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/ru.yml b/lang/ru.yml index 3acddd607..77ff6ec5e 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -537,3 +537,4 @@ default_activity_development: РазÑабоÑка enumeration_issue_priorities: ÐÑиоÑиÑеÑÑ Ð·Ð°Ð´Ð°Ñ enumeration_doc_categories: ÐаÑегоÑии докÑменÑов enumeration_activities: ÐейÑÑÐ²Ð¸Ñ (ÑÑÐµÑ Ð²Ñемени) +setting_time_format: Time format diff --git a/lang/sr.yml b/lang/sr.yml index 7a06ca8a2..1072af7eb 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -538,3 +538,4 @@ label_float: Float button_copy: Copy setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/sv.yml b/lang/sv.yml index fce6a71d6..d22b5c478 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -538,3 +538,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/lang/zh.yml b/lang/zh.yml index 9e4b7e931..19e5b122b 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -540,3 +540,4 @@ mail_body_account_information_external: You can use your "%s" account to log int mail_body_account_information: Your Redmine account information setting_protocol: Protocol label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself" +setting_time_format: Time format diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index b3ed9102e..06446d15e 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -75,4 +75,32 @@ class ApplicationHelperTest < HelperTestCase text = "{{hello_world}}" assert textilizable(text).match(/Hello world!/) end + + def test_date_format_default + today = Date.today + Setting.date_format = '' + assert_equal l_date(today), format_date(today) + end + + def test_date_format + today = Date.today + Setting.date_format = '%d %m %Y' + assert_equal today.strftime('%d %m %Y'), format_date(today) + end + + def test_time_format_default + now = Time.now + Setting.date_format = '' + Setting.time_format = '' + assert_equal l_datetime(now), format_time(now) + assert_equal l_time(now), format_time(now, false) + end + + def test_time_format + now = Time.now + Setting.date_format = '%d %m %Y' + Setting.time_format = '%H %M' + assert_equal now.strftime('%d %m %Y %H %M'), format_time(now) + assert_equal now.strftime('%H %M'), format_time(now, false) + end end -- 2.39.5