From bbdb0a0de19f5b2dceebd6d064ec2ae1143c81b3 Mon Sep 17 00:00:00 2001 From: Pete Holiday Date: Fri, 13 Sep 2024 18:32:00 -0400 Subject: [PATCH] Adds flag for pickup leagues and hides them from the main listing. --- app/controllers/leagues_controller.rb | 2 +- app/models/league.rb | 2 ++ app/views/leagues/_form.html.haml | 6 ++++++ app/views/leagues/index.html.haml | 5 ++++- config/environments/development.rb | 2 +- config/mongoid.yml | 10 ++++++++++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/controllers/leagues_controller.rb b/app/controllers/leagues_controller.rb index d9af964..c4c0657 100644 --- a/app/controllers/leagues_controller.rb +++ b/app/controllers/leagues_controller.rb @@ -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, diff --git a/app/models/league.rb b/app/models/league.rb index 0e074b6..d11f937 100644 --- a/app/models/league.rb +++ b/app/models/league.rb @@ -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 diff --git a/app/views/leagues/_form.html.haml b/app/views/leagues/_form.html.haml index ca91e82..8225587 100644 --- a/app/views/leagues/_form.html.haml +++ b/app/views/leagues/_form.html.haml @@ -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 diff --git a/app/views/leagues/index.html.haml b/app/views/leagues/index.html.haml index e56e1c2..3f73f61 100644 --- a/app/views/leagues/index.html.haml +++ b/app/views/leagues/index.html.haml @@ -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 diff --git a/config/environments/development.rb b/config/environments/development.rb index 7ebabdb..bd486fb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -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 \ No newline at end of file diff --git a/config/mongoid.yml b/config/mongoid.yml index 41f52f0..8b44305 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -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: