Skip to content
Merged
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
8 changes: 8 additions & 0 deletions hypha/apply/determinations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ def get_form_class(self):
form_fields[field_block.id].initial = TRANSITION_DETERMINATION[
action
]
# Make capitalization consistent
form_fields[field_block.id].label = form_fields[
field_block.id
].label.title()
form_fields = self.add_proposal_form_field(form_fields, action)
return type("WagtailStreamForm", (self.submission_form_class,), form_fields)

Expand Down Expand Up @@ -389,7 +393,11 @@ def add_proposal_form_field(self, fields, action):
help_text=proposal_form_help_text,
required=True if action == "invited_to_proposal" else False,
)
# Move proposal form the be the second field as it's disabled until the first (determination) is input
fields.move_to_end("proposal_form", last=False)
fields.move_to_end(
list(fields.keys())[1], last=False
) # `last=False` moves the item to the start
return fields

def get_success_url(self):
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/funds/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_defined_fields(self, stage=None, form_index=0):
stage_num = 1
else:
stage_num = self.workflow.stages.index(stage) + 1
return self.forms.filter(stage=stage_num)[form_index].fields
return list(self.forms.filter(stage=stage_num))[form_index].fields

def render_landing_page(self, request, form_submission=None, *args, **kwargs):
# We only reach this page after creation of a new submission
Expand Down
24 changes: 12 additions & 12 deletions hypha/static_src/javascript/determination-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@

getMatchingCopy(value) {
const proposal_form = document.querySelector("#id_proposal_form");
if (value === "0") {
this.text = document.querySelector(
'div[data-type="rejected"]'
).textContent;
if (["", "0", "1"].includes(value)) {
if (proposal_form) {
proposal_form.disabled = true;
proposal_form.required = false;
}
} else if (value === "1") {
this.text = document.querySelector(
'div[data-type="more_info"]'
).textContent;
if (proposal_form) {
proposal_form.disabled = true;
proposal_form.required = false;
if (value === "") {
this.text = "";
} else if (value === "0") {
this.text = document.querySelector(
'div[data-type="rejected"]'
).textContent;
} else if (value === "1") {
this.text = document.querySelector(
'div[data-type="more_info"]'
).textContent;
}
} else {
} else if (value === "2") {
this.text = document.querySelector(
'div[data-type="accepted"]'
).textContent;
Expand Down
Loading