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

fix 'Calculator' page reverting after changing locale #928

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

NVMakarenko
Copy link
Contributor

@NVMakarenko NVMakarenko commented Oct 30, 2024

dev

PROJECT

Board ticket

Code reviewers

Summary of issue

New calculator is not creating because of validation failed. Error message is shown. If change locale on this stage, admin will be redirected to Calculator's page.
Expected result
'New calculator' page is reload and displayed.
'Name' field is blank.
Error message is absent.

Summary of change

  1. fix turbo_stream response.
  2. move form into partial.
fix.reverting.mp4

CHECK LIST

  • СI passed
  • PR is reviewed manually again (to make sure you have 100% ready code)
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in user
  • PR meets all conventions

@@ -1,5 +1,6 @@
<div class="container">
<%= simple_form_for @calculator, url: account_calculators_path do |f| %>
<%= hidden_field_tag :rendered_from, "new" %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

не гуд, таких форм у тебе рахуй 10 і на кожну потрібна перевірка?) не гуд, шукай інший солюшен, більш лайтовий

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.16%. Comparing base (3bff2f0) to head (4c0ce56).
Report is 12 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #928   +/-   ##
========================================
  Coverage    91.16%   91.16%           
========================================
  Files           70       70           
  Lines          973      973           
========================================
  Hits           887      887           
  Misses          86       86           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link

@KseniaGovorun KseniaGovorun left a comment

Choose a reason for hiding this comment

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

Fix ci

@@ -0,0 +1 @@
<div data-controller="redirect" data-url="<%= account_calculators_path %>"></div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

turbo_stream.append :body_js do
  <script>
    window.location.replace("<%= account_calculators_path %>")
  </script>
end

@@ -0,0 +1 @@
<%= turbo_stream.replace(dom_id(@calculator, :form), partial: "account/calculators/partials/new/form", locals: {calculator: @calculator}) %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<%= turbo_stream.replace(dom_id(@calculator, :form), partial: "account/calculators/partials/new/form", locals: {calculator: @calculator}) %>
<%= turbo_stream.replace(dom_id(@calculator, :form), partial: "account/calculators/partials/new/form", locals: { calculator: @calculator }) %>

Copy link
Collaborator

Choose a reason for hiding this comment

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

а це можна видаляти

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.

[Add calculator] 'Calculator' page is reverted when changing locales after creating invalid calculator name
3 participants