Skip to content

Commit aa26c55

Browse files
committed
Update names_controller.rb
1 parent 91bbf94 commit aa26c55

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/controllers/names_controller.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ def index(opts = {})
6060
@draft ||= false
6161
@sort ||= params[:sort] || 'date'
6262
@status ||= params[:status] || 'public'
63-
@title ||= "#{@status.gsub(/^\S/, &:upcase)} Names"
63+
@title ||= [
64+
@status == 'all' ? nil : @status.gsub(/^\S/, &:upcase),
65+
'Names',
66+
@user.present? ? "by #{@user.username}" : nil
67+
].compact.join('')
6468
opts[:rank] = params[:rank] if params[:rank].present?
6569

6670
opts[:status] ||=
@@ -122,7 +126,6 @@ def user
122126
if params[:user] && current_user&.admin?
123127
@user = User.find_by(username: params[:user])
124128
end
125-
@title = "Names by #{@user&.username}"
126129
@status = 'all'
127130
index(where: { created_by: @user })
128131
render(:index)

0 commit comments

Comments
 (0)