From e42e27957d50d0fd93bc3caa9d9da3042362c14c Mon Sep 17 00:00:00 2001 From: wvengen Date: Tue, 10 Dec 2013 17:58:32 +0100 Subject: [PATCH] improve task i18n (affects foodcoops#137) --- app/helpers/tasks_helper.rb | 4 ++++ app/views/tasks/_archive_tasks.html.haml | 8 ++++---- app/views/tasks/_list.haml | 6 +++--- app/views/tasks/show.haml | 12 ++++++------ config/locales/en.yml | 9 +-------- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/helpers/tasks_helper.rb b/app/helpers/tasks_helper.rb index f2a9bea5..e9db9e22 100644 --- a/app/helpers/tasks_helper.rb +++ b/app/helpers/tasks_helper.rb @@ -13,4 +13,8 @@ module TasksHelper title: I18n.t('helpers.tasks.required_users', :count => task.still_required_users) end end + + def task_title(task) + I18n.t('helpers.tasks.task_title', name: task.name, duration: task.duration) + end end diff --git a/app/views/tasks/_archive_tasks.html.haml b/app/views/tasks/_archive_tasks.html.haml index 9ece4d05..95f6fd4a 100644 --- a/app/views/tasks/_archive_tasks.html.haml +++ b/app/views/tasks/_archive_tasks.html.haml @@ -5,13 +5,13 @@ %table.table.table-striped %thead %tr - %th= t '.due_date' - %th= t '.task' - %th= t '.who' + %th= heading_helper Task, :due_date + %th= heading_helper Task, :name + %th= heading_helper Task, :user_list %th %tbody - @tasks.each do |task| %tr %td= task.due_date unless task.due_date.nil? - %td= link_to t('.task_format', name: task.name, duration: task.duration), task_path(task) + %td= link_to task_title(task), task_path(task) %td= task_assignments task diff --git a/app/views/tasks/_list.haml b/app/views/tasks/_list.haml index da91cec8..f3b191ee 100644 --- a/app/views/tasks/_list.haml +++ b/app/views/tasks/_list.haml @@ -1,9 +1,9 @@ %table.table.table-striped %thead %tr - %th= t '.due_date' + %th= heading_helper Task, :due_date %th - %th= t '.task' + %th= heading_helper Task, :name %th{:colspan => '2'} = t '.who' %small= t '.who_hint' @@ -15,7 +15,7 @@ %td - if task.periodic? %i.icon-repeat{title: t('tasks.repeated')} - %td= link_to t('.task_format', name: task.name, duration: task.duration), task_path(task) + %td= link_to task_title(task), task_path(task) %td = task_assignments task = highlighted_required_users task diff --git a/app/views/tasks/show.haml b/app/views/tasks/show.haml index 86de92bf..fd3805ba 100644 --- a/app/views/tasks/show.haml +++ b/app/views/tasks/show.haml @@ -3,22 +3,22 @@ %section %dl.dl-horizontal - %dt= Task.human_attribute_name(:name) + %dt= heading_helper Task, :name %dd= @task.name - if @task.description.present? - %dt= Task.human_attribute_name(:description) + %dt= heading_helper Task, :description %dd= simple_format(@task.description) - if @task.due_date.present? - %dt= Task.human_attribute_name(:due_date) + %dt= heading_helper Task, :due_date %dd = format_date(@task.due_date) - if @task.periodic? %i.icon-repeat{title: t('tasks.repeated')} - %dt= Task.human_attribute_name(:duration) + %dt= heading_helper Task, :duration %dd= t('.hours', count: @task.duration) - %dt= Task.human_attribute_name(:user_list) + %dt= heading_helper Task, :user_list %dd= task_assignments(@task) - %dt= Task.human_attribute_name(:workgroup) + %dt= heading_helper Task, :workgroup %dd - if @task.workgroup = link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id) diff --git a/config/locales/en.yml b/config/locales/en.yml index 13c5299c..83100dd8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -802,6 +802,7 @@ en: message: create: send message tasks: + task_title: ! '%{name} (%{duration}h)' required_users: ! '%{count} members are still needed!' home: apple_bar: @@ -1491,11 +1492,6 @@ en: notice: You have accepted the task archive: title: Task archive - archive_tasks: - due_date: Due date - task: Subject - task_format: ! '%{name} (%{duration}h)' - who: People in charge create: notice: Task has been created destroy: @@ -1519,11 +1515,8 @@ en: accept_task: Accept task done: Done done_q: Done? - due_date: Due date mark_done: Mark task as done reject_task: Reject task - task: subject - task_format: ! '%{name} (%{duration}h)' who: Who is doing it? who_hint: (How much are still needed?) nav: