Skip to content

Commit

Permalink
Merge pull request #32 from hotosm/feat/rfps-volunteer-opportunities
Browse files Browse the repository at this point in the history
Feat/rfps volunteer opportunities
  • Loading branch information
luminaryFlowers authored Jul 17, 2024
2 parents dac0756 + 6251650 commit dfbb611
Show file tree
Hide file tree
Showing 14 changed files with 613 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Generated by Django 4.2.7 on 2024-07-16 21:10

from django.db import migrations, models
import django.db.models.deletion
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
('rfp', '0002_individualrequestforproposalpage_post_date_and_more'),
]

operations = [
migrations.AddField(
model_name='requestforproposalownerpage',
name='aside_block_description',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='aside_block_title',
field=models.CharField(default='Still have questions?'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='current_rfps_title',
field=models.CharField(default='Current RFPs'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='header_description',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='header_image',
field=models.ForeignKey(blank=True, help_text='Header image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='job_opportunities_button_link',
field=models.URLField(blank=True),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='job_opportunities_button_text',
field=models.CharField(default='See All Job Opportunities'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='job_opportunities_description',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='job_opportunities_image',
field=models.ForeignKey(blank=True, help_text='Job opportunities image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='job_opportunities_title',
field=models.CharField(default='See Our Job Opportunities'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='rfp_deadline_text',
field=models.CharField(default='Deadline'),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='rfp_location_text',
field=models.CharField(default='Location'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.2.7 on 2024-07-16 21:15

from django.db import migrations, models
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('rfp', '0003_requestforproposalownerpage_aside_block_description_and_more'),
]

operations = [
migrations.AddField(
model_name='requestforproposalownerpage',
name='no_rfps_description',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='requestforproposalownerpage',
name='no_rfps_title',
field=models.CharField(default='There are no current RFPs.'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-07-17 17:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('rfp', '0004_requestforproposalownerpage_no_rfps_description_and_more'),
]

operations = [
migrations.AddField(
model_name='individualrequestforproposalpage',
name='is_active',
field=models.BooleanField(default=True),
),
]
93 changes: 81 additions & 12 deletions app/rfp/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models
from django.utils import timezone

from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.fields import RichTextField, StreamField
Expand All @@ -7,12 +8,53 @@


class RequestForProposalOwnerPage(Page):
def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)

rfps = IndividualRequestForProposalPage.objects.live().filter(locale=context['page'].locale)
rfps = rfps.filter(application_close_date__gte=timezone.now().date(), is_active=True)

context['rfps'] = rfps
return context

subpage_types = [
'rfp.IndividualRequestForProposalPage'
]

max_count = 1

header_image = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Header image"
)
header_description = RichTextField(blank=True)

current_rfps_title = models.CharField(default="Current RFPs")
rfp_location_text = models.CharField(default="Location")
rfp_deadline_text = models.CharField(default="Deadline")
no_rfps_title = models.CharField(default="There are no current RFPs.")
no_rfps_description = RichTextField(blank=True)

aside_block_title = models.CharField(default="Still have questions?")
aside_block_description = RichTextField(blank=True)

job_opportunities_image = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Job opportunities image"
)
job_opportunities_title = models.CharField(default="See Our Job Opportunities")
job_opportunities_description = RichTextField(blank=True)
job_opportunities_button_text = models.CharField(default="See All Job Opportunities")
job_opportunities_button_link = models.URLField(blank=True)

posted_by_prefix_text = models.CharField(default="Posted by")

terms_of_reference_title = models.CharField(default="Terms of Reference")
Expand All @@ -28,19 +70,43 @@ class RequestForProposalOwnerPage(Page):
go_back_text = models.CharField(default="Go Back to Request for Proposals")

content_panels = Page.content_panels + [
FieldPanel('posted_by_prefix_text'),
MultiFieldPanel([
FieldPanel('terms_of_reference_title'),
FieldPanel('role_title'),
FieldPanel('application_close_title'),
FieldPanel('project_duration_title'),
FieldPanel('work_location_title'),
FieldPanel('contract_type_title'),
FieldPanel('direct_contact_title'),
FieldPanel('cta_title'),
FieldPanel('submission_email_button'),
], heading="Sidebar"),
FieldPanel('go_back_text'),
FieldPanel('header_image'),
FieldPanel('header_description'),
], heading="Header"),
MultiFieldPanel([
FieldPanel('current_rfps_title'),
FieldPanel('rfp_location_text'),
FieldPanel('rfp_deadline_text'),
FieldPanel('no_rfps_title'),
FieldPanel('no_rfps_description'),
], heading="Body"),
MultiFieldPanel([
FieldPanel('aside_block_title'),
FieldPanel('aside_block_description'),
], heading="Aside"),
MultiFieldPanel([
FieldPanel('job_opportunities_image'),
FieldPanel('job_opportunities_title'),
FieldPanel('job_opportunities_description'),
FieldPanel('job_opportunities_button_text'),
FieldPanel('job_opportunities_button_link'),
], heading="Footer banner"),
MultiFieldPanel([
FieldPanel('posted_by_prefix_text'),
MultiFieldPanel([
FieldPanel('terms_of_reference_title'),
FieldPanel('role_title'),
FieldPanel('application_close_title'),
FieldPanel('project_duration_title'),
FieldPanel('work_location_title'),
FieldPanel('contract_type_title'),
FieldPanel('direct_contact_title'),
FieldPanel('cta_title'),
FieldPanel('submission_email_button'),
], heading="Sidebar"),
FieldPanel('go_back_text'),
], heading="Individual RFP Page"),
]


Expand All @@ -49,6 +115,8 @@ class IndividualRequestForProposalPage(Page):
'rfp.RequestForProposalOwnerPage'
]

is_active = models.BooleanField(default=True)

posters = StreamField([('poster', PageChooserBlock(page_type="members.IndividualMemberPage"))], use_json_field=True, null=True, blank=True)
post_date = models.DateField(blank=True, null=True)

Expand All @@ -68,6 +136,7 @@ class IndividualRequestForProposalPage(Page):
submission_email = models.EmailField(blank=True)

content_panels = Page.content_panels + [
FieldPanel('is_active'),
FieldPanel('posters'),
FieldPanel('post_date'),
FieldPanel('intro'),
Expand Down
8 changes: 8 additions & 0 deletions app/rfp/templates/rfp/components/AsideBlockContents.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="bg-hot-off-white p-6">
<h1 class="text-h3 font-bold">
{{page.aside_block_title}}
</h1>
<div class="base-article-m my-4 [&_a]:font-bold">
{{page.aside_block_description|safe}}
</div>
</div>
68 changes: 68 additions & 0 deletions app/rfp/templates/rfp/request_for_proposal_owner_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{% extends "base.html" %}
{% load static %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% load compress %}
{% block body_class %}template-volunteeropportunityownerpage{% endblock %}
{% block extra_css %}
{% compress css %}
{% endcompress css %}
{% endblock extra_css %}

{% block content %}
{% include "ui/components/PageHeaderWithBlur.html" with title=page.title subtitle=page.header_description image=page.header_image %}

<div class="max-w-7xl mx-auto my-10">
<div class="px-6 md:px-10">
<div class="lg:grid lg:grid-cols-3 gap-8">
<div class="lg:col-span-2">
{% include "ui/components/TitleWithUnderline.html" with title=page.current_rfps_title %}
<div class="grid gap-8 mt-8">
{% for rfp in rfps %}
<div class="bg-hot-off-white w-full p-6">
<div class="flex-grow">
<a href="{{rfp.url}}">
<h1 class="text-h3 font-bold">
{{rfp.title}}
</h1>
</a>
<p class="mt-4">
<b>{{page.rfp_location_text}}: </b>
{{rfp.work_location}}
</p>
<p class="mt-2">
<b>{{page.rfp_deadline_text}}: </b>
{{rfp.application_close_date}}
</p>
</div>
</div>
{% endfor %}
{% if not rfps %}
<div class="bg-hot-off-white p-6">
<h1 class="text-h3 font-bold">
{{page.no_rfps_title}}
</h1>
<div class="base-article-m [&_a]:font-bold mt-4">
{{page.no_rfps_description|safe}}
</div>
</div>
{% endif %}
</div>
</div>
<div class="hidden lg:block">
{% include "./components/AsideBlockContents.html" %}
</div>
</div>
</div>
</div>

<div class="mt-20">
{% include "ui/components/sections/NavyBackgroundWithImage.html" with image=page.job_opportunities_image title=page.job_opportunities_title description=page.job_opportunities_description button_text=page.job_opportunities_button_text button_link=page.job_opportunities_button_link %}
</div>

<div class="max-w-7xl mx-auto bg-hot-off-white lg:hidden">
<div class="px-6 md:px-10">
{% include "./components/AsideBlockContents.html" %}
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
{% endcomment %}
{% load wagtailimages_tags %}

<div class="bg-hot-navy-grey text-white">
<div class="bg-hot-navy-grey text-white [&_p]:text-white">
{% include "./BaseSectionWithImage.html" %}
</div>
Loading

0 comments on commit dfbb611

Please sign in to comment.