forked from fixin.me/fixin.me
Lowercase attribute names
This commit is contained in:
parent
bd2557d261
commit
a13c0ee5fe
@ -158,10 +158,10 @@ form tr td:first-child {
|
|||||||
padding-right: 0.25rem;
|
padding-right: 0.25rem;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
form td.required {
|
form label.required {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
form td.error {
|
form label.error {
|
||||||
color: #ff1f5b;
|
color: #ff1f5b;
|
||||||
}
|
}
|
||||||
form em {
|
form em {
|
||||||
|
@ -4,20 +4,24 @@ module ApplicationHelper
|
|||||||
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
||||||
def #{selector}(method, options = {})
|
def #{selector}(method, options = {})
|
||||||
@template.content_tag :tr do
|
@template.content_tag :tr do
|
||||||
label_text = label(method, options.delete(:label))
|
@template.content_tag(:td, label_for(method, options)) +
|
||||||
if options[:hint]
|
|
||||||
label_text += @template.tag(:br) + @template.content_tag(:em, options.delete(:hint))
|
|
||||||
end
|
|
||||||
label_class = @template.class_names(required: options[:required],
|
|
||||||
error: @object&.errors[method].present?)
|
|
||||||
|
|
||||||
@template.content_tag(:td, label_text, class: label_class) +
|
|
||||||
@template.content_tag(:td, super)
|
@template.content_tag(:td, super)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY_EVAL
|
RUBY_EVAL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def label_for(method, options = {})
|
||||||
|
text = options.delete(:label)
|
||||||
|
text ||= @object.class.human_attribute_name(method).capitalize
|
||||||
|
|
||||||
|
classes = @template.class_names(required: options[:required],
|
||||||
|
error: @object&.errors[method].present?)
|
||||||
|
|
||||||
|
label(method, text, class: classes) +
|
||||||
|
(@template.tag(:br) + @template.content_tag(:em, options.delete(:hint)) if options[:hint])
|
||||||
|
end
|
||||||
|
|
||||||
def submit(value, options = {})
|
def submit(value, options = {})
|
||||||
@template.content_tag :tr do
|
@template.content_tag :tr do
|
||||||
@template.content_tag :td, super, colspan: 2
|
@template.content_tag :td, super, colspan: 2
|
||||||
|
@ -2,8 +2,8 @@ en:
|
|||||||
activerecord:
|
activerecord:
|
||||||
attributes:
|
attributes:
|
||||||
user:
|
user:
|
||||||
email: E-mail
|
email: e-mail
|
||||||
password: Password
|
password: password
|
||||||
users:
|
users:
|
||||||
registrations:
|
registrations:
|
||||||
new:
|
new:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user