Breadcrumbs

This commit is contained in:
Brenda Wallace
2019-05-18 23:18:27 +12:00
parent b19bef0ec3
commit dccbf440cb
7 changed files with 85 additions and 35 deletions

View File

@@ -1,5 +1,12 @@
- content_for :title, 'Admin'
- content_for :breadcrumbs do
%nav{"aria-label" => "breadcrumb"}
%ol.breadcrumb
%li.breadcrumb-item
= link_to 'Home', root_path
%li.breadcrumb-item.active= link_to 'Admin', admin_path
%h2 Manage
.row

View File

@@ -1,5 +1,4 @@
- content_for :title, t('.title')
- content_for :subtitle, t('.subtitle', crops_size: @crops.size)
- content_for :buttonbar do
- if can? :wrangle, Crop
@@ -7,24 +6,30 @@
- if can? :create, Crop
= link_to 'Add new Crop', new_crop_path, class: 'btn btn-primary'
- content_for :breadcrumbs do
%nav{"aria-label" => "breadcrumb"}
%ol.breadcrumb
%li.breadcrumb-item
= link_to 'Home', root_path
%li.breadcrumb-item.active= link_to 'Crops', crops_path
- if @num_requested_crops && @num_requested_crops.positive?
= link_to(I18n.t('crops.requested.link', number_crops: @num_requested_crops), requested_crops_path)
%h1=t('.title')
%p
#{ENV['GROWSTUFF_SITE_NAME']} tracks who's growing what, where.
View any crop page to see which of our members have planted it and find
information on how to grow it yourself.
= form_tag(crops_path, method: :get, class: 'form-inline', role: 'form') do
.form-group
= label_tag :sort, "Sort by:", class: 'sr-only'
= select_tag "sort",
options_for_select({ "Sort by popularity": 'popular',
"Sort alphabetically": 'alpha' },
@sort || 'popular'),
class: 'form-control'
= submit_tag "Show", class: 'btn btn-primary'
.well
= form_tag(crops_path, method: :get, class: 'form-inline', role: 'form') do
.form-group
= label_tag :sort, "Sort by:", class: 'sr-only'
= select_tag "sort",
options_for_select({ "Sort by popularity": 'popular',
"Sort alphabetically": 'alpha' },
@sort || 'popular'),
class: 'form-control'
= submit_tag "Show", class: 'btn btn-success'
.pagination= render 'layouts/pagination', collection: @crops
@@ -32,9 +37,7 @@
- @crops.each do |crop|
.col-md-2= render 'crops/thumbnail', crop: crop
.pagination
= will_paginate @crops
.pagination= render 'layouts/pagination', collection: @crops
%ul.list-inline
%li The data on this page is available in the following formats:

View File

@@ -5,6 +5,14 @@
- else
- content_for :title, "Crop search"
- content_for :breadcrumbs do
%nav{"aria-label" => "breadcrumb"}
%ol.breadcrumb
%li.breadcrumb-item
= link_to 'Home', root_path
%li.breadcrumb-item= link_to 'Crops', crops_path
%li.breadcrumb-item.active= link_to 'Search', search_crops_path(term: @term)
%div
= form_tag search_crops_path, method: :get, id: 'crop-search', class: 'form-inline' do
.form-group
@@ -25,10 +33,6 @@
instead.
- else
= will_paginate @crops
.row
- @crops.each do |crop|
.col-md-2= render 'crops/thumbnail', crop: crop
= will_paginate @crops

View File

@@ -10,6 +10,14 @@
- content_for :scripts do
= javascript_include_tag "charts"
- content_for :breadcrumbs do
%nav{"aria-label" => "breadcrumb"}
%ol.breadcrumb
%li.breadcrumb-item
= link_to 'Home', root_path
%li.breadcrumb-item= link_to 'Crops', crops_path
%li.breadcrumb-item.active= link_to @crop, @crop
%h1
= @crop.name
%small= @crop.default_scientific_name

View File

@@ -8,9 +8,14 @@
-# anchor tag for accessibility link to skip the navigation menu
%a{ name: 'skipnav' }
#maincontainer.container
.pull-right= render 'shared/global_actions'
- if content_for?(:buttonbar)
= yield(:buttonbar)
.row
.col-md-12
- if content_for?(:breadcrumbs)
.float-left= yield(:breadcrumbs)
.float-right
= render 'shared/global_actions'
- if content_for?(:buttonbar)
= yield(:buttonbar)
- if content_for?(:subtitle)
%small= yield(:subtitle)

View File

@@ -1,5 +1,13 @@
- content_for :title, @author ? t('.title.author_posts', author: @author) : t('.title.default')
- content_for :breadcrumbs do
%nav{"aria-label" => "breadcrumb"}
%ol.breadcrumb
%li.breadcrumb-item
= link_to 'Home', root_path
- if @author.present?
%li.breadcrumb-item= link_to @author, @author
%li.breadcrumb-item.active= link_to 'posts', posts_path(author: @author.slug)
%h1= @author ? t('.title.author_posts', author: @author) : t('.title.default')
.pagination= render 'layouts/pagination', collection: @posts

View File

@@ -21,6 +21,33 @@
= render "shared/signin_signup",
to: "or to start using #{ENV['GROWSTUFF_SITE_NAME']} to track what you're planting and harvesting"
- content_for :buttonbar do
- if can?(:edit, @post) || can?(:destroy, @post)
- if can? :edit, @post
= link_to edit_post_path(@post), class: 'btn' do
= edit_icon
edit
- if can? :destroy, @post
= link_to @post, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-danger' do
= delete_icon
delete
- if @post.comments.count > 10 && can?(:create, Comment)
= link_to 'Comment', new_comment_path(post_id: @post.id), class: 'btn'
- content_for :breadcrumbs do
%nav{"aria-label" => "breadcrumb"}
%ol.breadcrumb
%li.breadcrumb-item
= link_to 'Home', root_path
%li.breadcrumb-item= link_to @post.author, @post.author
%li.breadcrumb-item= link_to 'posts', posts_path(author: @post.author.slug)
%li.breadcrumb-item.active{"aria-current" => "page"}= @post.subject
.row
.col-8.col-xs-12
@@ -53,18 +80,6 @@
= icon 'fas', 'comment'
Comment
- if can?(:edit, @post) || can?(:destroy, @post)
- if can? :edit, @post
= link_to 'Edit Post', edit_post_path(@post), class: 'btn'
- if can? :destroy, @post
= link_to 'Delete Post', @post, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn'
- if @post.comments.count > 10 && can?(:create, Comment)
= link_to 'Comment', new_comment_path(post_id: @post.id), class: 'btn'
.col-4.col-xs-12
= render @post.author