Skip to content

Commit

Permalink
Adds flag for pickup leagues and hides them from the main listing.
Browse files Browse the repository at this point in the history
  • Loading branch information
toomuchpete committed Sep 13, 2024
1 parent ac6e049 commit bbdb0a0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/leagues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ def initialize_roster_csv

def league_params
permitted_params = [
:name, :age_division, :season, :sport, :price, :price_women,
:name, :age_division, :season, :sport, :price, :price_women, :pickup_registration,
:start_date, :end_date, :registration_open, :registration_close,
:female_registration_open, :female_registration_close, :male_registration_open, :male_registration_close,
:description, {commissioner_ids: []}, :male_limit, :female_limit,
Expand Down
2 changes: 2 additions & 0 deletions app/models/league.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class League
field :donation_earmark, type: String, default: nil
field :donation_pitch, type: String, default: nil

field :pickup_registration, type: Boolean, default: false

after_initialize :build_options_if_nil
after_find :migrate_self_rank_opts

Expand Down
6 changes: 6 additions & 0 deletions app/views/leagues/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

= render partial: '/user_multiselect', locals: {form: f, fieldname: 'commissioner_ids', label: "Commissioners", users: @league.commissioners}

.control-group
.controls
%label.checkbox
= f.check_box :pickup_registration
Pickup Player Signup

.control-group{ class: ('error' if errors[:age_division].any?)}
%label.control-label{for: 'league_age_division'} Age Division
.controls
Expand Down
5 changes: 4 additions & 1 deletion app/views/leagues/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
%th End of Season Champions

%tbody
- League.ended.each do |l|
- leagues = League.ended
- unless params['show_pickups']
- leagues = leagues.where(:pickup_registration.ne => true)
- leagues.each do |l|
%tr
%td=link_to l.name, league_path(l)
- if l.teams.count != 0
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }

config.cache_store = :mem_cache_store, ENV['MEMCACHE_HOST'], { :namespace => 'platinum_r4', :expires_in => 1.day, :compress => true }
config.cache_store = :mem_cache_store, 'memcached', { :namespace => 'platinum_r4', :expires_in => 1.day, :compress => true }
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
end
10 changes: 10 additions & 0 deletions config/mongoid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ production:
options:
raise_not_found_error: false

development:
sessions:
default:
database: Platypus
hosts:
- <%=ENV['MONGO_HOST']%>:27017
options:
options:
raise_not_found_error: false

test:
sessions:
default:
Expand Down

0 comments on commit bbdb0a0

Please sign in to comment.