diff --git a/app/views/shared/_glyphicon.html.haml b/app/views/shared/_glyphicon.html.haml new file mode 100644 index 000000000..39f2546cf --- /dev/null +++ b/app/views/shared/_glyphicon.html.haml @@ -0,0 +1 @@ +%span{class: "glyphicon.glyphicon-#{icon}", title: t(title) } \ No newline at end of file diff --git a/app/views/shared/buttons/_add_photo.haml b/app/views/shared/buttons/_add_photo.haml index 425ca52fc..0e4a75c07 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: t('buttons.add_photo') } + = render 'shared/glyphicon', icon: 'camera', title: 'buttons.add_photo' =t('buttons.add_photo') diff --git a/app/views/shared/buttons/_delete.haml b/app/views/shared/buttons/_delete.haml index f4ae4f5cd..8be23926a 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('buttons.delete') } + = render 'shared/glyphicon', icon: 'trash', title: 'buttons.delete' =t('buttons.delete') diff --git a/app/views/shared/buttons/_edit.haml b/app/views/shared/buttons/_edit.haml index 1ad2fc77e..f7f75ea36 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('buttons.edit') } + = render 'shared/glyphicon', icon: 'pencil', title: '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 5d49418a1..d0a931b41 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('buttons.finished') } - =t('buttons.mark_as_finished') + = render 'shared/glyphicon', icon: 'ok', title: '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 4589e50f2..23316d861 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('buttons.finished') } + = render 'shared/glyphicon', icon: 'ok', title: '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 d81b18fa2..296ee30a0 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: = t('buttons.harvest') } + = render 'shared/glyphicon', icon: 'leaf', title: 'buttons.harvest' = t('buttons.harvest') diff --git a/app/views/shared/buttons/_save_seeds.haml b/app/views/shared/buttons/_save_seeds.haml index d18807b2b..d4cf794f5 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('buttons.save_seeds') } + = render 'shared/glyphicon', icon: 'heart', title: 'buttons.save_seeds' = t('buttons.save_seeds')