This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
forked from Growstuff/growstuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Growstuff#729 from oshiho3/621-crop-varieties-sidebar
Growstuff#621 Crop varieties sidebar
- Loading branch information
Showing
5 changed files
with
116 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
%ul | ||
- @count ||= 0 | ||
- unless defined? max | ||
- max = 0 # list all without "show all" toggle button | ||
- display_crops.each do |c| | ||
%li.crop-hierarchy | ||
%li.crop-hierarchy{:class => max != 0 && @count >= max ? ['hide', 'toggle'] : []} | ||
= link_to c, c | ||
- @count += 1 | ||
- if c.varieties.present? | ||
- c.varieties.each do |v| | ||
= render :partial => 'hierarchy', :locals => { :display_crops => [ v ] } | ||
= render :partial => 'hierarchy', :locals => { :display_crops => [ v ], :max => max } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
- if crop.parent | ||
%p | ||
= crop.name | ||
is a variety of | ||
= succeed "." do | ||
= link_to crop.parent, crop.parent | ||
.varieties | ||
- if crop.parent | ||
%p | ||
= crop.name | ||
is a variety of | ||
= succeed "." do | ||
= link_to crop.parent, crop.parent | ||
|
||
- unless crop.varieties.empty? | ||
%p | ||
Varieties of #{crop.name}: | ||
- unless crop.varieties.empty? | ||
%p | ||
Varieties of #{crop.name}: | ||
|
||
= render :partial => 'hierarchy', :locals => { :display_crops => [ crop ] } | ||
- max = 5 | ||
= render :partial => 'hierarchy', :locals => { :display_crops => [ crop ], :max => max } | ||
- if max != 0 && @count > max | ||
= button_tag "Show all #{@count-1} varieties", :class => 'btn btn-link toggle crop-hierarchy' | ||
= button_tag "Show less varieties", :class => 'btn btn-link toggle crop-hierarchy hide' | ||
|
||
- if ! crop.parent and crop.varieties.empty? | ||
%p None known. | ||
- if ! crop.parent and crop.varieties.empty? | ||
%p None known. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters