Add smarter placeholders to content forms

This commit is contained in:
Andrew Brown 2016-10-11 11:45:00 +02:00
parent b8107d255b
commit 1f3e7964b7

View File

@ -1,5 +1,6 @@
<%
field_id = "#{f.object.class.name.downcase}_#{attribute}"
class_name = f.object.class.name.downcase
# TODO: Enable autocomplete when we can actually hide the dropdown if someone tabs out of a field.
# Not the easiest thing in the world to do, apparently.
@ -7,7 +8,15 @@
<div class="input-field content-field">
<%= f.label attribute, attribute.humanize.capitalize %>
<%= f.text_area attribute, class: "materialize-textarea #{defined?(autocomplete) && false ? 'autocomplete' : ''}", placeholder: 'Write as little or as much as you want!' %>
<%
placeholder = t("serendipitous_questions.attributes.#{class_name}.#{attribute}")
placeholder = I18n.translate "attributes.#{class_name}.#{attribute}",
scope: :serendipitous_questions,
name: f.object.send('name') || "this #{class_name}",
attribute: "test",
default: 'Write as little or as much as you want!'
%>
<%= f.text_area attribute, class: "materialize-textarea #{defined?(autocomplete) && false ? 'autocomplete' : ''}", placeholder: placeholder %>
</div>
<% if defined?(autocomplete) && false %>