From 30255a24d26183f8ec7b07fb75b033ec2d794c3c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 21 Jan 2019 13:40:56 +1300 Subject: [PATCH] Use buttons.* translations for glyphicons titles --- app/views/shared/_global_actions.html.haml | 8 ++++---- app/views/shared/buttons/_add_photo.haml | 2 +- app/views/shared/buttons/_delete.haml | 2 +- app/views/shared/buttons/_edit.haml | 2 +- app/views/shared/buttons/_finish_planting.html.haml | 2 +- app/views/shared/buttons/_finish_seeds.haml | 2 +- app/views/shared/buttons/_harvest_planting.haml | 4 ++-- app/views/shared/buttons/_save_seeds.haml | 4 ++-- config/locales/en.yml | 10 ++++++++++ 9 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/views/shared/_global_actions.html.haml b/app/views/shared/_global_actions.html.haml index d4b4a5e97..59481c858 100644 --- a/app/views/shared/_global_actions.html.haml +++ b/app/views/shared/_global_actions.html.haml @@ -1,6 +1,6 @@ %p .btn-group - = link_to t(:plant_something), new_planting_path, class: 'btn btn-default' - = link_to t(:harvest_something), new_harvest_path, class: 'btn btn-default' - = link_to t(:save_seeds), new_seed_path, class: 'btn btn-default' - = link_to t(:write_blog_post), new_post_path, class: 'btn btn-default' + = link_to t('buttons.plant_something'), new_planting_path, class: 'btn btn-default' + = link_to t('buttons.harvest_something'), new_harvest_path, class: 'btn btn-default' + = link_to t('buttons.save_seeds'), new_seed_path, class: 'btn btn-default' + = link_to t('buttons.write_blog_post'), new_post_path, class: 'btn btn-default' diff --git a/app/views/shared/buttons/_add_photo.haml b/app/views/shared/buttons/_add_photo.haml index c2c87f315..425ca52fc 100644 --- a/app/views/shared/buttons/_add_photo.haml +++ b/app/views/shared/buttons/_add_photo.haml @@ -1,4 +1,4 @@ - if can?(:create, Photo) = link_to path, class: 'btn btn-default btn-xs' do - %span.glyphicon.glyphicon-camera{ title: "Add photo" } + %span.glyphicon.glyphicon-camera{ title: t('buttons.add_photo') } =t('buttons.add_photo') diff --git a/app/views/shared/buttons/_delete.haml b/app/views/shared/buttons/_delete.haml index d89a51d2d..f4ae4f5cd 100644 --- a/app/views/shared/buttons/_delete.haml +++ b/app/views/shared/buttons/_delete.haml @@ -1,4 +1,4 @@ = link_to path, method: :delete, data: { confirm: t(:are_you_sure?) }, class: 'btn btn-default btn-xs' do - %span.glyphicon.glyphicon-trash{ title: t(:delete) } + %span.glyphicon.glyphicon-trash{ title: t('buttons.delete') } =t('buttons.delete') diff --git a/app/views/shared/buttons/_edit.haml b/app/views/shared/buttons/_edit.haml index 3e00821c5..1ad2fc77e 100644 --- a/app/views/shared/buttons/_edit.haml +++ b/app/views/shared/buttons/_edit.haml @@ -1,3 +1,3 @@ = link_to path, class: 'btn btn-default btn-xs' do - %span.glyphicon.glyphicon-pencil{ title: t(:edit) } + %span.glyphicon.glyphicon-pencil{ title: t('buttons.edit') } =t('buttons.edit') diff --git a/app/views/shared/buttons/_finish_planting.html.haml b/app/views/shared/buttons/_finish_planting.html.haml index c38ba3185..5d49418a1 100644 --- a/app/views/shared/buttons/_finish_planting.html.haml +++ b/app/views/shared/buttons/_finish_planting.html.haml @@ -1,5 +1,5 @@ - if can?(:edit, planting) && !planting.finished = link_to planting_path(planting, planting: { finished: 1 }), method: :put, class: 'btn btn-default btn-xs append-date' do - %span.glyphicon.glyphicon-ok{ title: t(:finished) } + %span.glyphicon.glyphicon-ok{ title: t('buttons.finished') } =t('buttons.mark_as_finished') diff --git a/app/views/shared/buttons/_finish_seeds.haml b/app/views/shared/buttons/_finish_seeds.haml index 49c34ac17..4589e50f2 100644 --- a/app/views/shared/buttons/_finish_seeds.haml +++ b/app/views/shared/buttons/_finish_seeds.haml @@ -1,5 +1,5 @@ - unless seed.finished = link_to seed_path(seed, seed: { finished: 1 }), method: :put, class: 'btn btn-default btn-xs append-date' do - %span.glyphicon.glyphicon-ok{ title: t(:finished) } + %span.glyphicon.glyphicon-ok{ title: t('buttons.finished') } =t('buttons.mark_as_finished') diff --git a/app/views/shared/buttons/_harvest_planting.haml b/app/views/shared/buttons/_harvest_planting.haml index 8845e4c01..d81b18fa2 100644 --- a/app/views/shared/buttons/_harvest_planting.haml +++ b/app/views/shared/buttons/_harvest_planting.haml @@ -1,4 +1,4 @@ - planting.active? && if can?(:create, Harvest) && can?(:edit, planting) = link_to new_planting_harvest_path(planting), class: 'btn btn-default btn-xs' do - %span.glyphicon.glyphicon-leaf{ title: :harvest } - =t('buttons.harvest') + %span.glyphicon.glyphicon-leaf{ title: = t('buttons.harvest') } + = t('buttons.harvest') diff --git a/app/views/shared/buttons/_save_seeds.haml b/app/views/shared/buttons/_save_seeds.haml index 312f54cf4..d18807b2b 100644 --- a/app/views/shared/buttons/_save_seeds.haml +++ b/app/views/shared/buttons/_save_seeds.haml @@ -1,4 +1,4 @@ - if planting.active? = link_to new_planting_seed_path(planting), class: 'btn btn-default btn-xs' do - %span.glyphicon.glyphicon-heart{ title: t(:save_seeds) } - =t('buttons.save_seeds') + %span.glyphicon.glyphicon-heart{ title: t('buttons.save_seeds') } + = t('buttons.save_seeds') diff --git a/config/locales/en.yml b/config/locales/en.yml index 879d7c51c..7f2778983 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -63,6 +63,16 @@ en: seed: one: seed other: seeds + buttons: + add_photo: Add photo + delete: Delete + edit: Edit + harvest: Harvest + harvest_something: Harvest something + mark_as_finished: Mark as finished + plant_something: Plant something + save_seeds: Save seeds + write_blog_post: Write blog post crops: index: subtitle: "%{crops_size} total"