Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

693 add map notice top #392

Open
wants to merge 2 commits into
base: review
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/controllers/internship_offers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ def format_internship_offers(internship_offers)
is_favorite: !!current_user && internship_offer.is_favorite?(current_user),
logged_in: !!current_user,
can_manage_favorite: can?(:create, Favorite),
can_read_employer_name: can?(:read_employer_name, internship_offer)
can_read_employer_name: can?(:read_employer_name, internship_offer),
fits_for_seconde: internship_offer.fits_for_seconde?,
fits_for_troisieme_or_quatrieme: internship_offer.fits_for_troisieme_or_quatrieme?,
available_weeks_count: internship_offer.presenter.available_weeks_count
}
end
end
Expand Down
24 changes: 17 additions & 7 deletions app/front_assets/components/InternshipOfferCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,25 @@ const InternshipOfferCard = ({
<li>
<div className="fr-tag fr-mr-1w">
<span className="fr-icon-calendar-line fr-mr-1w"></span>
1 semaine disponible
{internshipOffer.available_weeks_count}
</div>
</li>
<li>
<div className="fr-tag fr-mr-1w">4ème</div>
</li>
<li>
<div className="fr-tag">3ème</div>
</li>

{internshipOffer.fits_for_seconde && (
<li>
<div className="fr-tag fr-mr-1w">2de</div>
</li>
)}
{internshipOffer.fits_for_troisieme_or_quatrieme && (
<>
<li>
<div className="fr-tag fr-mr-1w">3ème</div>
</li>
<li>
<div className="fr-tag fr-mr-1w">4ème</div>
</li>
</>
)}
</ul>
{ internshipOffer.logged_in && internshipOffer.can_manage_favorite &&
<span className={`fr-mx-2w fr-my-2w heart-${isFavorite ? 'full' : 'empty'}`}
Expand Down
13 changes: 11 additions & 2 deletions app/front_assets/components/InternshipOfferResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const InternshipOfferResults = ({ count, sectors, title, searchParams }) => {
</div>)
}
{ !isLoading && (internshipOffersSeats == 0) &&
(<p>Aucune offre répondant à vos critères nest disponible.<br/>Vous pouvez modifier vos filtres et relancer votre recherche.</p>)
(<p>Aucune offre répondant à vos critères n'est disponible.<br/>Vous pouvez modifier vos filtres et relancer votre recherche.</p>)
}
</div>
{
Expand Down Expand Up @@ -256,10 +256,19 @@ const InternshipOfferResults = ({ count, sectors, title, searchParams }) => {

{ !isMobile() && (<div className="col-5 map-container">
<div className="">
<div className="fr-notice fr-notice--info">
<div className="fr-container">
<div className="fr-notice__body fr-mx-3v">
<p className="fr-notice__title title-banner">
La carte affiche uniquement les 30 premiers résultats visibles sur cette page.
</p>
</div>
</div>
</div>
<MapContainer center={center} zoom={13} scrollWheelZoom={false}>
<TileLayer
url="https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png"
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">'
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
/>
<MarkerClusterGroup>
{
Expand Down
5 changes: 5 additions & 0 deletions app/libs/presenters/internship_offer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ def weeks_description
end
end

def available_weeks_count
count = internship_offer.weeks.count
"#{count} #{'semaine'.pluralize(count)} #{'disponible'.pluralize(count)}"
end

private

attr_reader :internship_offer
Expand Down
Loading