Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/views/providers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<span class="text-red-500">*</span>
<% end %>
<%= form.text_field :name,
placeholder: "Enter provider name (e.g., Johns Hopkins, Mayo Clinic)",
placeholder: "e.g., Johns Hopkins, Mayo Clinic",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the placeholder here to be consistent with the rest of them. I think it is sufficient to have the placeholder give examples, as our help text says what the input should be

autofocus: true,
class: "input-field bg-gray-50" %>
<p class="help-text">The official name of the healthcare provider or organization.</p>
Expand All @@ -29,6 +29,19 @@
<p class="help-text">The type or category of healthcare provider.</p>
</div>

<!-- File name prefix -->
<% unless @provider&.topics.any? %>
<div>
<%= form.label :file_name_prefix, class: "input-label" do %>
File name prefix
<% end %>
<%= form.text_field :file_name_prefix,
placeholder: "e.g., 123_who_guidelines",
class: "input-field bg-gray-50" %>
<p class="help-text">The prefix to use for this provider's uploads.</p>
</div>
<% end %>

<!-- Regions -->
<div>
<%= form.label :region, class: "input-label" do %>
Expand Down
22 changes: 22 additions & 0 deletions spec/views/providers/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,26 @@
assert_select "input[type='submit'][value='Update Provider']"
end
end

context "when the provider has associated topics" do
before { create(:topic, provider: provider) }

it "does not have the File name prefix field" do
render

assert_select "form[action=?][method=?]", provider_path(provider), "post" do
assert_select "input[name=?]", "provider[file_name_prefix]", false
end
end
end

context "when the provider that has no associated topics" do
it "has the File name prefix field" do
render

assert_select "form[action=?][method=?]", provider_path(provider), "post" do
assert_select "input[name=?]", "provider[file_name_prefix]"
end
end
end
end
1 change: 1 addition & 0 deletions spec/views/providers/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
assert_select "form[action=?][method=?]", providers_path, "post" do
assert_select "input[name=?]", "provider[name]"
assert_select "input[name=?]", "provider[provider_type]"
assert_select "input[name=?]", "provider[file_name_prefix]"
assert_select "input[type='submit'][value='Create Provider']"
end
end
Expand Down