mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-31 20:51:02 -05:00
DRY the nav bars and make all the same
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
- content_for :buttonbar do
|
||||
- if current_member
|
||||
= link_to 'My Gardens', member_gardens_path(owner: current_member.slug), class: 'btn btn-default'
|
||||
|
||||
= link_to "Everyone's gardens", gardens_path, class: 'btn btn-default'
|
||||
|
||||
- if can?(:create, Garden)
|
||||
= link_to 'Add a garden', new_garden_path, class: 'btn btn-default'
|
||||
- unless current_member
|
||||
= render 'shared/signin_signup', to: 'add a new garden'
|
||||
@@ -1,6 +1,6 @@
|
||||
- content_for :title, @owner ? "#{@owner}'s gardens" : "Everyone's gardens"
|
||||
|
||||
= render 'nav'
|
||||
= render 'layouts/nav', model: Garden
|
||||
|
||||
= link_to gardens_active_tickbox_path(@owner, @show_all) do
|
||||
= check_box_tag 'active', 'all', @show_all
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
%p
|
||||
- if can? :create, Harvest
|
||||
- if @planting && @planting.owner == current_member
|
||||
= link_to 'Add harvest', new_planting_harvest_path(planting: @planting), class: 'btn btn-primary'
|
||||
- elsif @owner
|
||||
%p
|
||||
- if @owner == current_member
|
||||
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
|
||||
= link_to "View everyone's harvests", harvests_path, class: 'btn btn-default'
|
||||
- else # everyone's harvests
|
||||
= link_to 'Add harvest', new_harvest_path, class: 'btn btn-primary'
|
||||
- if current_member
|
||||
= link_to 'View your harvests', member_harvests_path(owner: current_member.slug), class: 'btn btn-default'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: 'track your harvests' }
|
||||
@@ -7,7 +7,8 @@
|
||||
#{ENV['GROWSTUFF_SITE_NAME']} helps you track what you're
|
||||
harvesting from your home garden and see how productive it is.
|
||||
|
||||
= render "nav"
|
||||
= render 'layouts/nav', model: Harvest
|
||||
|
||||
.pagination
|
||||
= page_entries_info @harvests
|
||||
= will_paginate @harvests
|
||||
|
||||
14
app/views/layouts/_nav.haml
Normal file
14
app/views/layouts/_nav.haml
Normal file
@@ -0,0 +1,14 @@
|
||||
- content_for :buttonbar do
|
||||
- if current_member.present?
|
||||
= link_to url_for([current_member, model]), class: 'btn btn-default' do
|
||||
My #{model.model_name.human.pluralize}
|
||||
|
||||
= link_to model, class: 'btn btn-default' do
|
||||
Everyone's #{model.model_name.human.pluralize}
|
||||
|
||||
- if can?(:create, model)
|
||||
= link_to url_for([model, action: :new]), class: 'btn btn-default' do
|
||||
Add a #{model.model_name.human}
|
||||
|
||||
- unless current_member
|
||||
= render 'shared/signin_signup', to: 'add a new seed'
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
- content_for :buttonbar do
|
||||
- if current_member
|
||||
= link_to 'My Plantings', member_plantings_path(owner: current_member.slug), class: 'btn btn-default'
|
||||
- if owner && owner != current_member
|
||||
= link_to "#{owner.login_name}'s Plantings", member_plantings_path(owner: owner.slug), class: 'btn btn-default'
|
||||
= link_to "Everyone's plantings", plantings_path, class: 'btn btn-default'
|
||||
|
||||
= link_to plantings_active_tickbox_path(@owner, show_all) do
|
||||
= check_box_tag 'active', 'all', show_all
|
||||
include in-active
|
||||
|
||||
- if current_member
|
||||
- if can? :create, Planting
|
||||
= link_to 'Plant something', new_planting_path, class: 'btn btn-primary'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: "track what you've planted" }
|
||||
@@ -1,6 +1,7 @@
|
||||
- content_for :title, title('plantings', @owner, @crop, @planting)
|
||||
|
||||
= render 'nav', owner: @owner, show_all: @show_all
|
||||
= render 'layouts/nav', model: Planting
|
||||
|
||||
|
||||
- if @owner
|
||||
= link_to t('.view_owners_profile', owner: @owner), member_path(@owner)
|
||||
|
||||
@@ -7,19 +7,7 @@
|
||||
#{ENV['GROWSTUFF_SITE_NAME']} helps you track your seed
|
||||
stash or trade seeds with other members.
|
||||
|
||||
%p
|
||||
- if can? :create, Seed
|
||||
- if @owner
|
||||
%p
|
||||
- if @owner == current_member
|
||||
= link_to 'Add seeds', new_seed_path, class: 'btn btn-primary'
|
||||
= link_to "View everyone's seeds", seeds_path, class: 'btn btn-default'
|
||||
- else # everyone's seeds
|
||||
= link_to 'Add seeds', new_seed_path, class: 'btn btn-primary'
|
||||
- if current_member
|
||||
= link_to 'View your seeds', member_seeds_path(owner: current_member.slug), class: 'btn btn-default'
|
||||
- else
|
||||
= render partial: 'shared/signin_signup', locals: { to: 'add seeds to your stash' }
|
||||
= render 'layouts/nav', model: Seed
|
||||
|
||||
.pagination
|
||||
= page_entries_info @seeds
|
||||
|
||||
Reference in New Issue
Block a user