Skip to content

Commit

Permalink
Show hide placeholder text
Browse files Browse the repository at this point in the history
deploy main branch
  • Loading branch information
ryanwoldatwork authored Mar 23, 2021
2 parents 28da644 + 0c327ed commit 3df2a55
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .circleci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else
echo "Not on the production branch."
fi

if [ "${CIRCLE_BRANCH}" == "master" ]
if [ "${CIRCLE_BRANCH}" == "main" ]
then
echo "Logging into cloud.gov"
# Log into CF and push
Expand All @@ -27,7 +27,7 @@ then
cf v3-zdt-push touchpoints-demo-sidekiq-worker
echo "Push to Demo Complete."
else
echo "Not on the master branch."
echo "Not on the main branch."
fi

if [ "${CIRCLE_BRANCH}" == "develop" ]
Expand Down
46 changes: 24 additions & 22 deletions app/views/admin/questions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<%= f.text_field :text, class: "usa-input" %>
</div>

<div class="field">
<%= f.label :placeholder_text, "Placeholder text", class: "usa-label" %>
<%= f.text_field :placeholder_text, class: "usa-input" %>
</div>

<div class="field">
<%= f.label :question_type, class: "usa-label" %>
<% if admin_permissions? %>
Expand All @@ -40,6 +35,26 @@

<div class="grid-row">
<div class="grid-col-12">
<% if ["text_field", "textarea", "text_email_field"].include?(question.question_type) %>
<div class="field placeholder-text">
<%= f.label :placeholder_text, "Placeholder text", class: "usa-label" %>
<%= f.text_field :placeholder_text, class: "usa-input" %>
</div>
<div class="field character-limit">
<%= f.label :character_limit, class: "usa-label" %>
<%= f.number_field :character_limit, class: "usa-input", max: "100000" %>
</div>
<% end %>

<br>
<fieldset class="usa-fieldset">
<legend class="usa-sr-only">Is this question required?</legend>
<div class="usa-checkbox">
<%= f.check_box :is_required, class: "usa-checkbox__input" %>
<%= f.label :is_required, "Is required?", class: "usa-checkbox__label" %>
</div>
</fieldset>

<div class="field">
<%= f.label :answer_field, "Which A-11 question does this pertain to?", class: "usa-label" %>
<%= f.select :answer_field, answer_fields - (form.questions.collect(&:answer_field) - [question.answer_field]), { selected: question.answer_field }, { class: "usa-select" } %>
Expand All @@ -57,23 +72,7 @@
</div>
</div>

<% if question.question_type == "text_field" || question.question_type == "textarea" %>
<div class="field character-limit">
<%= f.label :character_limit, class: "usa-label" %>
<%= f.number_field :character_limit, class: "usa-input", max: "100000" %>
</div>
<% end %>

<%= f.hidden_field :form_section_id %>

<br>
<fieldset class="usa-fieldset">
<legend class="usa-sr-only">Is this question required?</legend>
<div class="usa-checkbox">
<%= f.check_box :is_required, class: "usa-checkbox__input" %>
<%= f.label :is_required, class: "usa-checkbox__label" %>
</div>
</fieldset>
<p>
<%= f.submit class: "usa-button save-question" %>
</p>
Expand Down Expand Up @@ -101,10 +100,13 @@
});
}
});

$("input[name='question[question_type]']").on("click", function(event) {
if ($(this)[0].id == 'question_question_type_text_field' || $(this)[0].id == 'question_question_type_textarea') {
if ($(this)[0].id == 'question_question_type_text_field' || $(this)[0].id == 'question_question_type_text_email_field' || $(this)[0].id == 'question_question_type_textarea') {
$(".placeholder-text").show();
$(".character-limit").show();
} else {
$(".placeholder-text").hide();
$(".character-limit").hide();
}
});
Expand Down

0 comments on commit 3df2a55

Please sign in to comment.