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

Move heads of terms review into new layout #2047

Merged
merged 2 commits into from
Nov 26, 2024
Merged

Conversation

benjamineskola
Copy link
Contributor

@benjamineskola benjamineskola commented Nov 22, 2024

Description of change

Move heads of terms review into new review layout.

Story Link

https://trello.com/c/Ae4hmaT1/26-redesign-of-review-heads-of-terms

Screenshots

If you have made changes to the frontend please add screenshots

@benjamineskola benjamineskola force-pushed the review-heads-of-terms branch 4 times, most recently from bf26dae to 16910b7 Compare November 22, 2024 17:01
@benjamineskola benjamineskola marked this pull request as ready for review November 22, 2024 17:01
@benjamineskola benjamineskola force-pushed the review-heads-of-terms branch 2 times, most recently from 5a66429 to 3adefdf Compare November 25, 2024 17:55
def update
respond_to do |format|
format.html do
if heads_of_term.update(review_params)
redirect_to planning_application_review_tasks_path(@planning_application),
notice: I18n.t("review.heads_of_terms.update.success")
else
render :show
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we apply same pattern?

change the

def heads_of_term
  @planning_application.heads_of_term
end

to

def set_heads_of_term
  @heads_of_term = @planning_application.heads_of_term
end

happy to do it as additional PR if you want

so this would be

flash.now[:alert] = @heads_of_term.errors.messages.values.flatten.join(", ")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the pattern of using a method to set an instance variable and then using the instance variable. I think it's preferable to use a method call where possible.

It makes sense for variables that will be used in a view, because instance variables are needed for that, methods aren't accessible from the view. But for cases like this I don't think it makes sense.

@benjamineskola benjamineskola merged commit 1fe4b7b into main Nov 26, 2024
23 checks passed
@benjamineskola benjamineskola deleted the review-heads-of-terms branch November 26, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants