-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added notes to constructor #987
base: calculators-constructor
Are you sure you want to change the base?
Conversation
app/models/calculator.rb
Outdated
validates :english_additional_notes, length: { maximum: 150 } | ||
validates :ukranian_additional_notes, length: { maximum: 150 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а шо коротке таке? може довше зробити?
<%= tinymce_assets %> | ||
<div data-controller="tinymce"> | ||
<div class="pt-4"> | ||
<%= f.label :ukranian_additional_notes, "Ukrainian Additional Notes" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l18n?
</div> | ||
|
||
<div class="pt-4 pb-4"> | ||
<%= f.label :english_additional_notes, "English Additional Notes" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
то саме
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
локалізація
import { Controller } from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static targets = ['input'] | ||
|
||
connect() { | ||
let config = Object.assign({ target: this.inputTarget }, TinyMCERails.configuration.default ) | ||
tinymce.init(config) | ||
|
||
} | ||
|
||
disconnect () { | ||
tinymce.remove() | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
порівняй тут гарно код і винеси конфіги в getter, також юзай 2 пробіли, а не 4 і думаю можна без object assign, просто обʼєкт заюзати
app/models/calculator.rb
Outdated
validates :english_additional_notes, length: { maximum: 500 } | ||
validates :ukranian_additional_notes, length: { maximum: 500 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну диви, ти молодець, що додала валідацію, але тут не враховані теги, тобто я напишу одну букву, а довжина її буде 7 символів, бо буде огорнута в як мінімум тег p
, отож потрібно дещо специфічну валіадацію зробити
</div> | ||
|
||
<div class="pt-4 pb-4"> | ||
<%= f.label :english_additional_notes, "English Additional Notes" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
локалізація
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## calculators-constructor #987 +/- ##
===========================================================
- Coverage 86.74% 86.60% -0.14%
===========================================================
Files 68 68
Lines 1056 1060 +4
===========================================================
+ Hits 916 918 +2
- Misses 140 142 +2 ☔ View full report in Codecov by Sentry. |
validates :ukranian_additional_notes, | ||
length: { | ||
maximum: 500, | ||
tokenizer: ->(string) { ActionController::Base.helpers.strip_tags(string).chars } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use method to do that and test it
@@ -0,0 +1,14 @@ | |||
<%= tinymce_assets %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= tinymce_assets %> | |
<%= tinymce_assets %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
align that all
<% if I18n.locale == :uk %> | ||
<%= raw calculator.ukranian_additional_notes %> | ||
<% else %> | ||
<%= raw calculator.english_additional_notes %> | ||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<% if I18n.locale == :uk %> | |
<%= raw calculator.ukranian_additional_notes %> | |
<% else %> | |
<%= raw calculator.english_additional_notes %> | |
<% end %> | |
<%== calculator.notes %> |
then you have:
uk_notes
en_notes
and Translatable concern in a model
@@ -361,6 +361,8 @@ uk: | |||
prohibited_to_update: " перешкоджають оновленню калькулятора" | |||
prohibited_to_save: " перешкоджають збереженню калькулятора" | |||
error: "помилки" | |||
ukranian_additional_notes: "Додаткові нотатки українською" | |||
english_additional_notes: "Додаткові нотатки англійською" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
у нас же нема основних нотаток)
Resolves:
Code reviewers
Second Level Review
Summary of issue
The current form for the calculator does not include fields for creating additional notes.
Summary of change
This update introduces two new Ukrainian and English note fields in the calculator form. The changes include creating a YAML file for TinyMCE styling, adding a Stimulus controller to handle TinyMCE initialization, creating a partial for the TinyMCE form, and writing tests for the new fields.
CHECK LIST