diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 7ff8761f..995a75be 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -239,7 +239,7 @@ def member_params
params.require(:member).permit(
:password, :password_confirmation, :email, :namefirst, :namelast, :namenick, :title, :callsign,
:shirt_size, :phone, :payrate, :role, :tracker_dev, :receives_comment_emails,
- :on_payroll, :pronouns, :favorite_entropy_drink, :major, :grad_year, :interests, :officer_position,
+ :on_payroll, :pronouns, :favorite_entropy_drink, :prefers_full_name, :major, :grad_year, :interests, :officer_position,
:super_tics_attributes => [:id, :_destroy, :day]
)
end
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index 0331cb2d..e3de07d8 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -149,8 +149,10 @@ def show_run_position(er, hover)
elsif er.appliable and not er.assigned? and can? :create, er.applications.build(member: current_member)
return link_to("you?", new_application_url(er.event, event_role_id: er.id, format: :js), :remote => true) unless hover
"you?" if hover
+ elsif !hover and current_member and current_member.prefers_full_name
+ return er.assigned_to :both_names
elsif !hover and current_member
- er.assigned_to use_display_name: true
+ return er.assigned_to :display_name
else
er.assigned_to
end
@@ -166,4 +168,13 @@ def weeks_from_now(weeks)
end
end
+ def run_position_name_preference(member)
+ if !member
+ return :full_name
+ elsif member.prefers_full_name
+ return :both_names
+ else
+ return :display_name
+ end
+ end
end
diff --git a/app/models/event_role.rb b/app/models/event_role.rb
index 9d8e039a..8efee2f4 100644
--- a/app/models/event_role.rb
+++ b/app/models/event_role.rb
@@ -112,12 +112,16 @@ def to_s
role + ": " + assigned_to
end
- def assigned_to(options = {})
+ def assigned_to(mode = :full_name)
+ # Logger
if assigned?
- if options[:use_display_name]
- member.display_name
- else
+ case mode
+ when :full_name
member.fullname
+ when :display_name
+ member.display_name
+ when :both_names
+ "#{member.display_name} (#{member.fullname})"
end
else
"(unassigned)"
diff --git a/app/views/events/_event_role_fields.html.erb b/app/views/events/_event_role_fields.html.erb
index 71fb6a50..84d50242 100644
--- a/app/views/events/_event_role_fields.html.erb
+++ b/app/views/events/_event_role_fields.html.erb
@@ -11,11 +11,11 @@
<%= link_to_remove_fields image_tag("cross.png"), f, f.object.new_record? %>
<% elsif f.object.member == current_member %>
<%= f.object.role %>
- <%= f.object.assigned_to use_display_name: true %>
+ <%= f.object.assigned_to(run_position_name_preference(current_member)) %>
<%= link_to_remove_fields image_tag("cross.png"), f %>
<% else %>
<%= f.object.role %>
- <%= f.object.assigned_to use_display_name: true %>
+ <%= f.object.assigned_to(run_position_name_preference(current_member)) %>
<% end %>
-
\ No newline at end of file
+
diff --git a/app/views/members/_form.html.erb b/app/views/members/_form.html.erb
index 08de230a..e7ae7745 100755
--- a/app/views/members/_form.html.erb
+++ b/app/views/members/_form.html.erb
@@ -98,11 +98,16 @@
<%= f.text_field :interests, class: "wide-input" %>
+
+ <%= f.label :prefers_full_name, "Show full names of members:" %>
+ <%= f.check_box :prefers_full_name %>
+
+
Notifications
-
+
<%= f.check_box :receives_comment_emails %>
<%= f.label :receives_comment_emails, "Email me when comments are posted on events I have run positions for" %>
diff --git a/app/views/members/show.html.erb b/app/views/members/show.html.erb
index a41f256c..90261a08 100755
--- a/app/views/members/show.html.erb
+++ b/app/views/members/show.html.erb
@@ -111,6 +111,12 @@
Interests
<%= @member.interests %>
+ <% if @member == current_member %>
+
+ Show real names of members
+ <%= @member.prefers_full_name ? "YES" : "NO" %>
+
+ <% end %>
<% if can? :read, Timecard %>
diff --git a/db/migrate/20241007223900_add_profile_option_view_full_name.rb b/db/migrate/20241007223900_add_profile_option_view_full_name.rb
new file mode 100644
index 00000000..51ccefe2
--- /dev/null
+++ b/db/migrate/20241007223900_add_profile_option_view_full_name.rb
@@ -0,0 +1,6 @@
+class AddProfileOptionViewFullName < ActiveRecord::Migration[6.1]
+ def change
+ # Change members table; Add column prefers_full_name
+ add_column :members, :prefers_full_name, :boolean, default: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4f300bfb..c5c31508 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2023_08_01_123836) do
+ActiveRecord::Schema.define(version: 2024_10_07_223900) do
create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t|
t.string "name", limit: 255, null: false
@@ -324,6 +324,7 @@
t.string "grad_year"
t.string "interests"
t.string "officer_position"
+ t.boolean "prefers_full_name", default: false
t.index ["email"], name: "members_kerbid_index"
end