Skip to content

Commit

Permalink
Split out requirements field and rename funds
Browse files Browse the repository at this point in the history
This becomes three fields:
- `equipment_required`
- `funding_required` ("Costs")
- `additional_info`

Rename `funds` to `installation_funding`.

Add "Costs" to the edit page.
  • Loading branch information
marksteward committed Jan 20, 2024
1 parent 897bbd2 commit baa59fe
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 41 deletions.
36 changes: 25 additions & 11 deletions apps/cfp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class ProposalForm(Form):
email = EmailField("Email")
title = StringField("Title", [DataRequired()])
description = TextAreaField("Description", [DataRequired()])
requirements = TextAreaField("Additional Info")
equipment_required = TextAreaField("Equipment required")
funding_required = TextAreaField("Costs")
additional_info = TextAreaField("Additional info")
needs_help = BooleanField("Needs help")
user_scheduled = BooleanField("User scheduled")
notice_required = SelectField(
Expand Down Expand Up @@ -116,7 +118,7 @@ class InstallationProposalForm(ProposalForm):
("huge", "Bigger than a lorry"),
],
)
funds = SelectField(
installation_funding = SelectField(
"Funding",
choices=[
("0", "No money needed"),
Expand Down Expand Up @@ -282,7 +284,7 @@ def form(cfp_type="talk"):
elif cfp_type == "installation":
proposal = InstallationProposal()
proposal.size = form.size.data
proposal.funds = form.funds.data
proposal.installation_funding = form.installation_funding.data

elif cfp_type == "lightning":
if remaining_lightning_slots[form.session.data] <= 0:
Expand All @@ -306,7 +308,9 @@ def form(cfp_type="talk"):
proposal.user_id = current_user.id

proposal.title = form.title.data
proposal.requirements = form.requirements.data
proposal.equipment_required = form.equipment_required.data
proposal.additional_info = form.additional_info.data
proposal.funding_required = form.funding_required.data
proposal.description = form.description.data
proposal.notice_required = form.notice_required.data
proposal.needs_help = form.needs_help.data
Expand Down Expand Up @@ -437,15 +441,17 @@ def edit_proposal(proposal_id):

elif proposal.type == "installation":
proposal.size = form.size.data
proposal.funds = form.funds.data
proposal.installation_funding = form.installation_funding.data

elif proposal.type == "lightning":
proposal.slide_link = form.slide_link.data
proposal.allowed_times = form.session.data

proposal.title = form.title.data
proposal.description = form.description.data
proposal.requirements = form.requirements.data
proposal.equipment_required = form.equipment_required.data
proposal.additional_info = form.additional_info.data
proposal.funding_required = form.funding_required.data
proposal.notice_required = form.notice_required.data
proposal.needs_help = form.needs_help.data

Expand Down Expand Up @@ -475,7 +481,7 @@ def edit_proposal(proposal_id):

elif proposal.type == "installation":
form.size.data = proposal.size
form.funds.data = proposal.funds
form.installation_funding.data = proposal.installation_funding

elif proposal.type == "lightning":
form.slide_link.data = proposal.slide_link
Expand All @@ -489,7 +495,9 @@ def edit_proposal(proposal_id):

form.title.data = proposal.title
form.description.data = proposal.description
form.requirements.data = proposal.requirements
form.equipment_required.data = proposal.equipment_required
form.additional_info.data = proposal.additional_info
form.funding_required.data = proposal.funding_required
form.notice_required.data = proposal.notice_required
form.needs_help.data = proposal.needs_help

Expand Down Expand Up @@ -557,7 +565,9 @@ class FinaliseForm(Form):

may_record = BooleanField("I am happy for this to be recorded", default=True)
needs_laptop = BooleanField("I will need to borrow a laptop for slides")
requirements = TextAreaField("Requirements")
equipment_required = TextAreaField("Equipment Required")
additional_info = TextAreaField("Additional Information")
funding_required = TextAreaField("Funding Required")
arrival_period = SelectField(
"Estimated arrival time",
default="fri am",
Expand Down Expand Up @@ -673,7 +683,9 @@ class F(FinaliseForm):

proposal.may_record = form.may_record.data
proposal.needs_laptop = form.needs_laptop.data
proposal.requirements = form.requirements.data
proposal.equipment_required = form.equipment_required.data
proposal.additional_info = form.additional_info.data
proposal.funding_required = form.funding_required.data

proposal.arrival_period = form.arrival_period.data
proposal.departure_period = form.departure_period.data
Expand Down Expand Up @@ -713,7 +725,9 @@ class F(FinaliseForm):

form.may_record.data = proposal.may_record
form.needs_laptop.data = proposal.needs_laptop
form.requirements.data = proposal.requirements
form.equipment_required.data = proposal.equipment_required
form.additional_info.data = proposal.additional_info
form.funding_required.data = proposal.funding_required

if proposal.type == "workshop" or proposal.type == "youthworkshop":
form.age_range.data = proposal.published_age_range
Expand Down
48 changes: 48 additions & 0 deletions migrations/versions/5e48dc411113_cfp_requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""CfP requirements
Revision ID: 5e48dc411113
Revises: 2f028aff5d58
Create Date: 2024-01-20 17:18:18.893097
"""

# revision identifiers, used by Alembic.
revision = '5e48dc411113'
down_revision = '2f028aff5d58'

from alembic import op
import sqlalchemy as sa


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('proposal', sa.Column('equipment_required', sa.String(), nullable=True))
op.add_column('proposal', sa.Column('funding_required', sa.String(), nullable=True))
op.add_column('proposal', sa.Column('additional_info', sa.String(), nullable=True))
op.add_column('proposal', sa.Column('installation_funding', sa.String(), nullable=True))
op.drop_column('proposal', 'requirements')
op.drop_column('proposal', 'funds')
op.add_column('proposal_version', sa.Column('equipment_required', sa.String(), autoincrement=False, nullable=True))
op.add_column('proposal_version', sa.Column('funding_required', sa.String(), autoincrement=False, nullable=True))
op.add_column('proposal_version', sa.Column('additional_info', sa.String(), autoincrement=False, nullable=True))
op.add_column('proposal_version', sa.Column('installation_funding', sa.String(), autoincrement=False, nullable=True))
op.drop_column('proposal_version', 'requirements')
op.drop_column('proposal_version', 'funds')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('proposal_version', sa.Column('funds', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('proposal_version', sa.Column('requirements', sa.VARCHAR(), autoincrement=False, nullable=True))
op.drop_column('proposal_version', 'installation_funding')
op.drop_column('proposal_version', 'additional_info')
op.drop_column('proposal_version', 'funding_required')
op.drop_column('proposal_version', 'equipment_required')
op.add_column('proposal', sa.Column('funds', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('proposal', sa.Column('requirements', sa.VARCHAR(), autoincrement=False, nullable=True))
op.drop_column('proposal', 'installation_funding')
op.drop_column('proposal', 'additional_info')
op.drop_column('proposal', 'funding_required')
op.drop_column('proposal', 'equipment_required')
# ### end Alembic commands ###
15 changes: 10 additions & 5 deletions models/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ class Proposal(BaseModel):
# Core information
title = db.Column(db.String, nullable=False)
description = db.Column(db.String, nullable=False)
requirements = db.Column(db.String)

equipment_required = db.Column(db.String)
funding_required = db.Column(db.String)
additional_info = db.Column(db.String)
length = db.Column(db.String) # only used for talks and workshops
notice_required = db.Column(db.String)
private_notes = db.Column(db.String)
Expand Down Expand Up @@ -459,8 +462,10 @@ def get_export_data(cls):
edits_attrs = [
"published_title",
"published_description",
"requirements",
"length",
"equipment_required",
"funding_required",
"additional_info",
"notice_required",
"needs_help",
"needs_money",
Expand All @@ -478,7 +483,7 @@ def get_export_data(cls):
"attendees",
"cost",
"size",
"funds",
"installation_funding",
"age_range",
"participant_equipment",
]
Expand All @@ -503,7 +508,7 @@ def get_export_data(cls):
if cls.__name__ == "WorkshopProposal":
proposals = proposals.add_columns(cls.attendees, cls.cost)
elif cls.__name__ == "InstallationProposal":
proposals = proposals.add_columns(cls.size, cls.funds)
proposals = proposals.add_columns(cls.size, cls.installation_funding)
elif cls.__name__ == "YouthWorkshopProposal":
proposals = proposals.add_columns(
cls.attendees, cls.cost, cls.age_range, cls.participant_equipment
Expand Down Expand Up @@ -865,7 +870,7 @@ class InstallationProposal(Proposal):
__mapper_args__ = {"polymorphic_identity": "installation"}
human_type = HUMAN_CFP_TYPES["installation"]
size = db.Column(db.String)
funds = db.Column(db.String, nullable=True)
installation_funding = db.Column(db.String, nullable=True)


class LightningTalkProposal(Proposal):
Expand Down
27 changes: 20 additions & 7 deletions templates/cfp/edit-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<p>We'll use these details to help us schedule your {{proposal.human_type}}.</p>

{% if proposal.type in ('talk', 'performance') %}
{{ render_field(form.requirements, 9) }}
{{ render_field(form.equipment_required, 9) }}
{{ render_field(form.length, 9) }}
{{ render_field(form.notice_required, 9) }}

{% elif proposal.type in ('workshop', 'youthworkshop') %}
{{ render_field(form.requirements, 9) }}
{{ render_field(form.equipment_required, 9) }}
{{ render_field(form.length, 9) }}
{{ render_field(form.notice_required, 9) }}
{% if proposal.type != 'youthworkshop' %}
Expand All @@ -33,12 +33,7 @@

{% elif proposal.type == 'installation' %}
{{ render_field(form.notice_required, 9) }}
{{ render_field(form.requirements, 9) }}
{{ render_field(form.size, 9) }}
{% call render_field(form.funds, 9) %}
We have a limited amount of funding available to make the EMF site look great.
If you'd like to apply for a grant, let us know how much you'll need.
{% endcall %}

{% elif proposal.type == 'lightning' %}
{{ render_field(form.slide_link, 9) }}
Expand All @@ -52,6 +47,10 @@
{{ render_field(form.session, 9) }}
{% endif %}

{% if proposal.type != 'lightning' %}
{{ render_field(form.additional_info, 9) }}
{% endif %}

<div class="col-md-9 col-sm-offset-3 {% if proposal.state != 'new' -%} hidden {%- endif %}">
{% if proposal.type == 'youthworkshop' %}
<label class="checkbox">
Expand All @@ -65,8 +64,22 @@
</label>
<p></p>
</div>

</fieldset>

{% if proposal.type != 'lightning' %}
<fieldset>
<legend>Funding</legend>
{% if proposal.type in ('installation') %}
{% call render_field(form.installation_funding, 9) %}
If you'd like to apply for a grant, let us know how much you'll need.
{% endcall %}
{% endif %}

{{ render_field(form.funding_required, horizontal=9, placeholder="What costs do you need covered?") }}
</fieldset>
{% endif %}

{% for error in form.needs_help.errors %}
<div class="help-block">{{ error }}</div>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion templates/cfp/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ <h2>Proposal Detail</h2>
<div class="col-md-6">
<legend>Further details</legend>
<dl class="dl-horizontal">
<dt>Requirements</dt><dd>{{proposal.requirements}}</dd>
{% if proposal.type in ('talk', 'performance') %}
<dt>Length</dt><dd>{{proposal.length}}</dd>
<dt>Notice Required</dt><dd>{{proposal.notice_required}}</dd>
Expand All @@ -85,6 +84,7 @@ <h2>Proposal Detail</h2>
<dt>Size</dt><dd>{{proposal.size}}</dd>
<dt>Funds requested</dt><dd>£{{proposal.funds}}</dd>
{% endif %}
<dt>Additional info</dt><dd>{{proposal.additional_info}}</dd>
</dl>
</div>
{% endif %}
Expand Down
17 changes: 16 additions & 1 deletion templates/cfp/guidance.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ <h3>The form{{octicon('chevron-down-24')}}</h3>
to organise your submission we'll do all we can to let you know before that
deadline.
</dd>
<a id="form-additional-info"></a>
<dt>Additional info</dt>
<dd>
If there's anything else you'd like to let us know in advance, it goes here.
We also have a messaging system that you can use to send us questions after
submitting your proposal.
</dd>
<a id="form-length"></a>
<dt>Duration (talks and workshops)</dt>
<dd>
Expand Down Expand Up @@ -298,6 +305,10 @@ <h3>The form{{octicon('chevron-down-24')}}</h3>
Many workshops have a material cost, and obviously it is unfair to ask you to
bear this. Letting us know what this fee is likely to be will help us
plan.

You can collect money from attendees at the event to cover these costs.
If the up-front cost of providing the materials would be an issue, we should
be able to support this - please indicate in the <b>Costs</b> field if so.
</dd>
<a id="form-size"></a>
<dt>Size (installations only)</dt>
Expand All @@ -307,11 +318,15 @@ <h3>The form{{octicon('chevron-down-24')}}</h3>
to be incredibly precise, but a reasonable estimate allows us
to find a good place to put it, as well as ensure it's viable.
</dd>
<a id="form-funding"></a>
<a id="form-installation-funding"></a>
<dt>Funding (installations only)</dt>
<dd>
EMF has some limited amount of funds that we can use to help installations.
</dd>
<a id="form-funding-required"></a>
<dt>Costs</dt>
If you require funds to cover up-front costs of workshop materials
or to help you travel to EMF then please let us know here.
</dl>
</div>

Expand Down
Loading

0 comments on commit baa59fe

Please sign in to comment.