diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb
index fa220864c..f483efcfb 100644
--- a/app/controllers/stories_controller.rb
+++ b/app/controllers/stories_controller.rb
@@ -129,6 +129,8 @@ def set_form_variables
@story_ideas = authorized_scope(StoryIdea.includes(:created_by))
.references(:users)
.order(:created_at)
+ @people = Person.order(Arel.sql("LOWER(first_name), LOWER(last_name)"))
+ @users = User.has_access.includes(:person).left_joins(:person).order(Arel.sql("people.first_name IS NULL, LOWER(people.first_name), LOWER(people.last_name), LOWER(users.email)"))
@windows_types = WindowsType.all
@workshops = authorized_scope(Workshop.all).includes(:windows_type).order(:title)
@categories_grouped =
diff --git a/app/views/stories/_form.html.erb b/app/views/stories/_form.html.erb
index d6c44f742..22de452bd 100644
--- a/app/views/stories/_form.html.erb
+++ b/app/views/stories/_form.html.erb
@@ -263,39 +263,33 @@
<%= f.input :created_by_id,
- collection: f.object.created_by.present? ? [[ f.object.created_by.full_name_with_email, f.object.created_by.id ]] : [],
- include_blank: true,
- input_html: {
- class: "w-full px-3 py-2 border border-gray-300 rounded-lg",
- data: {
- controller: "remote-select",
- remote_select_model_value: "user"
- }
- },
- prompt: "Search by name or email",
+ collection: @users.map { |u| [ u.full_name_with_email, u.id ] },
+ prompt: "Select an author",
label: (f.object.created_by&.person ? (
link_to "Story author",
person_path(f.object.created_by.person),
class: "hover:underline") : "Story author").html_safe,
- label_html: { class: "block font-medium mb-1 text-gray-700" } %>
+ label_html: { class: "block font-medium mb-1 text-gray-700" },
+ input_html: {
+ class: select_caret_class(blank: f.object.created_by_id.blank?),
+ style: custom_caret_style,
+ onchange: select_caret_onchange
+ } %>
<%= f.input :spotlighted_facilitator_id,
- collection: f.object.spotlighted_facilitator.present? ? [[ f.object.spotlighted_facilitator.full_name_with_email, f.object.spotlighted_facilitator.id ]] : [],
- include_blank: true,
- input_html: {
- class: "w-full px-3 py-2 border border-gray-300 rounded-lg",
- data: {
- controller: "remote-select",
- remote_select_model_value: "person"
- }
- },
- prompt: "Search by name",
+ collection: @people.map { |p| [ p.full_name_with_email, p.id ] },
+ prompt: "Select a facilitator",
label: (f.object.spotlighted_facilitator_id ? (link_to "Story spotlighted facilitator",
person_path(f.object.spotlighted_facilitator_id),
class: "hover:underline") : "Story spotlighted facilitator").html_safe,
- label_html: { class: "block font-medium mb-1 text-gray-700" } %>
+ label_html: { class: "block font-medium mb-1 text-gray-700" },
+ input_html: {
+ class: select_caret_class(blank: f.object.spotlighted_facilitator_id.blank?),
+ style: custom_caret_style,
+ onchange: select_caret_onchange
+ } %>
diff --git a/spec/views/stories/edit.html.erb_spec.rb b/spec/views/stories/edit.html.erb_spec.rb
index 9a8efadae..270f6b077 100644
--- a/spec/views/stories/edit.html.erb_spec.rb
+++ b/spec/views/stories/edit.html.erb_spec.rb
@@ -10,6 +10,7 @@
assign(:workshops, [])
assign(:organizations, [])
assign(:users, [])
+ assign(:people, [])
assign(:sectors, [])
assign(:categories_grouped, [])
allow(view).to receive(:current_user).and_return(user)
diff --git a/spec/views/stories/new.html.erb_spec.rb b/spec/views/stories/new.html.erb_spec.rb
index 15a20414c..7f9c33e04 100644
--- a/spec/views/stories/new.html.erb_spec.rb
+++ b/spec/views/stories/new.html.erb_spec.rb
@@ -5,6 +5,8 @@
before(:each) do
assign(:windows_types, [])
+ assign(:users, [])
+ assign(:people, [])
assign(:sectors, [])
assign(:categories_grouped, [])
assign(:story_ideas, [])