mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-24 09:43:24 -04:00
Moved plantings nav bar to own file and simplified
This commit is contained in:
@@ -14,8 +14,8 @@ class PlantingsController < ApplicationController
|
||||
else
|
||||
Planting
|
||||
end
|
||||
|
||||
@plantings = @plantings.current unless params[:all]
|
||||
@show_all = params[:all] == '1'
|
||||
@plantings = @plantings.current unless @show_all
|
||||
@plantings = @plantings.includes(:owner, :crop, :garden).order(:created_at).paginate(page: params[:page])
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
@@ -1,25 +1,10 @@
|
||||
- content_for :title, @owner ? t('.title.owner_plantings', owner: @owner) : @crop ? t('.title.crop_plantings', crop: @crop.name) : t('.title.default')
|
||||
|
||||
= render 'nav', owner: @owner, show_all: @show_all
|
||||
|
||||
- if @owner
|
||||
= link_to "View #{@owner}'s profile >>", member_path(@owner)
|
||||
|
||||
%p
|
||||
- if can? :create, Planting
|
||||
- if @owner
|
||||
%p
|
||||
- if @owner == current_member
|
||||
= link_to 'Plant something', new_planting_path, :class => 'btn btn-primary'
|
||||
- content_for :buttonbar do
|
||||
= link_to 'My Active Plantings', plantings_by_owner_path(:owner=>current_member.slug), :class => 'btn btn-default'
|
||||
= link_to 'All My Plantings', plantings_by_owner_path(:all=>1, :owner=>current_member.slug), :class => 'btn btn-default'
|
||||
= link_to "Everyone's plantings", plantings_path, :class => 'btn btn-default'
|
||||
- else # everyone's plantings
|
||||
= link_to 'Plant something', new_planting_path, :class => 'btn btn-primary'
|
||||
- if current_member
|
||||
= link_to 'View your plantings', plantings_by_owner_path(:owner => current_member.slug), :class => 'btn btn-default'
|
||||
= link_to 'Show all (including inactive)', plantings_path(:all=>1)
|
||||
- else
|
||||
= render :partial => 'shared/signin_signup', :locals => { :to => "track what you've planted" }
|
||||
|
||||
%div.pagination
|
||||
= page_entries_info @plantings
|
||||
= will_paginate @plantings
|
||||
|
||||
Reference in New Issue
Block a user