DRY the icons

This commit is contained in:
Brenda Wallace
2019-01-23 17:34:32 +13:00
parent 4e82584a0a
commit e912211cee
3 changed files with 30 additions and 7 deletions

View File

@@ -0,0 +1,17 @@
module IconsHelper
def garden_icon
icon('far', 'square')
end
def planting_icon
icon('fas', 'seedling')
end
def harvest_icon
icon('fas', 'carrot')
end
def seed_icon
icon('fas', 'heart')
end
end

View File

@@ -2,12 +2,15 @@
.btn-group
- if can? :create, Planting
= link_to new_planting_path(crop_id: crop.id), class: 'btn btn-default' do
= planting_icon
= t('buttons.plant_crop', crop_name: crop.name)
- if can? :create, Harvest
= link_to new_harvest_path(crop_id: crop.id), class: 'btn btn-default' do
= harvest_icon
= t('buttons.harvest_crop', crop_name: crop.name)
- if can? :create, Seed
= link_to new_seed_path(crop_id: crop.id), class: 'btn btn-default' do
= seed_icon
= t('buttons.add_seed_to_stash', crop_name: crop.name)

View File

@@ -1,19 +1,22 @@
- if signed_in?
.global-actions
.global-actions.pull-right
.btn-group
= link_to gardens_by_owner_path(owner: current_member.slug), class: 'btn btn-default' do
= t('links.my_gardens')
= garden_icon
= t('links.my_gardens')
.btn-group
= link_to new_planting_path, class: 'btn btn-default' do
= planting_icon
= t('plantings.plant_something')
= link_to new_harvest_path, class: 'btn btn-default' do
= harvest_icon
= t('harvests.harvest_something')
= link_to new_seed_path, class: 'btn btn-default' do
= seed_icon
= t('buttons.save_seeds')
.btn-group
= link_to t('posts.write_blog_post'), new_post_path, class: 'btn btn-default'
- content_for(:attributions) do
seed by Template from the Noun Project