autofocus

This commit is contained in:
f 2019-09-12 15:11:39 -03:00
parent 55a3978a40
commit 6434d1c896
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
3 changed files with 5 additions and 2 deletions

View file

@ -65,6 +65,7 @@ module ApplicationHelper
{
class: "form-control #{invalid(metadata.post, attribute)}",
required: metadata.required,
autofocus: (metadata.post.attributes.first == attribute),
aria: {
describedby: id_for_help(attribute),
required: metadata.required

View file

@ -29,7 +29,8 @@
= render("posts/attributes/#{type}",
post: post, attribute: attribute,
metadata: metadata, site: site)
metadata: metadata, site: site,
autofocus: (post.attributes.first == attribute))
-# Botones de guardado
= render 'posts/submit', site: site, post: post

View file

@ -1,7 +1,8 @@
.form-check
= check_box_tag "post[#{attribute}", metadata.value, metadata.value,
class: "form-check-input #{invalid(post, attribute)}",
aria: { describedby: id_for_help(attribute) }
aria: { describedby: id_for_help(attribute) },
autofocus: autofocus
= label_tag "post_#{attribute}", post_label_t(attribute, post: post),
class: 'form-check-label'