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
2 changes: 1 addition & 1 deletion app/views/stories/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
<div class="flex-1 mb-4 md:mb-0">
<%= f.input :created_by_id,
collection: @users.map { |u| [ u.full_name_with_email, u.id ] },
prompt: "Select an author",
include_blank: "Select an author",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Switched from prompt: to include_blank: here. prompt: only renders the placeholder <option> when the field has no value, so on an already-set story the blank option was absent and the author couldn't be cleared. include_blank: always renders it — matching workshop_id/organization_id above.

label: (f.object.created_by&.person ? (
link_to "Story author",
person_path(f.object.created_by.person),
Expand Down
8 changes: 8 additions & 0 deletions spec/views/stories/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
end
end

it "renders a blank author option so an already-set author can be cleared" do
render

assert_select "select[name=?]", "story[created_by_id]" do
assert_select "option[value=?]", "", text: "Select an author"
end
end

it "does not render the Website button when website_url is nil" do
story.update(website_url: nil)
assign(:story, story.decorate)
Expand Down
Loading