mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 05:29:31 -04:00
Fix mobile display of member profiles
This commit is contained in:
@@ -2,21 +2,29 @@
|
||||
.text {
|
||||
color: $white;
|
||||
margin: 0;
|
||||
opacity: .9;
|
||||
opacity: .8;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 50%;
|
||||
top: 30%;
|
||||
width: 100%;
|
||||
color: $white;
|
||||
|
||||
h3,
|
||||
h4,
|
||||
h5 {
|
||||
margin: 0
|
||||
}
|
||||
|
||||
h3 {
|
||||
background-color: $green;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
background-color: $black;
|
||||
}
|
||||
|
||||
h5 {
|
||||
background-color: $brown;
|
||||
color: $white;
|
||||
font-size: .7em;
|
||||
}
|
||||
|
||||
a {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.planting {
|
||||
|
||||
.planting-badges {
|
||||
font-size: 1em;
|
||||
position: absolute;
|
||||
@@ -23,12 +22,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.planting-full-badges {
|
||||
.badge {
|
||||
font-size: 200%;
|
||||
}
|
||||
}
|
||||
|
||||
.planting-name {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Overrides applying only to mobile view. This must be at the end of the overrides file.
|
||||
// Extra small devices (portrait phones, less than 576px)
|
||||
@include media-breakpoint-down(xs) {
|
||||
@include media-breakpoint-down(md) {
|
||||
|
||||
#maincontainer {
|
||||
width: 100%;
|
||||
|
||||
@@ -42,6 +42,13 @@ class MembersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
@harvests = Harvest.search(
|
||||
where: {owner_id: @member.id},
|
||||
boost_by: [:created_at],
|
||||
limit: 16,
|
||||
load: false
|
||||
)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
format.json { render json: @member.to_json(only: member_json_fields) }
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
- cache harvest do
|
||||
.card.harvest-thumbnail
|
||||
= link_to image_tag(harvest_image_path(harvest),
|
||||
alt: harvest,
|
||||
class: 'img img-card'),
|
||||
harvest
|
||||
= link_to harvest_path(slug: harvest.slug) do
|
||||
.card.harvest-thumbnail
|
||||
= image_tag(harvest.thumbnail_url ? harvest.thumbnail_url : placeholder_image,
|
||||
alt: harvest.crop_name,
|
||||
class: 'img img-card')
|
||||
|
||||
.text
|
||||
%h3.harvest-plant-part= link_to harvest.plant_part, harvest
|
||||
%h5.harvest-crop= harvest.crop
|
||||
.text
|
||||
%h3.harvest-crop #{harvest.crop_name} harvest
|
||||
%h4.harvest-plant-part= harvest.plant_part_name
|
||||
%h5.harvest-date= harvest.harvested_at
|
||||
|
||||
@@ -4,10 +4,18 @@
|
||||
.index-cards
|
||||
- @harvesting.each do |planting|
|
||||
= render 'plantings/thumbnail', planting: planting
|
||||
|
||||
- if @harvests.any?
|
||||
%section.havests
|
||||
%h2 Recent Harvests
|
||||
.index-cards
|
||||
- @harvests.each do |harvest|
|
||||
= render 'harvests/thumbnail', harvest: harvest
|
||||
|
||||
- if @others.size.positive?
|
||||
%section.planting-progress
|
||||
%h2 Progress report
|
||||
%p Still growing
|
||||
%p Still growing and not ready for harvesting.
|
||||
.list-group
|
||||
- @others.each do |planting|
|
||||
.list-group-item
|
||||
@@ -19,17 +27,21 @@
|
||||
%p
|
||||
These plantings are at the end of their lifecycle.
|
||||
- if member_signed_in? && @member == current_member
|
||||
When you have removed the planting from your garden, mark the planting as finished in Growstuff.
|
||||
%strong When you have removed the planting from your garden, mark the planting as finished in Growstuff.
|
||||
.index-cards
|
||||
- @late.each do |planting|
|
||||
= render 'plantings/thumbnail', planting: planting
|
||||
- if @super_late.size.positive?
|
||||
- if @super_late.any?
|
||||
%section.superlate
|
||||
%h2 Super late
|
||||
%p
|
||||
We suspect the following plantings finished long ago and no longer need tracking. You can mark them as finished to stop tracking.
|
||||
We suspect the following plantings finished long ago and no longer need tracking.
|
||||
- if member_signed_in? && current_member == @member
|
||||
%strong You can mark these plantings as finished to stop tracking.
|
||||
%ul
|
||||
- @super_late.each do |planting|
|
||||
%li
|
||||
= link_to planting.crop_name, planting_url(slug: planting.slug)
|
||||
planted on #{planting.planted_at.to_date}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
- if planting.finish_is_predicatable?
|
||||
- if planting.super_late?
|
||||
%span.badge.badge-info.badge-super-late= t('.super_late')
|
||||
= planting_finish_button(planting)
|
||||
- elsif planting.late?
|
||||
%span.badge.badge-info.badge-late= t('.late_finishing')
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
.card.thumbnail
|
||||
.card.planting.thumbnail
|
||||
.planting-thumbnail-image
|
||||
= link_to image_tag(planting_image_path(planting),
|
||||
alt: planting.crop, class: 'img-card'),
|
||||
planting
|
||||
.card-body
|
||||
%h5.card-title
|
||||
%h4
|
||||
= crop_icon(planting.crop)
|
||||
= link_to planting.crop, planting
|
||||
%h6.card-subtitle.text-muted=planting.finished_at
|
||||
= render 'plantings/badges', planting: planting
|
||||
planting
|
||||
- if planting.finished_at.present?
|
||||
%h6.card-subtitle.text-muted=planting.finished_at
|
||||
|
||||
@@ -150,6 +150,54 @@ describe "member profile", js: true do
|
||||
it { expect(page).to have_link href: photo_path(photo) }
|
||||
it { expect(page).to have_link href: planting_path(planting) }
|
||||
end
|
||||
|
||||
context 'plantings' do
|
||||
let(:crop) { FactoryBot.create :crop }
|
||||
before do
|
||||
# time to harvest = 50 day
|
||||
# time to finished = 90 days
|
||||
FactoryBot.create(:harvest,
|
||||
harvested_at: 50.days.ago,
|
||||
crop: crop,
|
||||
planting: FactoryBot.create(:planting,
|
||||
crop: crop,
|
||||
planted_at: 100.days.ago,
|
||||
finished_at: 10.days.ago))
|
||||
crop.plantings.each(&:update_harvest_days!)
|
||||
crop.update_lifespan_medians
|
||||
crop.update_harvest_medians
|
||||
|
||||
growing_planting
|
||||
harvesting_planting
|
||||
super_late_planting
|
||||
|
||||
visit member_path(member)
|
||||
end
|
||||
|
||||
let(:growing_planting) do
|
||||
FactoryBot.create :planting,
|
||||
crop: crop,
|
||||
owner: member,
|
||||
planted_at: Time.zone.today
|
||||
end
|
||||
|
||||
let(:harvesting_planting) do
|
||||
FactoryBot.create :planting,
|
||||
crop: crop,
|
||||
owner: member,
|
||||
planted_at: 51.days.ago
|
||||
end
|
||||
|
||||
let(:super_late_planting) do
|
||||
FactoryBot.create :planting,
|
||||
crop: crop, owner: member,
|
||||
planted_at: 260.days.ago
|
||||
end
|
||||
|
||||
it { expect(page).to have_link(href: planting_path(growing_planting)) }
|
||||
it { expect(page).to have_link(href: planting_path(harvesting_planting)) }
|
||||
it { expect(page).to have_link(href: planting_path(super_late_planting)) }
|
||||
end
|
||||
end
|
||||
|
||||
context "not signed in" do
|
||||
|
||||
Reference in New Issue
Block a user