-
Notifications
You must be signed in to change notification settings - Fork 54
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
3768 - Fix error saving field-based page #4123
Conversation
a829d89
to
f280c3a
Compare
app/models/transcription_field.rb
Outdated
validates :percentage, numericality: { allow_nil: true, greater_than: 0, less_than_or_equal_to: 100 } | ||
validates :page_number, numericality: { allow_nil: true, greater_than: 0, less_than_or_equal_to: 1000 } | ||
|
||
validates :label, format: { without: /[\[\]\{\}]/, message: "cannot contain '{', '}', '[' or ']'" } |
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.
Validation for checking characters that might be interpreted as hash like '{}' or '[]'
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.
Let's remove the {}
validation -- only the hash element accessor []
is used by Rails to create structured parameters, {}
isn't a problem. (I just tested that on development
and {}
works.
div.character-count | ||
-else | ||
=text_area_tag "fields[#{field.id}][#{field.label}]", content, class: 'field-input' | ||
=generate_field_input(field, cell) |
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.
I moved some of the logic here to the helper function.
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.
Great!
def generate_field_input(field, cell) | ||
input_name = formatted_field_name(field) | ||
|
||
label = label_tag(field.label.parameterize, field.label.titleize) |
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.
I titleize the label for the field inputs. Let me know if it should not be like this after all
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.
Let's not titleize the label -- many of our customers have strong opinions about this.
Moving back to in progress. seems there are a lot of specs failing due to changed name. |
bb64adf
to
9e6ded4
Compare
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.
Remove titleize and permit curly-braces.
No description provided.