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.
- Loading branch information
Showing
5 changed files
with
97 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,5 +320,3 @@ html, body { | |
.hide { | ||
display: none; | ||
} | ||
|
||
|
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,9 +1,11 @@ | ||
%ul | ||
- @count ||= 5 | ||
- @count ||= 0 | ||
- unless defined? max | ||
- max = 0 # list all without "show all" toggle button | ||
- display_crops.each do |c| | ||
%li.crop-hierarchy{:class => @count <= 0 ? ['hide', 'toggle'] : []} | ||
%li.crop-hierarchy{:class => max != 0 && @count >= max ? ['hide', 'toggle'] : []} | ||
= link_to c, c | ||
- @count -= 1 | ||
- @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,18 +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 ] } | ||
- if @count < 0 | ||
= button_tag "Show all #{crop.varieties.size} varieties", :class => 'btn btn-link toggle' | ||
= button_tag "Show less varieties", :class => 'btn btn-link toggle hide' | ||
- 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