Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Sort the dropdown of users when creating a new meeting.
Browse files Browse the repository at this point in the history
  • Loading branch information
russ committed Jul 17, 2013
1 parent 67f9ab5 commit 3d5ee99
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/decorators/topic_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def link
end

def volunteer_data
model.volunteers.map { |v| { id: v.user_id, name: v.name } }.to_json
model.volunteers.by_name.map { |v| { id: v.user_id, name: v.name } }.to_json
end

def description
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def markdown
end

def all_user_list
User.all.map { |v| { id: v.id, name: v.name } }.to_json
User.by_name.all.map { |v| { id: v.id, name: v.name } }.to_json
end

def kudos_prompt
Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def self.by_points
order('points DESC')
end

def self.by_name
order(:name)
end

def self.find_for_meetup_oauth(auth, signed_in_resource = nil)
user = User.where(provider: auth.provider, uid: auth.uid.to_s).first_or_create.tap do |u|
u.name = auth.info.name
Expand Down
4 changes: 4 additions & 0 deletions app/models/volunteer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class Volunteer < ActiveRecord::Base

attr_accessible :user_id, :topic_id

def self.by_name
joins(:user).order('users.name')
end

def name
user.name
end
Expand Down

0 comments on commit 3d5ee99

Please sign in to comment.