├── .codeclimate.yml ├── .csslintrc ├── .eslintrc ├── .gitignore ├── .hound.yml ├── .rubocop.yml ├── .semaphore └── semaphore.yml ├── Capfile ├── Gemfile ├── Gemfile.lock ├── MIT-LICENSE ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── fonts │ │ ├── glyphicons-regular.eot │ │ ├── glyphicons-regular.svg │ │ ├── glyphicons-regular.ttf │ │ ├── glyphicons-regular.woff │ │ └── glyphicons-regular.woff2 │ ├── images │ │ ├── apple-touch-icon.png │ │ ├── favicon.ico │ │ └── photos │ │ │ ├── 404.jpg │ │ │ ├── 422.jpg │ │ │ ├── 500.jpg │ │ │ ├── 503.jpg │ │ │ └── maintenance.jpg │ ├── javascripts │ │ ├── admin.js │ │ ├── admin_results.js │ │ ├── application.js │ │ ├── categories.js │ │ ├── ckeditor │ │ │ └── config.js │ │ ├── events.js │ │ ├── first_aid_providers.js │ │ ├── people.js │ │ ├── raygun.js.erb │ │ ├── results.js │ │ ├── select_modal.js │ │ └── teams.js │ └── stylesheets │ │ ├── _disable_animations.scss │ │ ├── _forms.scss │ │ ├── _glyphicons_pro.scss │ │ ├── _pages.scss │ │ ├── _utilities.scss │ │ └── application.scss.erb ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── admin │ │ ├── admin_controller.rb │ │ ├── aliases_controller.rb │ │ ├── article_categories_controller.rb │ │ ├── articles_controller.rb │ │ ├── categories_controller.rb │ │ ├── events_controller.rb │ │ ├── first_aid_providers_controller.rb │ │ ├── home_controller.rb │ │ ├── pages_controller.rb │ │ ├── people │ │ │ ├── cards.rb │ │ │ ├── export.rb │ │ │ └── import.rb │ │ ├── people_controller.rb │ │ ├── posts_controller.rb │ │ ├── race_numbers_controller.rb │ │ ├── races_collections_controller.rb │ │ ├── races_controller.rb │ │ ├── results_controller.rb │ │ ├── stats_controller.rb │ │ ├── teams_controller.rb │ │ └── velodromes_controller.rb │ ├── application_controller.rb │ ├── article_categories_controller.rb │ ├── articles_controller.rb │ ├── authentication.rb │ ├── authorization.rb │ ├── caching.rb │ ├── calculates_controller.rb │ ├── calculations │ │ ├── categories_controller.rb │ │ ├── races_controller.rb │ │ ├── results_controller.rb │ │ └── sources_controller.rb │ ├── calculations_controller.rb │ ├── categories_controller.rb │ ├── competitions │ │ ├── bar_controller.rb │ │ ├── competitions_controller.rb │ │ ├── ironman_controller.rb │ │ ├── oregon_cup_controller.rb │ │ └── oregon_womens_prestige_series_controller.rb │ ├── dates.rb │ ├── duplicate_people_controller.rb │ ├── editor_requests_controller.rb │ ├── editors_controller.rb │ ├── errors_controller.rb │ ├── event_team_memberships_controller.rb │ ├── event_teams_controller.rb │ ├── events_controller.rb │ ├── home_controller.rb │ ├── human_dates_controller.rb │ ├── mailing_lists_controller.rb │ ├── memberships_controller.rb │ ├── pages_controller.rb │ ├── password_resets_controller.rb │ ├── people_controller.rb │ ├── person_sessions_controller.rb │ ├── photos_controller.rb │ ├── posts_controller.rb │ ├── races_controller.rb │ ├── racing_associations_controller.rb │ ├── results_controller.rb │ ├── schedule_controller.rb │ ├── teams_controller.rb │ └── versions_controller.rb ├── helpers │ ├── admin │ │ ├── article_categories_helper.rb │ │ ├── events_helper.rb │ │ ├── people_helper.rb │ │ └── races_helper.rb │ ├── aliases_helper.rb │ ├── application_helper.rb │ ├── calculations │ │ └── v3 │ │ │ └── calculations_helper.rb │ ├── editable_helper.rb │ ├── events_helper.rb │ ├── home_helper.rb │ ├── menu_helper.rb │ ├── page_helper.rb │ ├── people_helper.rb │ ├── posts_helper.rb │ ├── racing_on_rails │ │ ├── form_builder.rb │ │ └── form_tag_helper.rb │ ├── results │ │ ├── mapper.rb │ │ └── renderers │ │ │ ├── default_result_renderer.rb │ │ │ ├── event_full_name_renderer.rb │ │ │ ├── name_renderer.rb │ │ │ ├── points_renderer.rb │ │ │ ├── rejection_reason_renderer.rb │ │ │ ├── score_event_full_name_renderer.rb │ │ │ ├── team_name_renderer.rb │ │ │ └── time_renderer.rb │ ├── results_helper.rb │ ├── table_helper.rb │ ├── tabs_helper.rb │ ├── teams_helper.rb │ └── whitespace_helper.rb ├── jobs │ ├── application_job.rb │ └── calculations_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── account_permission.rb │ ├── alias.rb │ ├── application_record.rb │ ├── article.rb │ ├── article_category.rb │ ├── calculations.rb │ ├── calculations │ │ ├── v3.rb │ │ └── v3 │ │ │ ├── calculation.rb │ │ │ ├── calculation_concerns.rb │ │ │ ├── calculation_concerns │ │ │ ├── cache.rb │ │ │ ├── calculated_results.rb │ │ │ ├── dates.rb │ │ │ ├── races.rb │ │ │ ├── result_sources.rb │ │ │ ├── rules_concerns.rb │ │ │ ├── save_results.rb │ │ │ └── source_results.rb │ │ │ ├── calculator.rb │ │ │ ├── calculators.rb │ │ │ ├── calculators │ │ │ └── categories.rb │ │ │ ├── category.rb │ │ │ ├── category_mapping.rb │ │ │ ├── constraint.rb │ │ │ ├── discipline.rb │ │ │ ├── event.rb │ │ │ ├── models.rb │ │ │ ├── models │ │ │ ├── association.rb │ │ │ ├── calculated_result.rb │ │ │ ├── category.rb │ │ │ ├── category_mapping.rb │ │ │ ├── category_rule.rb │ │ │ ├── discipline.rb │ │ │ ├── event.rb │ │ │ ├── event_category.rb │ │ │ ├── participant.rb │ │ │ ├── results.rb │ │ │ └── source_result.rb │ │ │ ├── rejection.rb │ │ │ ├── rules.rb │ │ │ ├── steps.rb │ │ │ ├── steps │ │ │ ├── add_missing_results_penalty.rb │ │ │ ├── assign_points.rb │ │ │ ├── assign_team_sizes.rb │ │ │ ├── place.rb │ │ │ ├── reject_all_source_results_rejected.rb │ │ │ ├── reject_below_minimum_events.rb │ │ │ ├── reject_calculated_events.rb │ │ │ ├── reject_categories.rb │ │ │ ├── reject_category_worst_results.rb │ │ │ ├── reject_dnfs.rb │ │ │ ├── reject_empty_categories.rb │ │ │ ├── reject_empty_source_results.rb │ │ │ ├── reject_more_than_maximum_events.rb │ │ │ ├── reject_more_than_results_per_event.rb │ │ │ ├── reject_no_participant.rb │ │ │ ├── reject_no_points.rb │ │ │ ├── reject_no_source_event_points.rb │ │ │ ├── reject_weekday_events.rb │ │ │ ├── select_association_sanctioned.rb │ │ │ ├── select_in_discipline.rb │ │ │ ├── select_members.rb │ │ │ ├── sum_points.rb │ │ │ └── validate.rb │ │ │ ├── validation_error.rb │ │ │ └── year.rb │ ├── categories.rb │ ├── categories │ │ ├── ability.rb │ │ ├── ages.rb │ │ ├── cleanup.rb │ │ ├── equipment.rb │ │ ├── friendly_param.rb │ │ ├── gender.rb │ │ ├── matching.rb │ │ ├── name_normalization.rb │ │ └── weight.rb │ ├── category.rb │ ├── ckeditor │ │ ├── asset.rb │ │ ├── attachment_file.rb │ │ └── picture.rb │ ├── combined_time_trial_results.rb │ ├── competitions │ │ ├── age_graded_bar.rb │ │ ├── bar.rb │ │ ├── bars │ │ │ ├── categories.rb │ │ │ ├── discipline.rb │ │ │ └── points.rb │ │ ├── blind_date_at_the_dairy │ │ │ └── common.rb │ │ ├── blind_date_at_the_dairy_monthly_standings.rb │ │ ├── blind_date_at_the_dairy_overall.rb │ │ ├── blind_date_at_the_dairy_team_competition.rb │ │ ├── calculations │ │ │ ├── calculator.rb │ │ │ ├── place.rb │ │ │ ├── points.rb │ │ │ ├── rules.rb │ │ │ ├── select_results.rb │ │ │ ├── select_scores.rb │ │ │ ├── structs.rb │ │ │ └── teams.rb │ │ ├── cat4_womens_race_series.rb │ │ ├── categories.rb │ │ ├── competition.rb │ │ ├── competition_event_membership.rb │ │ ├── cross_crusade_callups.rb │ │ ├── cross_crusade_overall.rb │ │ ├── cross_crusade_team_competition.rb │ │ ├── dates.rb │ │ ├── dirty_circles_overall.rb │ │ ├── grand_prix_brad_ross │ │ │ ├── common.rb │ │ │ ├── overall.rb │ │ │ └── team_standings.rb │ │ ├── ironman.rb │ │ ├── mbra_bar.rb │ │ ├── mbra_team_bar.rb │ │ ├── naming.rb │ │ ├── oregon_cup.rb │ │ ├── oregon_junior_cyclocross_series │ │ │ ├── overall.rb │ │ │ └── team.rb │ │ ├── oregon_junior_mountain_bike_series │ │ │ ├── overall.rb │ │ │ └── team.rb │ │ ├── oregon_tt_cup.rb │ │ ├── oregon_womens_prestige_series.rb │ │ ├── oregon_womens_prestige_series_modules │ │ │ └── common.rb │ │ ├── oregon_womens_prestige_team_series.rb │ │ ├── overall.rb │ │ ├── overall_bar.rb │ │ ├── overall_bars │ │ │ ├── categories.rb │ │ │ └── races.rb │ │ ├── points.rb │ │ ├── portland_short_track_series │ │ │ ├── common.rb │ │ │ ├── monthly_standings.rb │ │ │ ├── overall.rb │ │ │ └── team_standings.rb │ │ ├── portland_trophy_cup.rb │ │ ├── races.rb │ │ ├── rider_rankings.rb │ │ ├── score.rb │ │ ├── tabor_overall.rb │ │ ├── team_bar.rb │ │ ├── thrilla_overall.rb │ │ ├── willamette_valley_classics_tour.rb │ │ ├── wsba_barr.rb │ │ └── wsba_masters_barr.rb │ ├── discipline.rb │ ├── discipline_alias.rb │ ├── duplicate.rb │ ├── duplicate_person.rb │ ├── editor_request.rb │ ├── editor_request_mailer.rb │ ├── event.rb │ ├── event_observer.rb │ ├── event_team.rb │ ├── event_team_membership.rb │ ├── events │ │ ├── children.rb │ │ ├── comparison.rb │ │ ├── competitions.rb │ │ ├── dates.rb │ │ ├── defaults.rb │ │ ├── naming.rb │ │ ├── previous.rb │ │ ├── promoters.rb │ │ ├── results.rb │ │ └── slugs.rb │ ├── export │ │ ├── aliases.rb │ │ ├── base.rb │ │ ├── categories.rb │ │ ├── events.rb │ │ ├── people.rb │ │ ├── races.rb │ │ ├── results.rb │ │ └── teams.rb │ ├── home.rb │ ├── import_file.rb │ ├── mailing_list.rb │ ├── mailing_list_mailer.rb │ ├── multi_day_event.rb │ ├── name.rb │ ├── name_observer.rb │ ├── names │ │ └── nameable.rb │ ├── notifier.rb │ ├── number_issuer.rb │ ├── page.rb │ ├── pages │ │ ├── constraint.rb │ │ └── paths.rb │ ├── people │ │ ├── ages.rb │ │ ├── aliases.rb │ │ ├── authorization.rb │ │ ├── column_mapper.rb │ │ ├── export.rb │ │ ├── gender.rb │ │ ├── membership.rb │ │ ├── merge.rb │ │ ├── names.rb │ │ └── numbers.rb │ ├── people_file.rb │ ├── person.rb │ ├── person_mailer.rb │ ├── person_observer.rb │ ├── person_session.rb │ ├── photo.rb │ ├── photos │ │ └── dimensions.rb │ ├── post.rb │ ├── race.rb │ ├── race_number.rb │ ├── race_observer.rb │ ├── races_collection.rb │ ├── racing_association.rb │ ├── racing_on_rails │ │ └── paper_trail │ │ │ └── versions.rb │ ├── region.rb │ ├── regions │ │ └── friendly_param.rb │ ├── result.rb │ ├── result_source.rb │ ├── results │ │ ├── caching.rb │ │ ├── cleanup.rb │ │ ├── column_mapper.rb │ │ ├── comparison.rb │ │ ├── competitions.rb │ │ ├── create_if_best_result_for_race_extension.rb │ │ ├── custom_attributes.rb │ │ ├── people.rb │ │ ├── results_file.rb │ │ ├── row_mapper.rb │ │ ├── times.rb │ │ ├── usac_file.rb │ │ └── usac_results_file.rb │ ├── sanctioned.rb │ ├── schedule │ │ ├── column_mapper.rb │ │ ├── day.rb │ │ ├── month.rb │ │ ├── schedule.rb │ │ └── week.rb │ ├── series.rb │ ├── single_day_event.rb │ ├── team.rb │ ├── team_observer.rb │ ├── teams │ │ ├── membership.rb │ │ └── merge.rb │ ├── velodrome.rb │ └── weekly_series.rb ├── pdfs │ └── card.rb ├── services │ ├── google_group_manager.rb │ └── stats.rb ├── uploaders │ ├── ckeditor_attachment_file_uploader.rb │ ├── ckeditor_picture_uploader.rb │ └── image_uploader.rb └── views │ ├── admin │ ├── aliases │ │ └── destroy.js.erb │ ├── article_categories │ │ ├── edit.html.erb │ │ └── index.html.erb │ ├── articles │ │ ├── edit.html.erb │ │ └── index.html.erb │ ├── categories │ │ ├── _category.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── index.js.erb │ │ └── update.js.erb │ ├── events │ │ ├── _events.html.erb │ │ ├── _parent.html.erb │ │ ├── destroy.js.erb │ │ ├── destroy_error.js.erv │ │ ├── destroy_races.js.erb │ │ ├── edit.html.erb │ │ └── index.html.erb │ ├── first_aid_providers │ │ ├── _event.html.erb │ │ └── index.html.erb │ ├── pages │ │ ├── _page.html.erb │ │ ├── edit.html.erb │ │ └── index.html.erb │ ├── people │ │ ├── _aliases.html.erb │ │ ├── _aliases_cell.html.erb │ │ ├── _categories.html.erb │ │ ├── _names.html.erb │ │ ├── _numbers.html.erb │ │ ├── _person.html.erb │ │ ├── _team.html.erb │ │ ├── duplicates.html.erb │ │ ├── edit.html.erb │ │ ├── endicia.xls.erb │ │ ├── index.html.erb │ │ ├── index.js.erb │ │ ├── index.ppl.erb │ │ ├── index.xls.erb │ │ ├── merge.js.erb │ │ ├── merge_confirm.js.erb │ │ ├── no_cards.html.erb │ │ ├── number_year_changed.js.erb │ │ ├── preview_import.html.erb │ │ └── scoring_sheet.xls.erb │ ├── posts │ │ ├── _post.html.erb │ │ ├── edit.html.erb │ │ └── index.html.erb │ ├── race_numbers │ │ └── destroy.js.erb │ ├── races │ │ ├── _race.html.erb │ │ ├── _result.html.erb │ │ ├── _results.html.erb │ │ ├── create.js.erb │ │ ├── create_result.js.erb │ │ ├── destroy.js.erb │ │ ├── destroy_result.js.erb │ │ ├── edit.html.erb │ │ └── propagate.js.erb │ ├── races_collections │ │ ├── _edit.html.erb │ │ ├── _show.html.erb │ │ ├── edit.js.erb │ │ └── show.js.erb │ ├── results │ │ ├── _people.html.erb │ │ ├── _person.html.erb │ │ ├── _result.html.erb │ │ ├── add_score.js.erb │ │ ├── create.js.erb │ │ ├── destroy.js.erb │ │ ├── index.html.erb │ │ ├── index.js.erb │ │ ├── move.js.erb │ │ └── scores.js.erb │ ├── scores │ │ └── _score.html.erb │ ├── stats │ │ └── index.html.erb │ ├── teams │ │ ├── _aliases.html.erb │ │ ├── _team.html.erb │ │ ├── destroy_name.js.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── index.js.erb │ │ ├── merge.js.erb │ │ └── merge_confirm.js.erb │ └── velodromes │ │ ├── _velodrome.html.erb │ │ ├── edit.html.erb │ │ └── index.html.erb │ ├── article_categories │ ├── _article.html.erb │ └── show.html.erb │ ├── articles │ └── show.html.erb │ ├── calculations │ ├── _calculation.html.erb │ ├── _calculations_event.html.erb │ ├── _category_rule.html.erb │ ├── _editable_calculation_category.html.erb │ ├── _editable_calculations_event.html.erb │ ├── _editable_category_category.html.erb │ ├── _group_events.html.erb │ ├── _rejected_category_rule.html.erb │ ├── _years.html.erb │ ├── categories │ │ └── index.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── races │ │ └── show.html.erb │ ├── results │ │ ├── _calculation.html.erb │ │ ├── _notes.html.erb │ │ ├── _paginated_results.html.erb │ │ ├── _races.html.erb │ │ ├── _results.html.erb │ │ ├── _separate_races.html.erb │ │ ├── index.html.erb │ │ ├── paginated.html.erb │ │ └── show.html.erb │ ├── show.html.erb │ └── sources │ │ ├── _result.html.erb │ │ └── index.html.erb │ ├── categories │ ├── _category.html.erb │ └── index.html.erb │ ├── competitions │ ├── bar │ │ ├── _disciplines.html.erb │ │ ├── _races.html.erb │ │ ├── _years.html.erb │ │ ├── index.html.erb │ │ └── show.html.erb │ ├── ironman │ │ └── index.html.erb │ └── oregon_cup │ │ ├── _races.html.erb │ │ └── index.html.erb │ ├── duplicate_people │ ├── destroy.js.erb │ └── index.html.erb │ ├── editor_request_mailer │ ├── editor_request.text.erb │ └── notification.text.erb │ ├── editor_requests │ └── show.html.erb │ ├── errors │ ├── internal_server_error.html.erb │ ├── not_found.html.erb │ ├── over_capacity.html.erb │ ├── unauthorized.html.erb │ └── unprocessable_entity.html.erb │ ├── event_teams │ ├── _event_team.html.erb │ ├── _event_team_membership.html.erb │ ├── index.html.erb │ └── no_event_teams.html.erb │ ├── events │ ├── _event.html.erb │ └── index.html.erb │ ├── home │ ├── _ads.html.erb │ ├── _associated.html.erb │ ├── _links.html.erb │ ├── _most_recent_event_with_recent_result.html.erb │ ├── _photo.html.erb │ ├── _photo_row.html.erb │ ├── _recent_results.html.erb │ ├── _upcoming_events.html.erb │ ├── edit.html.erb │ └── index.html.erb │ ├── layouts │ ├── _flash_message.html.erb │ ├── _javascripts.html.erb │ ├── _nav.html.erb │ ├── _stylesheets.html.erb │ ├── admin │ │ └── application.html.erb │ └── application.html.erb │ ├── mailing_lists │ ├── _links.html.erb │ ├── confirm.html.erb │ ├── confirm_private_reply.html.erb │ └── index.html.erb │ ├── memberships │ └── show.html.erb │ ├── modals │ ├── _button.html.erb │ ├── _new.html.erb │ └── _select.html.erb │ ├── notifier │ └── password_reset_instructions.text.erb │ ├── password_resets │ ├── edit.html.erb │ └── new.html.erb │ ├── people │ ├── _account_permission.html.erb │ ├── _account_permissions.html.erb │ ├── _categories.html.erb │ ├── _created_updated.html.erb │ ├── _disciplines.html.erb │ ├── _event.html.erb │ ├── _event_team_membership.html.erb │ ├── _event_team_memberships.html.erb │ ├── _events.html.erb │ ├── _mailing_lists.html.erb │ ├── _numbers.html.erb │ ├── _orders.html.erb │ ├── _person.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── membership.html.erb │ └── new_login.html.erb │ ├── person_mailer │ ├── new_login_confirmation.html.erb │ └── new_login_confirmation.text.erb │ ├── person_sessions │ ├── new.html.erb │ ├── show.html.erb │ └── unauthorized.html.erb │ ├── photos │ ├── _photo.html.erb │ ├── edit.html.erb │ └── index.html.erb │ ├── posts │ ├── _pagination.html.erb │ ├── _post.html.erb │ ├── _reply.html.erb │ ├── _show_pagination.html.erb │ ├── index.atom.builder │ ├── index.html.erb │ └── show.html.erb │ ├── races │ └── index.html.erb │ ├── racing_associations │ ├── _registration_engine.html.erb │ └── edit.html.erb │ ├── redirect.js.erb │ ├── results │ ├── _calculation.html.erb │ ├── _children.html.erb │ ├── _date_and_parent.html.erb │ ├── _event_teams.html.erb │ ├── _races.html.erb │ ├── _result.html.erb │ ├── _single_day_event_children.html.erb │ ├── _source_events.html.erb │ ├── _start_list.html.erb │ ├── _table.html.erb │ ├── _years.html.erb │ ├── event.html.erb │ ├── event.xlsx.axlsx │ ├── index.html.erb │ ├── index.xml.builder │ ├── person.html.erb │ ├── person_event.html.erb │ ├── team.html.erb │ └── team_event.html.erb │ ├── schedule │ ├── _event.html.erb │ ├── _others.html.erb │ ├── _regions.html.erb │ ├── _sanctioning_organizations.html.erb │ ├── _tabs.html.erb │ ├── _tentative.html.erb │ ├── calendar.html.erb │ ├── index.atom.builder │ ├── index.html.erb │ ├── index.xlsx.axlsx │ └── list.html.erb │ ├── shared │ ├── _city_state_zip.html.erb │ ├── _date_picker.html.erb │ ├── _date_time_picker.html.erb │ ├── _disciplines.html.erb │ ├── _errors.html.erb │ ├── _google.html.erb │ ├── _member.html.erb │ ├── _months.html.erb │ ├── _search.html.erb │ ├── _tabs.html.erb │ └── _years.html.erb │ ├── table │ ├── _base.html.erb │ └── _th.html.erb │ ├── tabs │ ├── _dropdown_tab.html.erb │ ├── _dropdown_tabs.html.erb │ ├── _tab.html.erb │ └── _tabs.html.erb │ ├── teams │ ├── _team.html.erb │ ├── index.html.erb │ └── index.xlsx.axlsx │ └── versions │ ├── _version.html.erb │ └── index.html.erb ├── babel.config.js ├── bin ├── ascii85 ├── bundle ├── byebug ├── callups.rb ├── cap ├── capify ├── erubis ├── httparty ├── jeweler ├── launchy ├── mongrel_rpm ├── newrelic ├── newrelic_cmd ├── nokogiri ├── nrdebug ├── oletool ├── pdf_callbacks ├── pdf_list_callbacks ├── pdf_object ├── pdf_text ├── puma ├── pumactl ├── rackup ├── rails ├── rake ├── rdoc ├── redcarpet ├── ri ├── ri_cal ├── rubocop ├── sass ├── sass-convert ├── scss ├── sprockets ├── test ├── test_ruby ├── thor ├── tilt ├── tt ├── unicorn ├── unicorn_rails └── xlsopcodes ├── config.ru ├── config ├── application.rb ├── boot.rb ├── brakeman.ignore ├── brakeman.yml ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── deploy.rb ├── deploy │ ├── production.rb │ └── staging.rb ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ ├── staging.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── ckeditor.rb │ ├── cookies_serializer.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── new_relic.rb │ ├── raygun.rb │ ├── session_store.rb │ ├── time_formats.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── newrelic.yml ├── performance.rb ├── routes.rb ├── semaphore_database.yml ├── spring.rb ├── storage.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── grants.sql ├── migrate │ ├── 20200104231021_add_calculation_category_matches.rb │ ├── 20200106032705_add_calculation_category_discipline.rb │ ├── 20200109185555_add_calculation_unique_constraints.rb │ ├── 20200117183910_add_race_discipline.rb │ ├── 20200120224522_add_product_team.rb │ ├── 20200120225216_add_line_item_team.rb │ ├── 20200120235814_add_order_people_team_id.rb │ ├── 20200125000755_add_racing_association_card_colors.rb │ ├── 20200301154515_add_people_fabric_road_numbers.rb │ ├── 20200303004002_allow_discount_null_event.rb │ ├── 20200308011251_add_usac_license.rb │ ├── 20200308013135_add_order_person_license.rb │ ├── 20200425160436_add_events_tentative.rb │ ├── 20200501151835_add_unique_team_name_index.rb │ ├── 20200501153001_add_unique_indexes.rb │ ├── 20200603161935_create_community_discipline.rb │ ├── 20201129161456_add_team_member_years.rb │ ├── 20201219173227_remove_mobile_site.rb │ ├── 20210311164253_add_race_rejection_defaults.rb │ ├── 20210312171017_correct_calculation_dates.rb │ └── 20210315224418_add_calculation_show_zero_point_source_results.rb ├── schema.rb └── seeds.rb ├── doc ├── Competition categories.graffle └── README_FOR_APP ├── lib ├── action_view │ └── inline_template_extension.rb ├── acts_as_tree │ ├── extensions.rb │ └── validation.rb ├── array │ └── each_row.rb ├── capistrano │ └── tasks │ │ └── db.rb ├── carrier_wave │ └── mini_magick │ │ └── processing.rb ├── countries.rb ├── enumerable │ └── stable_sort.rb ├── exception_notification │ └── logging.rb ├── human_date │ └── parser.rb ├── tasks │ ├── .gitkeep │ ├── racing_on_rails.rake │ └── test.rake └── test │ └── enumerable_assertions.rb ├── package.json ├── postcss.config.js ├── public ├── .htaccess ├── 401.html ├── 404.html ├── 422.html ├── 500.html ├── 503.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico ├── maintenance.html └── robots.txt ├── script ├── archive_email ├── calcs.rb ├── competition_results.rb ├── convert_competitions.rb ├── create_all_dbs ├── deploy ├── deploy_staging ├── dump_results.rb ├── group_categories.rb ├── import_ics.rb ├── local ├── migrate_versions.rb ├── or_tt_cup_distances.rb ├── pdx.rb ├── people_file_columns ├── read_mbox.rb ├── restart ├── results_file_columns ├── update_categories.rb └── update_created_and_updated_by.rb ├── test ├── .rubocop.yml ├── application_system_test_case.rb ├── controllers │ ├── admin │ │ ├── aliases_controller_test.rb │ │ ├── articles_controller_test.rb │ │ ├── categories_controller_test.rb │ │ ├── events │ │ │ ├── create_test.rb │ │ │ ├── edit_test.rb │ │ │ ├── new_test.rb │ │ │ ├── update_test.rb │ │ │ └── upload_test.rb │ │ ├── events_controller_test.rb │ │ ├── first_aid_providers_controller_test.rb │ │ ├── home_controller_test.rb │ │ ├── pages_controller_test.rb │ │ ├── people │ │ │ ├── export_test.rb │ │ │ ├── import_test.rb │ │ │ ├── index_test.rb │ │ │ ├── merge_test.rb │ │ │ ├── team_name_change_test.rb │ │ │ └── update_name_test.rb │ │ ├── people_controller_test.rb │ │ ├── posts_controller_test.rb │ │ ├── race_numbers_controller_test.rb │ │ ├── races_collections_controller_test.rb │ │ ├── races_controller_test.rb │ │ ├── results_controller_test.rb │ │ ├── teams_controller_test.rb │ │ └── velodromes_controller_test.rb │ ├── application_helper_test.rb │ ├── caching_test.rb │ ├── calculations │ │ ├── categories_controller_test.rb │ │ └── results_controller_test.rb │ ├── calculations_controller_test.rb │ ├── categories_controller_test.rb │ ├── dates_test.rb │ ├── duplicate_people_controller_test.rb │ ├── editor_requests_controller_test.rb │ ├── editors_controller_test.rb │ ├── event_team_memberships_controller_test.rb │ ├── event_teams_controller_test.rb │ ├── events_controller_test.rb │ ├── home_controller_test.rb │ ├── human_dates_controller_test.rb │ ├── mailing_lists_controller_test.rb │ ├── memberships_controller_test.rb │ ├── pages_action_controller_integration_test.rb │ ├── pages_controller_test.rb │ ├── password_resets_controller_test.rb │ ├── people │ │ ├── index_test.rb │ │ └── login_test.rb │ ├── people_controller_test.rb │ ├── people_helper_test.rb │ ├── person_sessions_controller_test.rb │ ├── photos_controller_test.rb │ ├── posts_controller_test.rb │ ├── races_controller_test.rb │ ├── racing_associations_controller_test.rb │ ├── results_controller_test.rb │ ├── results_helper_test.rb │ ├── schedule_controller_test.rb │ ├── teams_controller_test.rb │ ├── teams_helper_test.rb │ └── versions_controller_test.rb ├── factories.rb ├── fixtures │ ├── files │ │ ├── admin │ │ │ └── member_mailer │ │ │ │ └── email │ │ ├── email │ │ │ ├── bad_encoding.eml │ │ │ ├── for_sale.eml │ │ │ ├── html.eml │ │ │ ├── invalid_byte_sequence.eml │ │ │ ├── outlook.eml │ │ │ ├── outlook_expected.eml │ │ │ ├── rich.eml │ │ │ └── to_archive.eml │ │ ├── mailing_list_mailer │ │ │ └── reply │ │ ├── membership │ │ │ ├── duplicates.xlsx │ │ │ └── upload.xlsx │ │ ├── photo.jpg │ │ ├── race_day_mailer │ │ │ └── members_export │ │ ├── results │ │ │ ├── 2006_v2.xls │ │ │ ├── custom_columns.xls │ │ │ ├── dh.xls │ │ │ ├── dupe_people.xls │ │ │ ├── mtb.xls │ │ │ ├── no_first_place_finisher.xls │ │ │ ├── non_sequential_results.xls │ │ │ ├── non_sequential_usac_results.xls │ │ │ ├── pir_2006_format.xlsx │ │ │ ├── small_event.xls │ │ │ ├── stage_race.xls │ │ │ ├── tabor.txt │ │ │ ├── times.xlsx │ │ │ ├── tt.xlsx │ │ │ ├── tt_usac.xls │ │ │ └── ttt.xls │ │ └── schedule │ │ │ ├── comma-delimited.csv │ │ │ ├── excel.xls │ │ │ └── tab-delimited.txt │ └── views │ │ ├── fake │ │ ├── _flash_messages.html.erb │ │ ├── missing_partial.html.erb │ │ ├── partial_using_action.html.erb │ │ └── partial_using_partials_action.html.erb │ │ └── static │ │ ├── about.html.erb │ │ ├── join.html.erb │ │ └── women │ │ └── cat4.html.erb ├── helpers │ ├── events_helper_test.rb │ ├── people_helper_test.rb │ └── whitespace_helper_test.rb ├── integration │ ├── admin_pages_test.rb │ ├── bar_results_test.rb │ ├── competitions │ │ └── public_pages_test.rb │ ├── deprecated_urls_test.rb │ ├── event_team_membership_test.rb │ ├── events_test.rb │ ├── login_integration_test.rb │ ├── not_found_test.rb │ ├── pages_test.rb │ ├── password_resets_test.rb │ ├── people_test.rb │ ├── public_pages_integration_test.rb │ ├── racing_on_rails │ │ └── integration_test.rb │ └── results_test.rb ├── jobs │ └── calculations_job_test.rb ├── lib │ └── human_date │ │ └── parser_test.rb ├── mailers │ ├── editor_request_mailer_test.rb │ ├── mailing_list_mailer_test.rb │ ├── notifier_test.rb │ └── person_mailer_test.rb ├── models │ ├── account_permission_test.rb │ ├── alias_test.rb │ ├── article_category_test.rb │ ├── calculations │ │ └── v3 │ │ │ ├── age_groups_by_category_test.rb │ │ │ ├── age_groups_by_place_test.rb │ │ │ ├── bar_test.rb │ │ │ ├── calculation_test.rb │ │ │ ├── calculation_year_test.rb │ │ │ ├── ironman_test.rb │ │ │ ├── obra_competition_test.rb │ │ │ ├── series_test.rb │ │ │ ├── stage_race_test.rb │ │ │ └── team_test.rb │ ├── categories │ │ ├── acts_as_tree_test.rb │ │ ├── best_match_by_age_in_test.rb │ │ ├── best_match_in_test.rb │ │ ├── cleanup_test.rb │ │ └── name_test.rb │ ├── category_test.rb │ ├── discipline_test.rb │ ├── duplicate_person_test.rb │ ├── duplicate_test.rb │ ├── editor_requests_test.rb │ ├── event_team_memberships_test.rb │ ├── events │ │ ├── dates_test.rb │ │ ├── event_test.rb │ │ ├── json_diff_test.rb │ │ ├── multi_day_event_test.rb │ │ ├── previous_test.rb │ │ ├── promoters_test.rb │ │ ├── results_test.rb │ │ ├── single_day_event_test.rb │ │ ├── slug_test.rb │ │ ├── upcoming_test.rb │ │ └── weekly_series_test.rb │ ├── mailing_lists │ │ ├── mailing_list_test.rb │ │ └── post_test.rb │ ├── name_test.rb │ ├── number_issuer_test.rb │ ├── page_test.rb │ ├── people_file_test.rb │ ├── person_session_test.rb │ ├── person_test.rb │ ├── photo_test.rb │ ├── race_number_test.rb │ ├── race_test.rb │ ├── races_collections_test.rb │ ├── racing_association_test.rb │ ├── region_test.rb │ ├── result_source_test.rb │ ├── results │ │ ├── result_test.rb │ │ ├── results_file_test.rb │ │ ├── set_associations_test.rb │ │ ├── time_test.rb │ │ └── usac_results_file_test.rb │ ├── schedule │ │ ├── day_test.rb │ │ └── schedule_test.rb │ ├── teams │ │ ├── membership_test.rb │ │ ├── merge_test.rb │ │ ├── name_test.rb │ │ └── team_test.rb │ └── velodrome_test.rb ├── performance │ ├── mailing_lists.rb │ └── results.rb ├── system │ ├── actions.rb │ ├── admin │ │ ├── calculations_test.rb │ │ ├── events_test.rb │ │ ├── first_aid_providers_test.rb │ │ ├── home_test.rb │ │ ├── pages_test.rb │ │ ├── people_test.rb │ │ ├── photos_test.rb │ │ ├── results_test.rb │ │ ├── teams_test.rb │ │ └── velodromes_test.rb │ ├── assertions.rb │ ├── calculations_test.rb │ ├── competitions │ │ └── public_pages_acceptance_test.rb │ ├── mailing_lists_test.rb │ ├── officials_test.rb │ ├── password_resets_test.rb │ ├── promoters_test.rb │ └── public_pages_test.rb └── test_helper.rb ├── test_ruby ├── .rubocop.yml ├── Rakefile ├── helpers │ └── results │ │ ├── mapper_test.rb │ │ └── renderers │ │ ├── default_column_renderer_test.rb │ │ ├── default_result_renderer_test.rb │ │ ├── name_renderer_test.rb │ │ ├── points_renderer_test.rb │ │ ├── team_name_renderer_test.rb │ │ └── time_renderer_test.rb ├── lib │ └── enumerable_test.rb ├── models │ ├── calculations │ │ ├── v3.rb │ │ └── v3 │ │ │ ├── calculator_test.rb │ │ │ ├── map_source_results_to_results_test.rb │ │ │ ├── models │ │ │ ├── association_test.rb │ │ │ ├── calculated_result_test.rb │ │ │ ├── category_test.rb │ │ │ ├── equality_assertion.rb │ │ │ ├── event_category_test.rb │ │ │ ├── event_test.rb │ │ │ ├── participant_test.rb │ │ │ └── source_result_test.rb │ │ │ ├── rules_test.rb │ │ │ └── steps │ │ │ ├── add_missing_results_penalty_test.rb │ │ │ ├── assign_points_test.rb │ │ │ ├── assign_team_sizes_test.rb │ │ │ ├── place_by_place_test.rb │ │ │ ├── place_test.rb │ │ │ ├── reject_below_minimum_events_test.rb │ │ │ ├── reject_calculated_events_test.rb │ │ │ ├── reject_categories_test.rb │ │ │ ├── reject_category_worst_results_test.rb │ │ │ ├── reject_empty_source_results_test.rb │ │ │ ├── reject_more_than_maximum_events_test.rb │ │ │ ├── reject_more_than_results_per_event_test.rb │ │ │ ├── reject_no_participant_test.rb │ │ │ ├── reject_no_points_test.rb │ │ │ ├── reject_no_source_event_points_test.rb │ │ │ ├── reject_weekday_events_test.rb │ │ │ ├── select_association_sanctioned_test.rb │ │ │ ├── select_in_discipline_test.rb │ │ │ ├── select_members_test.rb │ │ │ └── sum_points_test.rb │ ├── categories │ │ ├── ability_test.rb │ │ ├── ages_test.rb │ │ ├── equipment_test.rb │ │ ├── gender_test.rb │ │ └── weight_test.rb │ ├── competitions │ │ ├── bars │ │ │ └── discipline_test.rb │ │ ├── calculations │ │ │ ├── calculations_test.rb │ │ │ ├── calculator_test.rb │ │ │ ├── place_test.rb │ │ │ ├── points_test.rb │ │ │ ├── rules_test.rb │ │ │ ├── select_results_test.rb │ │ │ ├── select_scores_test.rb │ │ │ └── teams_test.rb │ │ ├── categories_test.rb │ │ └── naming_test.rb │ ├── events │ │ ├── comparison_test.rb │ │ ├── dates_test.rb │ │ └── naming_test.rb │ ├── pages │ │ └── constraint_test.rb │ ├── photos │ │ └── dimensions_test.rb │ ├── regions │ │ └── friendly_param_test.rb │ └── results │ │ └── comparison_test.rb └── test_case.rb └── vendor ├── assets ├── javascripts │ ├── jquery-ui-timepicker-addon.js │ └── jquery.jeditable.js └── stylesheets │ ├── images │ ├── ui-icons_222222_256x240.png │ ├── ui-icons_2e83ff_256x240.png │ ├── ui-icons_454545_256x240.png │ ├── ui-icons_888888_256x240.png │ └── ui-icons_cd0a0a_256x240.png │ ├── jquery-ui-1.10.3.custom.scss │ └── jquery-ui-timepicker-addon.css └── sentient_user ├── sentient_controller.rb └── sentient_user.rb /.hound.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/.hound.yml -------------------------------------------------------------------------------- /Capfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "capistrano/setup" 4 | 5 | require "capistrano/deploy" 6 | require "capistrano/rails" 7 | require "capistrano/bundler" 8 | 9 | require "capistrano/rvm" 10 | 11 | require "capistrano/scm/git" 12 | install_plugin Capistrano::SCM::Git 13 | 14 | require "capistrano/rails/assets" 15 | require "capistrano/rails/migrations" 16 | 17 | require "capistrano/puma" 18 | install_plugin Capistrano::Puma 19 | install_plugin Capistrano::Puma::Workers 20 | install_plugin Capistrano::Puma::Systemd 21 | 22 | Dir.glob("lib/capistrano/tasks/*.rb").each { |r| import r } 23 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Add your own tasks in files placed in lib/tasks ending in .rake, 4 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 5 | 6 | require_relative "config/application" 7 | 8 | Rails.application.load_tasks 9 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_tree ../fonts 3 | //= link_directory ../javascripts .js 4 | 5 | // Breaks without dir in latest Rails 6 6 | //= link_tree ../../../local/app/assets/images 7 | 8 | // Don't precompile partials 9 | //= link application.css 10 | //= link registration_engine/application.css 11 | -------------------------------------------------------------------------------- /app/assets/fonts/glyphicons-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/fonts/glyphicons-regular.eot -------------------------------------------------------------------------------- /app/assets/fonts/glyphicons-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/fonts/glyphicons-regular.ttf -------------------------------------------------------------------------------- /app/assets/fonts/glyphicons-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/fonts/glyphicons-regular.woff -------------------------------------------------------------------------------- /app/assets/fonts/glyphicons-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/fonts/glyphicons-regular.woff2 -------------------------------------------------------------------------------- /app/assets/images/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/apple-touch-icon.png -------------------------------------------------------------------------------- /app/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/favicon.ico -------------------------------------------------------------------------------- /app/assets/images/photos/404.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/photos/404.jpg -------------------------------------------------------------------------------- /app/assets/images/photos/422.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/photos/422.jpg -------------------------------------------------------------------------------- /app/assets/images/photos/500.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/photos/500.jpg -------------------------------------------------------------------------------- /app/assets/images/photos/503.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/photos/503.jpg -------------------------------------------------------------------------------- /app/assets/images/photos/maintenance.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/assets/images/photos/maintenance.jpg -------------------------------------------------------------------------------- /app/assets/javascripts/admin.js: -------------------------------------------------------------------------------- 1 | /* 2 | *= require admin_results 3 | *= require categories 4 | *= require events 5 | *= require first_aid_providers 6 | *= require people 7 | *= require results 8 | *= require teams 9 | */ 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/first_aid_providers.js: -------------------------------------------------------------------------------- 1 | jQuery(document).ready(function() { 2 | jQuery('.show_past_events').click(function() { return this.form.submit(); }); 3 | }); 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/raygun.js.erb: -------------------------------------------------------------------------------- 1 | <% if Rails.env == "staging" || Rails.env == "production" %> 2 | !function(a,b,c,d,e,f,g,h){a.RaygunObject=e,a[e]=a[e]||function(){ 3 | (a[e].o=a[e].o||[]).push(arguments)},f=b.createElement(c),g=b.getElementsByTagName(c)[0], 4 | f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){ 5 | h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({ 6 | e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/raygun.min.js","rg4js"); 7 | 8 | rg4js('apiKey', 'jXyEmb3vjngvdkib6L4O6w=='); 9 | rg4js('enableCrashReporting', false); 10 | rg4js('options', { 11 | ignore3rdPartyErrors: true 12 | }); 13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/results.js: -------------------------------------------------------------------------------- 1 | // TODO Consolidate this and toggle_member with makeEditable() 2 | function bindBarCheckBox() { 3 | jQuery('.bar_check_box').change(function(e) { 4 | var ajaxoptions = { 5 | type : 'POST', 6 | data : { 7 | '_method': 'PATCH', 8 | name: 'bar' 9 | }, 10 | url : jQuery(this).data('url') 11 | }; 12 | if (jQuery(e.target).is(':checked')) { 13 | ajaxoptions.data.value = '1'; 14 | } 15 | else { 16 | ajaxoptions.data.value = '0'; 17 | } 18 | jQuery.ajax(ajaxoptions); 19 | }); 20 | } 21 | 22 | jQuery(document).ready(function() { 23 | bindBarCheckBox(); 24 | }); 25 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_utilities.scss: -------------------------------------------------------------------------------- 1 | 2 | .margin-4 { 3 | margin: 4rem; 4 | } 5 | 6 | .stats-chart { 7 | height:800px; 8 | margin: 4rem 0; 9 | width:100%; 10 | } -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationCable::Channel < ActionCable::Channel::Base 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationCable::Connection < ActionCable::Connection::Base 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/admin/admin_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | class AdminController < ApplicationController 5 | before_action :require_administrator, :assign_current_admin_tab 6 | layout "admin/application" 7 | 8 | # Always show tabs 9 | def toggle_tabs 10 | @show_tabs = true 11 | end 12 | 13 | protected 14 | 15 | def assign_current_admin_tab 16 | @current_admin_tab = nil 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/controllers/admin/aliases_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | class AliasesController < Admin::AdminController 5 | def destroy 6 | @alias = Alias.find(params[:id]) 7 | @alias.destroy 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/admin/home_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | # Just redirect to admin events index 5 | class HomeController < Admin::AdminController 6 | def index 7 | flash.keep 8 | redirect_to admin_events_path 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/controllers/admin/race_numbers_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin 4 | class RaceNumbersController < Admin::AdminController 5 | def destroy 6 | @race_number = RaceNumber.find(params[:id]) 7 | @race_number.destroy 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/article_categories_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ArticleCategoriesController < ApplicationController 4 | def show 5 | @article_category = ArticleCategory.where(id: params[:id]).first 6 | 7 | if @article_category.nil? 8 | # No flash because homepages are page cached 9 | return redirect_to(home_path) 10 | end 11 | 12 | top_level_article_category_id = @article_category.parent_id 13 | top_level_article_category_id = params[:id] if top_level_article_category_id == 0 14 | 15 | @article_categories = ArticleCategory.where(parent_id: top_level_article_category_id).order(:position) 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/controllers/articles_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ArticlesController < ApplicationController 4 | def show 5 | @article = Article.where(id: params[:id]).first 6 | 7 | if @article.nil? 8 | # No flash because homepages are page cached 9 | return redirect_to(home_path) 10 | end 11 | 12 | render layout: !request.xhr? 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/caching.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Caching 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | def self.expire_cache 8 | ActiveSupport::Notifications.instrument "expire_cache.racing_on_rails", perform_caching: perform_caching do 9 | RacingAssociation.current.touch 10 | end 11 | 12 | true 13 | end 14 | end 15 | 16 | protected 17 | 18 | def expire_cache 19 | self.class.expire_cache 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/calculates_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CalculatesController < ApplicationController 4 | before_action :require_administrator 5 | 6 | def create 7 | @calculation = Calculations::V3::Calculation.find(params[:calculation_id]) 8 | @calculation.calculate! 9 | flash[:notice] = "Calculated #{@calculation.name}" 10 | redirect_to edit_calculation_path(@calculation) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/calculations/races_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | class RacesController < ApplicationController 5 | def show 6 | @race = Race 7 | .where(id: params[:id]) 8 | .includes(:category) 9 | .first! 10 | 11 | @event = @race.event 12 | @races = @event.races.includes(:category) 13 | 14 | @results = Result 15 | .where(race_id: params[:id]) 16 | .includes(:person) 17 | 18 | @calculation = Calculations::V3::Calculation.find_by(event_id: @event.id) 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/categories_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CategoriesController < ApplicationController 4 | def index 5 | @name = name(params[:name]) 6 | @categories = find_categories(@name).paginate(page: page, per_page: 1000) 7 | end 8 | 9 | def find_categories(name) 10 | categories = Category.where("name like ?", "%#{name}%").order(:name) 11 | 12 | if @name.present? 13 | categories.where("name like ?", "%#{name}%") 14 | else 15 | categories 16 | end 17 | end 18 | 19 | protected 20 | 21 | def name(value) 22 | if value 23 | value.strip 24 | else 25 | "" 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/controllers/competitions/oregon_cup_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | class OregonCupController < ApplicationController 5 | def index 6 | @oregon_cup = OregonCup.find_for_year(@year) || OregonCup.new 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/dates.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Dates 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | before_action :assign_year, :assign_today 8 | end 9 | 10 | def assign_year 11 | @year = params[:year].to_i if params[:year] && params[:year][/^\d\d\d\d$/] 12 | 13 | @year = RacingAssociation.current.effective_year if @year.nil? || @year < 1900 || @year > 2100 14 | end 15 | 16 | def assign_today 17 | @today = Time.zone.today 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/controllers/duplicate_people_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DuplicatePeopleController < Admin::AdminController 4 | def index 5 | @people = DuplicatePerson.all(params[:limit]&.to_i) 6 | end 7 | 8 | def destroy 9 | respond_to do |format| 10 | format.js do 11 | @name = params[:id] 12 | Person.where(name: @name).update_all(other_people_with_same_name: true) 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/controllers/errors_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ErrorsController < ApplicationController 4 | def not_found 5 | render status: 404 6 | end 7 | 8 | def internal_server_error 9 | render status: 500 10 | end 11 | 12 | def over_capacity 13 | render status: 503 14 | end 15 | 16 | def unauthorized 17 | render status: 401 18 | end 19 | 20 | def unprocessable_entity 21 | render status: 422 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/controllers/human_dates_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Nicely-formatted version of parsed dates. Expects :date param. Echo param if date cannot be parsed. 4 | class HumanDatesController < ApplicationController 5 | def show 6 | date = parser.parse(params[:date].try(:gsub, ".json", "")) 7 | 8 | if date 9 | render json: date.to_s(:long_with_week_day).to_json 10 | else 11 | render json: params[:date].to_json 12 | end 13 | end 14 | 15 | protected 16 | 17 | def parser 18 | HumanDate::Parser.new 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/controllers/mailing_lists_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class MailingListsController < ApplicationController 4 | def index 5 | @mailing_lists = MailingList.is_public 6 | end 7 | 8 | def confirm 9 | @mailing_list = MailingList.find(params[:mailing_list_id]) 10 | end 11 | 12 | def confirm_private_reply 13 | @mailing_list = MailingList.find(params[:mailing_list_id]) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/controllers/memberships_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class MembershipsController < ApplicationController 4 | before_action :require_current_person 5 | 6 | def show 7 | @person = Person.find(params[:person_id]) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Any way to not require render_page? 4 | # Should provide sensible default if page is missing? Or just a 404? 5 | 6 | # Thinking we have a catch-all controller that uses render inline, 7 | # but could use a template handler with a comple method that queries DB? 8 | # Template-finding seems to assume a file, though 9 | class PagesController < ApplicationController 10 | def show 11 | @page = Page.find_by_normalized_path!(params[:path]) 12 | render inline: @page.body, layout: "application" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/races_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RacesController < ApplicationController 4 | # Show Races for a Category 5 | # === Params 6 | # * id: Category ID 7 | # === Assigns 8 | # * races 9 | # * category 10 | def index 11 | if params[:event_id] 12 | @event = Event.includes(:races).find(params[:event_id]) 13 | redirect_to event_results_path(@event) 14 | else 15 | @category = Category.includes(races: :event).find(params[:category_id]) 16 | @equivalent_categories = Category.equivalent(@category) 17 | end 18 | end 19 | 20 | def show 21 | @race = Race.find(params[:id]) 22 | redirect_to event_results_path(@race.event) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/controllers/versions_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Old versions of Person. Only goes back since we started using Vestal Versions. 4 | class VersionsController < ApplicationController 5 | before_action :require_current_person 6 | before_action :assign_person 7 | before_action :require_same_person_or_administrator_or_editor 8 | 9 | def assign_person 10 | @person = Person.find(params[:person_id]) 11 | @versions = PaperTrail::Version.where(item_id: @person.id, item_type: "Person") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/helpers/admin/people_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Admin::PeopleHelper 4 | # Escape for FinishLynx PPL files 5 | def ppl_escape(text) 6 | text&.gsub(",", '\""') 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/helpers/aliases_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module AliasesHelper 4 | # Aliases as a commented list 5 | def aka(person) 6 | if person&.aliases&.any? 7 | aliases = person.aliases.collect(&:name) 8 | "(a.k.a. #{aliases.join(', ')})" 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/helpers/calculations/v3/calculations_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations::V3::CalculationsHelper 4 | def link_to_calculation(calculation) 5 | return calculation.name unless calculation.event_id 6 | 7 | link_to calculation.name, friendly_calculation_path(calculation.key, calculation.year) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module HomeHelper 4 | # Set homepage @photo_columns to 1..3 based of homepage photo size 5 | def photo_width_x_height(width, height) 6 | @photo_width = width 7 | @photo_height = height 8 | @photo_columns = case @photo_width 9 | when 0..285 10 | 1 11 | when 286..574 12 | 2 13 | else 14 | 3 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/helpers/menu_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module MenuHelper 4 | def build_menu 5 | article_categories = ArticleCategory.where(parent_id: "0").order("position") 6 | discipline_names = Discipline.names 7 | render "shared/menu", article_categories: article_categories, discipline_names: discipline_names 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module PostsHelper 4 | def last_reply_at(post) 5 | date = post.last_reply_at || post.date 6 | if date.to_date == Time.zone.today 7 | date.to_s(:long_and_friendly_time) 8 | elsif date.year == Time.zone.today.year 9 | date.to_s(:short_month_date) 10 | else 11 | date.to_s(:short_month_date_year) 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/helpers/results/renderers/event_full_name_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "default_result_renderer" 4 | 5 | module Results 6 | module Renderers 7 | class EventFullNameRenderer < Results::Renderers::DefaultResultRenderer 8 | def self.render(column, row) 9 | "#{row[column.key]}" 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/helpers/results/renderers/points_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "default_result_renderer" 4 | 5 | module Results 6 | module Renderers 7 | class PointsRenderer < Results::Renderers::DefaultResultRenderer 8 | def self.render(column, row) 9 | if row[column.key] && row[column.key].to_f > 0 10 | format "%0.#{column.precision}f", row[column.key] 11 | else 12 | "" 13 | end 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/helpers/results/renderers/rejection_reason_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "default_result_renderer" 4 | 5 | module Results 6 | module Renderers 7 | class RejectionReasonRenderer < Results::Renderers::DefaultResultRenderer 8 | def self.render(_column, row) 9 | result = row.source 10 | return "" if result.rejection_reason.blank? 11 | 12 | I18n.t result.rejection_reason, category: result.category, minimum_events: 3 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/helpers/teams_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module TeamsHelper 4 | # Show team contact with email, if we have one 5 | def link_to_contact(team) 6 | if team.contact_email.present? 7 | mail_to team.contact_email, team.contact_name 8 | else 9 | team.contact_name 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/helpers/whitespace_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module WhitespaceHelper 4 | def show_whitespace(text) 5 | return text unless text 6 | 7 | preceding_whitespace(text) + text.strip + trailing_whitespace(text) 8 | end 9 | 10 | def preceding_whitespace(text) 11 | "·" * (text[/\A\s+/] || "").size 12 | end 13 | 14 | def trailing_whitespace(text) 15 | "·" * (text[/\s+\z/] || "").size 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /app/jobs/calculations_job.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CalculationsJob < ApplicationJob 4 | queue_as :default 5 | 6 | def perform(*args) 7 | Calculations::V3::Calculation.calculate! 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationMailer < ActionMailer::Base 4 | default from: RacingAssociation.current.email, bcc: 'help@obra.org' 5 | end 6 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | self.abstract_class = true 5 | end 6 | -------------------------------------------------------------------------------- /app/models/article.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Homepage content 4 | class Article < ApplicationRecord 5 | belongs_to :article_category 6 | 7 | scope :recent_news, lambda { |weeks, category| 8 | where("created_at > :cutoff OR updated_at > :cutoff", cutoff: weeks) 9 | .where(article_category_id: category) 10 | } 11 | 12 | def <=>(other) 13 | return -1 unless other 14 | 15 | position <=> other.position 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/models/article_category.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Homepage Article Category 4 | class ArticleCategory < ApplicationRecord 5 | require "acts_as_tree/validation" 6 | 7 | acts_as_tree order: "position" 8 | include ActsAsTree::Validation 9 | 10 | has_many :articles, -> { order("position desc") } 11 | end 12 | -------------------------------------------------------------------------------- /app/models/calculations.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | end 5 | -------------------------------------------------------------------------------- /app/models/calculations/v3.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations::V3 4 | REJECTION_REASONS = %w[ 5 | below_minimum_events 6 | calculated 7 | category_worst_result 8 | discipline 9 | dnf 10 | members_only 11 | no_points 12 | no_source_results 13 | not_calculation_category 14 | sanctioned_by 15 | rejected_category 16 | results_per_event 17 | weekday 18 | worse_result 19 | ].freeze 20 | end 21 | -------------------------------------------------------------------------------- /app/models/calculations/v3/calculation_concerns.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Modules for Calculation. By convention, would be named Calculations, but 4 | # that's confusing 5 | module Calculations::V3::CalculationConcerns 6 | end 7 | -------------------------------------------------------------------------------- /app/models/calculations/v3/calculators.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations::V3::Calculators 4 | end 5 | -------------------------------------------------------------------------------- /app/models/calculations/v3/category.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Calculations::V3::Category < ApplicationRecord 4 | self.table_name = "calculations_categories" 5 | 6 | belongs_to :calculation 7 | belongs_to :category, class_name: "::Category" 8 | has_many :mappings, 9 | class_name: "Calculations::V3::CategoryMapping", 10 | dependent: :destroy, 11 | foreign_key: :calculation_category_id, 12 | inverse_of: :calculation_category 13 | 14 | has_many :mapped_categories, through: :mappings, class_name: "::Category" 15 | 16 | validates :category, presence: true, uniqueness: { scope: :calculation } 17 | 18 | delegate :name, to: :category 19 | end 20 | -------------------------------------------------------------------------------- /app/models/calculations/v3/category_mapping.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Calculations::V3::CategoryMapping < ApplicationRecord 4 | self.table_name = "calculations_categories_mappings" 5 | 6 | belongs_to :calculation_category, class_name: "Calculations::V3::Category", inverse_of: :mappings 7 | belongs_to :category, class_name: "::Category", inverse_of: :calculation_category_mappings 8 | belongs_to :discipline, class_name: "::Discipline", inverse_of: :calculation_category_mappings 9 | 10 | validates :calculation_category, presence: true 11 | validates :category, presence: true 12 | end 13 | -------------------------------------------------------------------------------- /app/models/calculations/v3/constraint.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Calculations::V3::Constraint 4 | def matches?(request) 5 | year = request.params[:year] || Time.zone.today.year 6 | Calculations::V3::Calculation.exists? key: request.params[:key], year: year 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/models/calculations/v3/discipline.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Calculations::V3::Discipline < ApplicationRecord 4 | self.table_name = "calculations_disciplines" 5 | 6 | belongs_to :calculation 7 | belongs_to :discipline, class_name: "::Discipline" 8 | 9 | validates :discipline, uniqueness: { scope: :calculation } 10 | end 11 | -------------------------------------------------------------------------------- /app/models/calculations/v3/event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Calculations::V3::Event < ApplicationRecord 4 | self.table_name = "calculations_events" 5 | 6 | belongs_to :calculation 7 | belongs_to :event, class_name: "::Event" 8 | 9 | validates :event, uniqueness: { scope: :calculation } 10 | 11 | delegate :date, to: :event 12 | end 13 | -------------------------------------------------------------------------------- /app/models/calculations/v3/models.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | # Calculation-specific model, similar, but not identical to ActiveRecord model/DB schema. 6 | # Separated mainly to ensure calculations are all in memory and never connect to the DB: 7 | # * easier to test 8 | # * fast 9 | # * precise abstraction 10 | # * duplicates already-rich domain model 11 | # * difficult to share code 12 | module Models 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/models/calculations/v3/models/association.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Models 6 | class Association 7 | attr_reader :id 8 | 9 | def initialize(id: nil) 10 | @id = id 11 | end 12 | 13 | def ==(other) 14 | return false if other.nil? 15 | 16 | other.id == id 17 | end 18 | 19 | def eql?(other) 20 | self == other 21 | end 22 | 23 | def hash 24 | id&.hash 25 | end 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /app/models/calculations/v3/models/discipline.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Models 6 | class Discipline 7 | attr_reader :name 8 | 9 | def initialize(name) 10 | @name = name 11 | end 12 | 13 | def cyclocross? 14 | name == "Cyclocross" 15 | end 16 | 17 | def ==(other) 18 | return false if other.nil? 19 | 20 | other.name == name 21 | end 22 | 23 | def eql?(other) 24 | self == other 25 | end 26 | 27 | def hash 28 | name&.hash 29 | end 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | # Each transformation of calculated results. 6 | module Steps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_all_source_results_rejected.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectAllSourceResultsRejected 7 | def self.calculate!(calculator) 8 | calculator.unrejected_results.each do |result| 9 | if result.source_results.all?(&:rejected?) 10 | result.reject :no_source_results 11 | end 12 | end 13 | 14 | calculator.event_categories 15 | end 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_below_minimum_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectBelowMinimumEvents 7 | def self.calculate!(calculator) 8 | calculator.unrejected_results.each do |result| 9 | if result.unrejected_source_results.size < calculator.rules.minimum_events 10 | result.reject :below_minimum_events 11 | end 12 | end 13 | 14 | calculator.event_categories 15 | end 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_categories.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectCategories 7 | def self.calculate!(calculator) 8 | calculator.event_categories.each do |event_category| 9 | event_category.unrejected_source_results.each do |source_result| 10 | if source_result.category.in?(calculator.rules.rejected_categories) 11 | source_result.reject :rejected_category 12 | end 13 | end 14 | 15 | calculator.event_categories 16 | end 17 | end 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_dnfs.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectDnfs 7 | def self.calculate!(calculator) 8 | calculator.unrejected_source_results.each do |source_result| 9 | if source_result.dnf? 10 | source_result.reject :dnf 11 | end 12 | end 13 | 14 | calculator.event_categories 15 | end 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_empty_categories.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectEmptyCategories 7 | def self.calculate!(calculator) 8 | calculator.event_categories.reject do |event_category| 9 | event_category.results.empty? && !event_category.category.in?(calculator.categories) 10 | end 11 | end 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_empty_source_results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectEmptySourceResults 7 | def self.calculate!(calculator) 8 | calculator.event_categories.each do |category| 9 | category.results.reject! do |result| 10 | result.source_results.empty? 11 | end 12 | end 13 | 14 | calculator.event_categories 15 | end 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_no_participant.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module RejectNoParticipant 7 | def self.calculate!(calculator) 8 | calculator.event_categories.each do |event_category| 9 | event_category.results.reject! { |result| result.participant.id.nil? } 10 | end 11 | end 12 | end 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/reject_no_points.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | # Calculations that pass-through/reuse the source results points 7 | module RejectNoPoints 8 | def self.calculate!(calculator) 9 | return calculator.event_categories if calculator.rules.points_for_place 10 | 11 | calculator.unrejected_source_results.each do |source_result| 12 | if source_result.points == 0 13 | source_result.reject :no_points 14 | end 15 | end 16 | 17 | calculator.event_categories 18 | end 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/sum_points.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module SumPoints 7 | def self.calculate!(calculator) 8 | calculator.event_categories.each do |category| 9 | category.results.each do |result| 10 | result.points = result.source_results.sum(&:points) 11 | end 12 | end 13 | end 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/models/calculations/v3/steps/validate.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | module Steps 6 | module Validate 7 | def self.calculate!(calculator) 8 | calculator.results.each do |result| 9 | next unless result.rejected? && result.placed? 10 | 11 | raise( 12 | Calculations::V3::ValidationError, 13 | "Result has place #{result.place} but was rejected with #{result.rejection_reason}" 14 | ) 15 | end 16 | 17 | calculator.event_categories 18 | end 19 | end 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/models/calculations/v3/validation_error.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Calculations 4 | module V3 5 | class ValidationError < StandardError; end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/categories.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Categories 4 | MAXIMUM = 999 5 | ALL = (0..::Categories::MAXIMUM).freeze 6 | end 7 | -------------------------------------------------------------------------------- /app/models/categories/equipment.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Categories 4 | module Equipment 5 | extend ActiveSupport::Concern 6 | 7 | def set_equipment_from_name 8 | self.equipment = equipment_from_name 9 | end 10 | 11 | # Relies on normalized name 12 | def equipment_from_name 13 | # Technically different but always grouped together for BAR, etc. 14 | if name[/Singlespeed/] || name[/Fix/] || name == "Track" 15 | "Singlespeed/Fixed" 16 | else 17 | name[/Eddy|Fat Bike|Hardtail|Merckx|Stampede|Tandem|Unicycle/] 18 | end 19 | end 20 | 21 | def equipment? 22 | equipment.present? 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/models/categories/gender.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Categories 4 | module Gender 5 | extend ActiveSupport::Concern 6 | 7 | def set_gender_from_name 8 | self.gender = gender_from_name 9 | end 10 | 11 | # Relies on normalized name 12 | def gender_from_name 13 | if name[/women|athena|girl/i] 14 | "F" 15 | else 16 | "M" 17 | end 18 | end 19 | 20 | def men? 21 | gender == "M" 22 | end 23 | 24 | def non_binary? 25 | gender == "NB" 26 | end 27 | 28 | def women? 29 | gender == "F" 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /app/models/categories/weight.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Categories 4 | module Weight 5 | extend ActiveSupport::Concern 6 | 7 | def set_weight_from_name 8 | self.weight = weight_from_name 9 | end 10 | 11 | # Relies on normalized name 12 | def weight_from_name 13 | name[/Athena|Clydesdale/] 14 | end 15 | 16 | def weight? 17 | weight.present? 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/models/ckeditor/asset.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Ckeditor::Asset < ApplicationRecord 4 | include Ckeditor::Orm::ActiveRecord::AssetBase 5 | 6 | delegate :url, :current_path, :content_type, to: :data 7 | 8 | validates :data, presence: true 9 | end 10 | -------------------------------------------------------------------------------- /app/models/ckeditor/attachment_file.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Ckeditor::AttachmentFile < Ckeditor::Asset 4 | mount_uploader :data, CkeditorAttachmentFileUploader, mount_on: :data_file_name 5 | 6 | def url_thumb 7 | @url_thumb ||= Ckeditor::Utils.filethumb(filename) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/ckeditor/picture.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Ckeditor::Picture < Ckeditor::Asset 4 | mount_uploader :data, CkeditorPictureUploader, mount_on: :data_file_name 5 | 6 | def url_content 7 | url(:content) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/competitions/bars/discipline.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module Bars 5 | module Discipline 6 | def disciplines_for(race) 7 | case race.discipline 8 | when "Road" 9 | %w[Road Circuit] 10 | when "Gravel" 11 | ["Gravel", "Gran Fondo"] 12 | when "Mountain Bike" 13 | ["Mountain Bike", "Downhill", "Super D"] 14 | else 15 | [race.discipline] 16 | end 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/models/competitions/bars/points.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module Bars 5 | module Points 6 | extend ActiveSupport::Concern 7 | 8 | def point_schedule 9 | [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/models/competitions/blind_date_at_the_dairy_overall.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | class BlindDateAtTheDairyOverall < Overall 5 | include Competitions::BlindDateAtTheDairy::Common 6 | 7 | def maximum_events(_race) 8 | 4 9 | end 10 | 11 | def after_calculate 12 | super 13 | 14 | race = races.detect { |r| r.name == "Beginner" } 15 | race&.update! visible: false 16 | 17 | BlindDateAtTheDairyMonthlyStandings.calculate! 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/models/competitions/calculations/teams.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module Calculations 5 | module Teams 6 | def team_races(results) 7 | results.group_by(&:race_id).select do |_race_id, race_results| 8 | team_race? race_results 9 | end 10 | .keys 11 | end 12 | 13 | def team_race?(results) 14 | teams(results) / unique_places(results) < 0.5 15 | end 16 | 17 | def unique_places(results) 18 | results.map(&:place).uniq.size.to_f 19 | end 20 | 21 | def teams(results) 22 | results.group_by(&:place).values.count { |r| r.size > 1 } 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /app/models/competitions/cat4_womens_race_series.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | # Retired. Retain class for archived results 5 | class Cat4WomensRaceSeries < Competition 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/competitions/competition_event_membership.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | # Link Competition to source_events Events. 5 | # +points_factor+ Points multiplier for source event. Usually 0, 1, 2, 3. 0 excludes source event. 6 | class CompetitionEventMembership < ApplicationRecord 7 | belongs_to :competition 8 | belongs_to :event 9 | 10 | validates :event, uniqueness: { scope: :competition_id } 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/models/competitions/grand_prix_brad_ross/overall.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module GrandPrixBradRoss 5 | class Overall < Competitions::Overall 6 | include GrandPrixBradRoss::Common 7 | 8 | before_create :set_name 9 | 10 | def minimum_events 11 | 4 12 | end 13 | 14 | def maximum_events(_race) 15 | 4 16 | end 17 | 18 | def upgrade_points_multiplier 19 | 0.25 20 | end 21 | 22 | def set_name 23 | self.name = "Series Overall" 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /app/models/competitions/naming.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module Naming 5 | def name 6 | self[:name] ||= "#{date.year} #{friendly_name}" 7 | end 8 | 9 | def default_name 10 | name 11 | end 12 | 13 | def friendly_name 14 | "Competition" 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/models/competitions/overall_bars/races.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module OverallBars 5 | module Races 6 | extend ActiveSupport::Concern 7 | 8 | def find_race(discipline, category) 9 | event = if Discipline[:overall] == discipline 10 | self 11 | else 12 | children.detect { |e| e.discipline == discipline.name } 13 | end 14 | 15 | ::Race 16 | .where(event_id: event.id) 17 | .where(category_id: category.id) 18 | .includes(:results) 19 | .first 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/models/competitions/portland_short_track_series/overall.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | module PortlandShortTrackSeries 5 | class Overall < Competitions::Overall 6 | include PortlandShortTrackSeries::Common 7 | 8 | def maximum_events(_race) 9 | 7 10 | end 11 | 12 | def after_calculate 13 | super 14 | MonthlyStandings.calculate! year 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/models/competitions/rider_rankings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | # WSBA rider rankings. Members get points for top-10 finishes in any event. 5 | # No longer used. Class remains for archived results. 6 | class RiderRankings < Competition 7 | def friendly_name 8 | "Rider Rankings" 9 | end 10 | 11 | def notes 12 | if year.to_i > 2011 13 | "The WSBA is using the default USA Cycling ranking system from 2012 onward. Please see http://www.usacycling.org/events/rr.php." 14 | else 15 | self[:notes] 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/competitions/wsba_barr.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | # Retired 5 | class WsbaBarr < Competition 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/competitions/wsba_masters_barr.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Competitions 4 | # Retired 5 | class WsbaMastersBarr < WsbaBarr 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/discipline_alias.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Alternate names for Discipline 4 | class DisciplineAlias < ApplicationRecord 5 | belongs_to :discipline 6 | end 7 | -------------------------------------------------------------------------------- /app/models/duplicate.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Store Person attributes after import and manually resolve duplicates. 4 | # +new_record+ and +attributes+ are somewhat redundant 5 | class Duplicate < ApplicationRecord 6 | serialize :new_attributes 7 | validates :new_attributes, presence: true 8 | 9 | has_and_belongs_to_many :people 10 | 11 | def new_attributes=(value) 12 | self[:new_attributes] = value.compact 13 | end 14 | 15 | def person 16 | @person ||= Person.new(new_attributes) 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/models/event_observer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Trigger changes to CombinedTimeTrialResults and update parent updated_at if child saved 4 | class EventObserver < ActiveRecord::Observer 5 | def after_save(event) 6 | Result.where(event_id: event.id).update_all( 7 | event_full_name: event.full_name, 8 | event_date_range_s: event.date_range_s, 9 | event_end_date: event.end_date, 10 | date: event.date 11 | ) 12 | 13 | event.parent.try :update_date 14 | 15 | true 16 | end 17 | 18 | def around_destroy(event) 19 | yield 20 | event.parent.try :update_date 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/models/home.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Home < ApplicationRecord 4 | belongs_to :photo, optional: true 5 | 6 | def self.current 7 | Home.first || Home.create! 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/import_file.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # audit of source file for results and membership uploads 4 | class ImportFile < ApplicationRecord 5 | validates :name, presence: true 6 | end 7 | -------------------------------------------------------------------------------- /app/models/name_observer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class NameObserver < ActiveRecord::Observer 4 | def after_create(name) 5 | case name.nameable 6 | when Person 7 | name.nameable.results.each do |result| 8 | result.cache_attributes! :non_event if result[:name] != name.nameable.name(result.year) 9 | end 10 | when Team 11 | name.nameable.results.each do |result| 12 | result.cache_attributes! :non_event if result[:team_name] != name.nameable.name(result.year) 13 | end 14 | end 15 | true 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/models/notifier.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Password reset instructions email 4 | class Notifier < ApplicationMailer 5 | def password_reset_instructions(people) 6 | @edit_password_reset_urls = people.map { |person| edit_password_reset_url(person.perishable_token, host: RacingAssociation.current.rails_host) } 7 | @people = people 8 | 9 | mail( 10 | subject: "Password Reset Instructions", 11 | from: "#{RacingAssociation.current.short_name} <#{RacingAssociation.current.email}>", 12 | to: people.first.email_with_name 13 | ) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/models/number_issuer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Any 'party' that issues a set of numbers. Usually, this is the racing Association, 4 | # but large events like stage races have their own set of numbers, as do 5 | # series like the Cross Crusade 6 | class NumberIssuer < ApplicationRecord 7 | validates :name, presence: true 8 | 9 | has_many :race_numbers 10 | 11 | def association? 12 | name == RacingAssociation.current.short_name 13 | end 14 | 15 | def to_s 16 | "#" 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/models/pages/constraint.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Pages 4 | class Constraint 5 | def matches?(request) 6 | Page.exists? path: Page.normalize_path(request.path) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/people/gender.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module People 4 | module Gender 5 | extend ActiveSupport::Concern 6 | 7 | def female? 8 | gender == "F" 9 | end 10 | 11 | def male? 12 | gender == "M" 13 | end 14 | 15 | def non_binary? 16 | gender == "NB" 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/person_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PersonMailer < ApplicationMailer 4 | def new_login_confirmation(person) 5 | @person = person 6 | 7 | mail( 8 | to: person.email, 9 | from: "#{RacingAssociation.current.short_name} Help <#{RacingAssociation.current.email}>", 10 | subject: "New #{RacingAssociation.current.short_name} Login" 11 | ) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/models/person_observer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PersonObserver < ActiveRecord::Observer 4 | def after_destroy(person) 5 | Result.where(person_id: person.id).update_all( 6 | person_id: nil, 7 | name: nil, 8 | first_name: nil, 9 | last_name: nil 10 | ) 11 | true 12 | end 13 | 14 | def around_update(person) 15 | if person.first_name_changed? || person.last_name_changed? 16 | person.results.each do |result| 17 | result.cache_attributes!(:non_event) if result[:name] != person.name(result.year) 18 | end 19 | end 20 | 21 | yield 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/models/person_session.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Login session 4 | class PersonSession < Authlogic::Session::Base 5 | remember_me true 6 | remember_me_for 2.weeks 7 | end 8 | -------------------------------------------------------------------------------- /app/models/photo.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Photo < ApplicationRecord 4 | include Photos::Dimensions 5 | 6 | mount_uploader :image, ImageUploader 7 | 8 | validates :caption, :image, :height, :width, presence: true 9 | 10 | before_validation :set_title, on: :create 11 | 12 | def set_title 13 | self.title = caption if title.blank? 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/models/photos/dimensions.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Photos 4 | module Dimensions 5 | extend ActiveSupport::Concern 6 | 7 | def landscape? 8 | if height && width 9 | height <= width 10 | else 11 | false 12 | end 13 | end 14 | 15 | def portrait? 16 | if height && width 17 | height > width 18 | else 19 | false 20 | end 21 | end 22 | 23 | def widescreen? 24 | if height && width 25 | width.to_f / height >= 1.37 26 | else 27 | false 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /app/models/race_observer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RaceObserver < ActiveRecord::Observer 4 | def after_update(race) 5 | Result.where(race_id: race.id).update_all(race_name: race.name, race_full_name: race.full_name) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/region.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Region < ApplicationRecord 4 | include Regions::FriendlyParam 5 | 6 | before_save :set_friendly_param 7 | 8 | def set_friendly_param 9 | self.friendly_param = to_param 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/models/regions/friendly_param.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Regions 4 | module FriendlyParam 5 | extend ActiveSupport::Concern 6 | 7 | def to_param 8 | name&.downcase&.gsub(/\W/, " ")&.strip&.gsub(/ +/, " ")&.tr(" ", "-") 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/models/results/row_mapper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Results 4 | class RowMapper 5 | def map(array) 6 | Hash[*array] 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/models/sanctioned.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Sanctioned 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | validate :inclusion_of_sanctioned_by 8 | 9 | scope :default_sanctioned_by, lambda { 10 | where sanctioned_by: RacingAssociation.current.default_sanctioned_by 11 | } 12 | end 13 | 14 | def inclusion_of_sanctioned_by 15 | if sanctioned_by && RacingAssociation.current.sanctioning_organizations.exclude?(sanctioned_by) 16 | errors.add :sanctioned_by, "'#{sanctioned_by}' must be in #{RacingAssociation.current.sanctioning_organizations.join(', ')}" 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/models/series.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # MultiDayEvent with events on several, non-contiguous days 4 | # 5 | # This class doesn't add any special behavior to MultiDayEvent, but it is 6 | # convential to separate events like stage races from series like the 7 | # Cross Crusade 8 | class Series < MultiDayEvent 9 | end 10 | -------------------------------------------------------------------------------- /app/models/team_observer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class TeamObserver < ActiveRecord::Observer 4 | def after_destroy(team) 5 | Result.where(team_id: team.id).update_all(team_id: nil, team_name: nil, team_member: false) 6 | end 7 | 8 | def around_update(team) 9 | member_changed = team.member_from_changed? || team.member_to_changed? 10 | name_changed = team.name_changed? 11 | 12 | yield 13 | 14 | if member_changed 15 | Result.where(team_id: team.id).update_all(team_member: team.member?) 16 | end 17 | 18 | if name_changed 19 | Result.where(team_id: team.id, year: RacingAssociation.current.year).update_all(team_name: team.name) 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/models/velodrome.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Member velodromes. Only used by ATRA, and not sure they use it any more. 4 | class Velodrome < ApplicationRecord 5 | validates :name, presence: true 6 | validates :name, uniqueness: { case_sensitive: false } 7 | end 8 | -------------------------------------------------------------------------------- /app/views/admin/aliases/destroy.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#alias_<%= @alias.id %>').effect('puff', {}, 2000); 2 | -------------------------------------------------------------------------------- /app/views/admin/categories/index.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#category_<%= @category.id %>_children').html("<%= escape_javascript(render(@category.children.sort_by(&:name))) %>"); 2 | -------------------------------------------------------------------------------- /app/views/admin/categories/update.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('.category').removeClass('hovering'); 2 | jQuery('#category_<%= @category.id %>_row').fadeOut(); 3 | jQuery('#category_<%= @category.id %>_row').remove(); 4 | 5 | <% if @category.parent && @category.parent.name != RacingAssociation.current.short_name %> 6 | jQuery('#category_<%= @category.parent_id %>_row').html('<%= escape_javascript(render("category", category: @category.parent)) %>'); 7 | jQuery('#category_<%= @category.parent_id %>_row').effect("highlight", {}, 3000); 8 | <% else %> 9 | jQuery('#category_<%= @category.parent_id %>_row').html("<%= escape_javascript(render(@children.sort_by(&:name))) %>"); 10 | <% end %> 11 | 12 | bindCategoryEvents(); 13 | -------------------------------------------------------------------------------- /app/views/admin/events/destroy.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#event_<%= @event.id %>_row').effect('puff', {}, 2000); 2 | jQuery.hide('#warn'); 3 | jQuery.show('#notice'); 4 | jQuery('notice_span').html('Deleted <%= @event.name %>'); 5 | -------------------------------------------------------------------------------- /app/views/admin/events/destroy_error.js.erv: -------------------------------------------------------------------------------- 1 | page.show "warn" 2 | page.hide "notice" 3 | page["warn_span"].replace_html "Could not delete #{@event.name}: #{@event.errors.full_messages}" 4 | -------------------------------------------------------------------------------- /app/views/admin/events/destroy_races.js.erb: -------------------------------------------------------------------------------- 1 | <% @races.each do |race| %> 2 | jQuery('#race_<%= race.id %>_row').effect('puff', {}, 200); 3 | <% end %> 4 | 5 | jQuery('#update_races_progress').fadeOut(100); 6 | jQuery("#warn").hide(); 7 | jQuery('#notice').show(); 8 | 9 | jQuery('#notice_span').html('Deleted races'); 10 | -------------------------------------------------------------------------------- /app/views/admin/pages/_page.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag :tr, id: "page_#{page.id}_row" do %> 2 | 3 | <%= editable page, :title %> 4 | 5 | <%= updated page %> 6 | 7 | 8 | <%= link_to "Add Child", new_admin_page_path(page: { parent_id: page.id }) %> 9 | <%= link_to "Edit", edit_admin_page_path(page) %> 10 | 11 | <% end -%> 12 | 13 | <%= render page.children %> 14 | -------------------------------------------------------------------------------- /app/views/admin/pages/index.html.erb: -------------------------------------------------------------------------------- 1 |

Pages

2 | 3 | <%= table class: "pages", id: :pages, collection: @pages, columns: 4 do %> 4 | 5 | 6 | 7 | Title 8 | Updated 9 |   10 | 11 | 12 | 13 | <%= render @pages %> 14 | 15 | <% end -%> 16 | 17 |
18 |
19 | <%= link_to new_admin_page_path, class: "btn btn-default", id: "new_page" do %> 20 | New Page 21 | <% end %> 22 |
23 |
24 | -------------------------------------------------------------------------------- /app/views/admin/people/_aliases.html.erb: -------------------------------------------------------------------------------- 1 |

Aliases

2 | <%= table class: "aliases", insert_header: true, columns: 2, collection: @person.aliases do %> 3 | <%- @person.aliases.sort_by(&:name).each do |name_alias| -%> 4 | 5 | <%= name_alias.name %> 6 | 7 | <%= link_to( 8 | admin_person_alias_path(@person, name_alias), 9 | method: "delete", 10 | remote: true, 11 | class: "icon") do %> 12 | 13 | <% end %> 14 | 15 | 16 | <%- end -%> 17 | <% end -%> 18 | -------------------------------------------------------------------------------- /app/views/admin/people/_aliases_cell.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= truncate(person.aliases.collect{ |a| a.name }.join(', '), length: 200) %> 3 | 4 | -------------------------------------------------------------------------------- /app/views/admin/people/_names.html.erb: -------------------------------------------------------------------------------- 1 |

Names

2 | <%= table class: "names", insert_header: true, columns: 2, collection: names do %> 3 | <%- names.sort_by(&:year).reverse.each do |name| -%> 4 | 5 | <%= name.name %> 6 | <%= name.year %> 7 | 8 | <%- end -%> 9 | <% end -%> 10 | -------------------------------------------------------------------------------- /app/views/admin/people/_team.html.erb: -------------------------------------------------------------------------------- 1 | <%= 2 | if person.team_name.blank? 3 | '                         ' 4 | else 5 | person.team_name 6 | end 7 | %> 8 | -------------------------------------------------------------------------------- /app/views/admin/people/endicia.xls.erb: -------------------------------------------------------------------------------- 1 | Name Company Address1 Address2 City State Zip 2 | <%- @people.each do |person| -%> 3 | <%= to_excel person["first_name"] %> <%= to_excel person["last_name"] -%> <%= person["road_number"] -%> <%= !person["card_printed_at"].nil? -%> <%= person["wants_email"] -%> 4 | <%= person["street"] -%> 5 | 6 | <%= to_excel person["city"] -%> 7 | <%= to_excel person["state"] -%> 8 | <%# Last column is slightly different to ensure a line break -%> 9 | <%= person["zip"] %> 10 | <%- end -%> 11 | -------------------------------------------------------------------------------- /app/views/admin/people/index.js.erb: -------------------------------------------------------------------------------- 1 | 11 | 12 | <% if @people.size >= 8 -%> 13 |
More than eight matches
14 | <% end -%> 15 | -------------------------------------------------------------------------------- /app/views/admin/people/index.ppl.erb: -------------------------------------------------------------------------------- 1 | number,last name,first name,team,"category,gender,age" 2 | <%- for person in @people -%> 3 | <%= ppl_escape(person["road_number"]) %>,<%= ppl_escape(person["last_name"]) %>,<%= ppl_escape(person["first_name"]) %>,<%= ppl_escape(person["team_name"]) %>,"<%= ppl_escape(person["road_category"]) %>,<%= person["gender"] -%>,<%= person["racing_age"] %>" 4 | <%- end -%> 5 | -------------------------------------------------------------------------------- /app/views/admin/people/merge.js.erb: -------------------------------------------------------------------------------- 1 | <% if @merged %> 2 | jQuery('#person_<%= @other_person.id %>_row').remove(); 3 | jQuery('#person_<%= @person.id %>_aliases').html('<%= escape_javascript(render('aliases_cell', person: @person)) %>'); 4 | if (jQuery('tr[data-name="<%= @person.name.downcase %>"]').length == 1) { 5 | jQuery('tr[data-name="<%= @person.name.downcase %>"]').remove(); 6 | } 7 | <%= flash_js "notice", "Merged #{@other_person.name} into #{@person.name}" %> 8 | <% else %> 9 | <%= flash_js "warn", "Could not merge #{@other_person.name} into #{@person.name}" %> 10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/admin/people/no_cards.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = 'Admin: People: Cards' %> 2 | 3 |
4 | No people need cards printed. 5 |
6 | -------------------------------------------------------------------------------- /app/views/admin/people/number_year_changed.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#numbers-span').html( 2 | '<%= escape_javascript(render( 3 | "admin/people/numbers", 4 | year: @year.to_i, years: @years, person: @person, race_numbers: @race_numbers)) 5 | %>' 6 | ); 7 | bindNumberYearChange(); 8 | -------------------------------------------------------------------------------- /app/views/admin/posts/_post.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= post.date.to_s :short %> 4 | 5 | <%= link_to post.subject, edit_admin_mailing_list_post_path(post.mailing_list, post) %> 6 | 7 | <%= mail_to post.from_email, post.from_name %> 8 | 9 | <%= link_to "Edit", edit_admin_mailing_list_post_path(post.mailing_list, post)%> 10 | <%= link_to "Delete", admin_mailing_list_post_path(post.mailing_list, post), method: :delete, class: "btn btn-default btn-sm", id: "delete" %> 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/views/admin/race_numbers/destroy.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#number_<%= @race_number.id %>_row').remove(); 2 | -------------------------------------------------------------------------------- /app/views/admin/races/_results.html.erb: -------------------------------------------------------------------------------- 1 | <%= table class: "results", id: :results do %> 2 | 3 | <% results_table_for_race.columns.each do |column| %> 4 | <%= column.render %> 5 | <% end %> 6 | 7 | 8 | <% results_table_for_race.rows.each do |row| %> 9 | <%= render "admin/races/result", row: row, result: row.source %> 10 | <% end %> 11 | <%= render "admin/races/result", row: Tabular::Row.new(results_table_for_race), result: race.results.build %> 12 | <% end unless race.new_record? -%> 13 | -------------------------------------------------------------------------------- /app/views/admin/races/create.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('<%= escape_javascript(render("admin/races/race", race: @race)) %>').insertBefore('#create_race_row'); 2 | makeEditable(); 3 | jQuery('#race_<%= @race.id %>_row .race .editable').click(); 4 | -------------------------------------------------------------------------------- /app/views/admin/races/create_result.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#results_table').html('<%= escape_javascript(edit_results_table(@race)) %>'); 2 | -------------------------------------------------------------------------------- /app/views/admin/races/destroy.js.erb: -------------------------------------------------------------------------------- 1 | <% if @destroyed %> 2 | jQuery('#race_<%= @race.id %>_row').hide('fade'); 3 | jQuery('#warn').hide(); 4 | jQuery('#notice').show(); 5 | jQuery('#notice_span').html('Deleted <%= @race.name %>'); 6 | <% else %> 7 | jQuery('#warn').hide(); 8 | jQuery('#notice').show(); 9 | jQuery('#notice_span').html('Could not delete <%= @race.name %>. It may have results.'); 10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/admin/races/destroy_result.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#results_table').html('<%= escape_javascript(edit_results_table(@race)) %>'); 2 | -------------------------------------------------------------------------------- /app/views/admin/races/propagate.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#update_races_progress').hide(); 2 | jQuery('#propagate_races').show(); 3 | alert('Added all race categories from <%= @event.full_name %> to <%= pluralize @event.children.count, "child" %>'); 4 | -------------------------------------------------------------------------------- /app/views/admin/races_collections/edit.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('div#races_collection').replaceWith("<%= escape_javascript(render "edit", races_collection: @races_collection) %>"); 2 | jQuery('#races_collection_text').focus(); 3 | -------------------------------------------------------------------------------- /app/views/admin/races_collections/show.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('div#races_collection').replaceWith("<%= escape_javascript(render "show", event: @event, previous: @previous) %>"); 2 | -------------------------------------------------------------------------------- /app/views/admin/results/_people.html.erb: -------------------------------------------------------------------------------- 1 |

People

2 | <%= table do %> 3 | <%- people.each do |person| -%> 4 | 5 | <%= link_to( 6 | person.name, 7 | admin_person_results_path(person, format: "js"), 8 | class: "find_person", 9 | remote: true) 10 | %> 11 |
12 | <%= [ person.team.blank? ? nil : person.team.name, person.city, person.racing_age ].compact.join(', ') %> 13 | 14 | 15 | <%- end -%> 16 | <% end -%> 17 | 18 | <%= javascript_tag do %> 19 | $('.find_person').bind('ajax:beforeSend', function() { 20 | $('#right_person').fadeTo(3000, 0.2); 21 | $('#find_progress_icon').show(); 22 | }) 23 | <% end -%> 24 | -------------------------------------------------------------------------------- /app/views/admin/results/add_score.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('<%= escape_javascript(render(@scores)) %>').insertAfter('result_<%= params[:id] %>_row'); 2 | -------------------------------------------------------------------------------- /app/views/admin/results/create.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#results_table').html('<%= escape_javascript(edit_results_table(@race)) %>'); 2 | -------------------------------------------------------------------------------- /app/views/admin/results/destroy.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#result_<%= @result.id %>_row').remove(); 2 | -------------------------------------------------------------------------------- /app/views/admin/results/index.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#right_person').html('<%= escape_javascript(render("person", person: @person, results: @results)) %>'); 2 | jQuery('#right_person').stop(); 3 | jQuery('#right_person').fadeIn("fast", 1); 4 | $('#right_person tr:last-child td').height($('#left_person table').height() - $('#right_person table').height()); 5 | jQuery('#find_progress_icon').hide(); 6 | -------------------------------------------------------------------------------- /app/views/admin/results/move.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('#result_<%= @result.id %>_row').remove(); 2 | jQuery('<%= escape_javascript(render('admin/results/result', result: @result)) %>').insertAfter('#person_<%= @person.id %>_table tr:first-child'); 3 | jQuery('#people').fadeTo("fast", 1); 4 | jQuery('#find_progress_icon').hide(); 5 | -------------------------------------------------------------------------------- /app/views/admin/results/scores.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('<%= escape_javascript(render(@scores.sort)) %>').insertAfter('#result_<%= @result.id %>_row'); 2 | -------------------------------------------------------------------------------- /app/views/admin/scores/_score.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= score.source_result.place %> 4 | 5 |
<%= score.source_result.event.name %>
6 | 7 | <%= score.source_result.race.name %> 8 | <%= score.source_result.event.date.strftime("%D") %> 9 | <%= number_with_precision(score.points, precision: 0) %> 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/views/admin/teams/_aliases.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= truncate(team.aliases.map(&:name).join(", "), length: 200) %> 3 | 4 | -------------------------------------------------------------------------------- /app/views/admin/teams/destroy_name.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('name_<%= @name_id %>').effect('puff', {}, 2000); 2 | -------------------------------------------------------------------------------- /app/views/admin/teams/index.js.erb: -------------------------------------------------------------------------------- 1 | 7 | 8 | <% if @teams.size >= 8 -%> 9 |
More than eight matches
10 | <% end -%> 11 | -------------------------------------------------------------------------------- /app/views/admin/teams/merge.js.erb: -------------------------------------------------------------------------------- 1 | <% if @merged %> 2 | jQuery('#team_<%= @other_team.id %>_row').remove(); 3 | jQuery('#team_<%= @team.id %>_aliases').html('<%= escape_javascript(render('aliases', team: @team)) %>'); 4 | <%= flash_js "notice", "Merged #{@other_team.name} into #{@team.name}" %> 5 | <% else %> 6 | <%= flash_js "warn", "Could not merge #{@other_team.name} into #{@team.name}" %> 7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/views/admin/velodromes/_velodrome.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag :tr, id: "velodrome_#{velodrome.id}_row" do %> 2 | 3 | 4 | <%= editable velodrome, :name %> 5 | 6 | 7 | <%= editable velodrome, :website %> 8 | 9 | 10 | <%= link_to "Edit", edit_admin_velodrome_path(velodrome), id: "edit_#{velodrome.id}" %> 11 | 12 | <% end -%> 13 | -------------------------------------------------------------------------------- /app/views/article_categories/_article.html.erb: -------------------------------------------------------------------------------- 1 |

<%= link_to article.title, article %>

2 |

<%= truncate(article.body, length: 800, separator: ' ').html_safe %> 3 | <% 4 | if article.body.length > 800 5 | %> 6 |  <%= link_to "more", article %> 7 | <% 8 | end 9 | %> 10 |

11 | -------------------------------------------------------------------------------- /app/views/article_categories/show.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "#{@article_category.name.capitalize}" %> 2 | 3 | <% if @article_categories.present? && @article_category.articles.present? %> 4 |

General

5 | <% end %> 6 | 7 | <%= render partial: "article", collection: @article_category.articles %> 8 | 9 | <% 10 | @article_categories.each do |article_category| 11 | if article_category.articles.any? 12 | %> 13 |

<%= article_category.name %>

14 | <%= render partial: "article", collection: article_category.articles %> 15 | <% 16 | end 17 | end 18 | %> 19 | -------------------------------------------------------------------------------- /app/views/articles/show.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Article #{@article.title}" %> 2 | 3 |

<%= @article.title.html_safe %>

4 |

<%= @article.body.html_safe %>

5 |

(last update: <%=h @article.updated_at.to_formatted_s(:short) %>)

6 | -------------------------------------------------------------------------------- /app/views/calculations/_calculation.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= link_to calculation.name, calculation_path(calculation) %> 4 | 5 | 6 | <%= link_to "Rules", calculation_path(calculation) %> 7 | 8 | 9 | <%= link_to("Categories", calculations_event_categories_path(event_id: calculation.event_id)) if calculation.event_id %> 10 | 11 | 12 | <%= link_to("Results", calculations_event_results_path(event_id: calculation.event_id)) if calculation.event_id %> 13 | 14 | 15 | <%= link_to("Edit", edit_calculation_path(calculation)) if administrator? %> 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/views/calculations/_calculations_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= calculations_event.event.date_range_s %> 4 | 5 | 6 | <%= calculations_event.event.name %> 7 | 8 | <%= calculations_event.multiplier %> 9 | 10 | -------------------------------------------------------------------------------- /app/views/calculations/_category_rule.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= category_rule.name %> 4 | 5 | <%= category_rule.maximum_events %> 6 | <%= category_rule.mappings.map(&:category).map(&:name).sort.join(", ") %> 7 | 8 | -------------------------------------------------------------------------------- /app/views/calculations/_editable_calculation_category.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= f.text_field :name %> 4 | 5 | <%= f.text_field :maximum_events %> 6 | <%= f.check_box :reject %> 7 | 8 | -------------------------------------------------------------------------------- /app/views/calculations/_editable_calculations_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= f.object.event&.date_range_s %> 4 | 5 | 6 | <%= f.object.event&.name %> 7 | 8 | <%= f.object.multiplier %> 9 | 10 | <%# TOOD: Remove safe nav. Why is there a calc event without an event? %> 11 | -------------------------------------------------------------------------------- /app/views/calculations/_editable_category_category.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= editable_category_category.text_field :name %> 4 | 5 | <%= editable_category_category.text_field :maximum_events %> 6 | <%= editable_category_category.check_box :reject %> 7 | 8 | -------------------------------------------------------------------------------- /app/views/calculations/_group_events.html.erb: -------------------------------------------------------------------------------- 1 | <%- if calculation&.group_event_keys.present? -%> 2 | <%= tabs(calculation.key) do |tabs| 3 | calculation.group_event_keys.sort.each do |key| 4 | tabs.add( 5 | key.to_s.titleize, 6 | friendly_calculation_path(key: key, year: calculation.year) 7 | ) 8 | end 9 | end -%> 10 | <%- end -%> 11 | -------------------------------------------------------------------------------- /app/views/calculations/_rejected_category_rule.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= rejected_category_rule.name %> 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/views/calculations/_years.html.erb: -------------------------------------------------------------------------------- 1 | <%- if calculation&.years&.many? -%> 2 | <%= tabs(calculation.year) do |tabs| 3 | calculation.years.sort.reverse.each do |year| 4 | tabs.add( 5 | year.to_s.titleize, 6 | friendly_calculation_path(calculation.key, year) 7 | ) 8 | end 9 | end -%> 10 | <%- end -%> 11 | -------------------------------------------------------------------------------- /app/views/calculations/results/_calculation.html.erb: -------------------------------------------------------------------------------- 1 | <% if calculation %> 2 |
3 | <%= link_to "Rules", calculation_path(calculation) %> 4 | <% if calculation.event_id %> 5 | | <%= link_to("Categories", calculations_event_categories_path(event_id: calculation.event_id)) %> 6 | | <%= link_to("Scoring Results", event_results_path(event_id: calculation.event_id)) %> 7 | <% end %> 8 |
9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/calculations/results/_notes.html.erb: -------------------------------------------------------------------------------- 1 | <%- if event.notes.present? -%> 2 | <%= tag.div class: notes_class(event) do -%> 3 | <%= event.notes.html_safe -%> 4 | <%- end -%> 5 | <%- end -%> 6 | -------------------------------------------------------------------------------- /app/views/calculations/results/_races.html.erb: -------------------------------------------------------------------------------- 1 | <% if races.many? %> 2 |
3 | 4 | 5 | <%- races.sort.each_row do |first_race, second_race| -%> 6 | 7 | <%= tag.td class: :race do %> 8 | <%= link_to first_race.name, "#race_#{first_race.id}" %> 9 | <% end %> 10 | <%= tag.td class: :race do %> 11 | <%- if second_race -%> 12 | <%= link_to second_race.name, "#race_#{second_race.id}" %> 13 | <% end %> 14 | <% end %> 15 | 16 | <%- end -%> 17 | 18 |
19 |
20 | <%- end -%> 21 | -------------------------------------------------------------------------------- /app/views/categories/_category.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= link_to show_whitespace(category.name), category_races_path(category) %> 3 | <%= category.abilities %> 4 | <%= category.ages %> 5 | <%= category.gender %> 6 | <%= category.equipment %> 7 | <%= category.weight %> 8 | 9 | -------------------------------------------------------------------------------- /app/views/categories/index.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Categories" %> 2 | 3 |

Categories

4 | 5 | <%= render "shared/search", placeholder: "Search by category name" %> 6 | 7 | <%= will_paginate @categories %> 8 | 9 | <%= table collection: @categories, columns: 2 do %> 10 | 11 | 12 | Name 13 | Ability 14 | Ages 15 | Gender 16 | Equipment 17 | Weight 18 | 19 | 20 | 21 | <%= render @categories %> 22 | 23 | <% end %> 24 | 25 | <%= will_paginate @categories %> 26 | -------------------------------------------------------------------------------- /app/views/competitions/bar/_disciplines.html.erb: -------------------------------------------------------------------------------- 1 | <%= tabs(discipline) do |tabs| 2 | (overall_bar.children + [ overall_bar ]).sort_by(&:name).each do |b| 3 | tabs.add( 4 | b.discipline, 5 | bar_path( 6 | year: b.year, 7 | discipline: Discipline[b.discipline], 8 | category: race.try(:category_friendly_param) 9 | ) 10 | ) 11 | end 12 | end if overall_bar -%> 13 | -------------------------------------------------------------------------------- /app/views/competitions/bar/_years.html.erb: -------------------------------------------------------------------------------- 1 | <%= tabs(year) do |tabs| 2 | years = Event.find_all_years << RacingAssociation.current.effective_year << year 3 | 4 | years.uniq.sort.reverse.each do |y| 5 | tabs.add( 6 | y, 7 | bar_path(year: y, category: race.try(:category_friendly_param), discipline: Discipline[race.try(:discipline)]) 8 | ) 9 | end 10 | end -%> 11 | -------------------------------------------------------------------------------- /app/views/competitions/ironman/index.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Ironman: #{@year}" %> 2 | 3 | <% cache cache_key(@year, @ironman, page) do %> 4 | <%= tabs(@year) do |tabs| 5 | @years.each do |year| 6 | tabs.add year, ironman_path(year) 7 | end 8 | end %> 9 | 10 |

<%= @ironman.date.year %> Ironman

11 | 12 |

<%= @ironman.notes %>

13 | 14 | <% if @ironman.updated_at %> 15 |

Updated <%= @ironman.updated_at.to_s(:long) %>

16 | <% end %> 17 | 18 | <%= will_paginate @results %> 19 | 20 | <%= results_table @ironman, @ironman.races.first, @results %> 21 | 22 | <%= will_paginate @results %> 23 | <% end %> 24 | -------------------------------------------------------------------------------- /app/views/duplicate_people/destroy.js.erb: -------------------------------------------------------------------------------- 1 | jQuery('tr[data-name="<%= @name.downcase %>"]').remove(); 2 | -------------------------------------------------------------------------------- /app/views/editor_request_mailer/editor_request.text.erb: -------------------------------------------------------------------------------- 1 | Hi <%= @editor_request.person.name %>, 2 | 3 | <%= @editor_request.editor.name %> would like access to your <%= RacingAssociation.current.name %> account. 4 | 5 | If that's OK with you, please click this link: 6 | <%= link_to @edit_url, @edit_url %> 7 | 8 | If the link does not work, try copying and pasting it into your browser. 9 | If it still doesn't work, please contact <%= mail_to RacingAssociation.current.email %>. 10 | 11 | If you do want <%= @editor_request.editor.name %> to have access to your <%= RacingAssociation.current.name %> account, please ignore this email. 12 | -------------------------------------------------------------------------------- /app/views/editor_request_mailer/notification.text.erb: -------------------------------------------------------------------------------- 1 | Hi <%= @editor_request.editor.name %>, 2 | 3 | <%= @editor_request.person.name %> has granted you access to their <%= RacingAssociation.current.name %> account: 4 | 5 | <%= link_to @edit_url, @edit_url %> 6 | 7 | If the link does not work, try copying and pasting it into your browser. 8 | If it still doesn't work, please contact <%= mail_to RacingAssociation.current.email %>. 9 | -------------------------------------------------------------------------------- /app/views/editor_requests/show.html.erb: -------------------------------------------------------------------------------- 1 |

Thank you. <%= @editor_request.editor.name %> now has access to your account.

2 | 3 |

4 | <%= link_to "Your account", "/account" %> | <%= link_to "#{RacingAssociation.current.name} homepage", "/" %> 5 |

6 | -------------------------------------------------------------------------------- /app/views/errors/internal_server_error.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "We're sorry, but something went wrong (500)" %> 2 | 3 |
4 |
5 |
6 |
7 |
8 | We're sorry, but something went wrong. We've been notified it and we'll take a look at it shortly. 9 |
10 |
11 |
12 |
13 | 14 | <%= image_tag "photos/500.jpg", class: "center-block" %> 15 | 16 |

Photo: Cheryl J. Willson

17 |
18 | -------------------------------------------------------------------------------- /app/views/errors/over_capacity.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "We're sorry, but we're over capacity (503)" %> 2 | 3 |
4 |
5 |
6 |
7 |
8 | We're sorry, but we're over capacity. Please try back again in a few minutes. 9 |
10 |
11 |
12 |
13 | 14 | <%= image_tag "photos/503.jpg", class: "center-block" %> 15 | 16 |

Photo: Cheryl J. Willson

17 |
18 | -------------------------------------------------------------------------------- /app/views/errors/unauthorized.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Unauthorized (401)" %> 2 | 3 |
4 |
5 |
6 |
7 |
8 | You do not have access to this page. 9 |
10 |
11 |
12 | 13 |
14 |
15 | <%= image_tag "photos/422.jpg", class: "hero-photo img-responsive center-block" %> 16 |

Photo: Cheryl J. Willson

17 |
18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /app/views/errors/unprocessable_entity.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "The change you wanted was rejected (422)" %> 2 | 3 |
4 |
5 |
6 |
7 |
8 | The change you wanted was rejected. Maybe you tried to change something you didn't have access to. 9 |
10 |
11 |
12 |
13 | 14 | <%= image_tag "photos/422.jpg", class: "center-block" %> 15 | 16 |

Photo: Cheryl J. Willson

17 |
18 | -------------------------------------------------------------------------------- /app/views/event_teams/no_event_teams.html.erb: -------------------------------------------------------------------------------- 1 |

2 | You can't join a team for the <%= @event.full_name %> online. 3 | <%= link_to "Back to schedule", schedule_path, class: "obvious" %> 4 |

5 | -------------------------------------------------------------------------------- /app/views/events/_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%- if administrator? || Event.editable_by(current_person).include?(event) -%> 3 | <%= link_to event.date.to_s(:long), edit_admin_event_path(event) %> 4 | <%= link_to event.name, edit_admin_event_path(event) %> 5 | <% else -%> 6 | <%= link_to event.date.to_s(:long), event_path(event) %> 7 | <%= link_to event.name, event_path(event) %> 8 | <% end -%> 9 | 10 | -------------------------------------------------------------------------------- /app/views/events/index.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "#{@person.name}: Events" %> 2 | <% @show_tabs = (promoter? || administrator?) -%> 3 | 4 |
5 |
6 |

Promoted Events

7 | <%= table columns: 2, collection: @events do %> 8 | 9 | 10 | Date 11 | Name 12 | 13 | 14 | 15 | <%= render partial: "event", collection: @events.sort_by(&:date) %> 16 | 17 | <% end -%> 18 |
19 |
20 | -------------------------------------------------------------------------------- /app/views/home/_ads.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/views/home/_ads.html.erb -------------------------------------------------------------------------------- /app/views/home/_associated.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/views/home/_associated.html.erb -------------------------------------------------------------------------------- /app/views/home/_links.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/views/home/_links.html.erb -------------------------------------------------------------------------------- /app/views/home/_most_recent_event_with_recent_result.html.erb: -------------------------------------------------------------------------------- 1 | <% if event %> 2 |

<%= link_to event.full_name, event_results_path(event) %> Winners

3 | 4 | 5 | 6 | <% event.races_with_results.sort_by(&:name)[0, 12].each do |race| %> 7 | 8 | 9 | 10 | 11 | <% end %> 12 | 13 | 14 | 15 | 16 |
<%= link_to race.name, event_results_path(event, anchor: "race_#{race.id}") %><%= link_to race.results.sort.first.name, person_results_path(race.results.sort.first.person_id) %>
<%= link_to("More …".html_safe, schedule_path) %>
17 | <% end %> 18 | -------------------------------------------------------------------------------- /app/views/home/_photo.html.erb: -------------------------------------------------------------------------------- 1 | <% if photo.link.present? %> 2 | <%= link_to photo.link do %> 3 | <%= image_tag photo.image.desktop.url, title: photo.title, class: "hero-photo img-responsive center-block" %> 4 | <% end %> 5 | <% else %> 6 | <%= image_tag photo.image.desktop.url, title: photo.title, class: "hero-photo img-responsive center-block" %> 7 | <% end %> 8 | 9 | <% if photo.caption.present? %> 10 | <%= markdown photo.caption %> 11 | <% end %> 12 | -------------------------------------------------------------------------------- /app/views/layouts/_flash_message.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | <%= message %> 6 |
7 |
8 |
9 | -------------------------------------------------------------------------------- /app/views/layouts/_javascripts.html.erb: -------------------------------------------------------------------------------- 1 | <%= javascript_include_tag "application" %> 2 | <%= javascript_include_tag Ckeditor.cdn_url %> 3 | <%= render "layouts/registration_engine/javascripts" %> 4 | -------------------------------------------------------------------------------- /app/views/layouts/_stylesheets.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= stylesheet_link_tag "application", media: "all" %> 6 | <%= stylesheet_link_tag "registration_engine/application" %> 7 | -------------------------------------------------------------------------------- /app/views/mailing_lists/_links.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 11 |
12 | -------------------------------------------------------------------------------- /app/views/mailing_lists/confirm.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Mailing Lists: #{@mailing_list.friendly_name}" %> 2 | 3 |
4 |

Your new post is now in the mailing queue. What happens next:

5 | 13 |
14 | 15 | <%= render("mailing_lists/links", mailing_list: @mailing_list) %> 16 | -------------------------------------------------------------------------------- /app/views/mailing_lists/confirm_private_reply.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Mailing Lists: #{@mailing_list.friendly_name}: Reply Sent" %> 2 | 3 |
4 |

Your reply has been sent

5 |
6 | 7 | <%= render("mailing_lists/links", mailing_list: @mailing_list) %> 8 | -------------------------------------------------------------------------------- /app/views/mailing_lists/index.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Mailing Lists" %> 2 | 3 | <%= link_to "New list at Google Groups", "https://groups.google.com/a/obra.org/forum/#!forum/obra-chat" %> 4 | -------------------------------------------------------------------------------- /app/views/memberships/show.html.erb: -------------------------------------------------------------------------------- 1 |

<% if @person.member? -%> 2 | Your membership runs from <%= @person.member_from.to_s(:long) %> to <%= @person.member_to.to_s(:long) %> 3 | <%- else -%> 4 | You are not a member 5 | <%- end -%>

6 | 7 | 11 | -------------------------------------------------------------------------------- /app/views/password_resets/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "New Password" %> 2 | <% @show_tabs = false %> 3 | 4 | <%= render "shared/errors", object: @person %> 5 | 6 |

<%= @person.name %>

7 | 8 | <%= form_for :person, url: password_reset_path, method: :patch do |f| %> 9 |
10 |
11 |
12 | <%= f.labelled_password_field :password, "New Password", class: "col-sm-12 wants_focus" %> 13 |
14 |
15 |
16 |
17 |
<%= submit_tag "Save", class: "btn btn-default", id: "save" %>
18 |
19 | <% end %> 20 | -------------------------------------------------------------------------------- /app/views/people/_disciplines.html.erb: -------------------------------------------------------------------------------- 1 | <%# Placeholder %> 2 | -------------------------------------------------------------------------------- /app/views/people/_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= link_to event.date.to_s(:long), edit_admin_event_path(event) %> 3 | <%= link_to event.name, edit_admin_event_path(event) %> 4 | 5 | -------------------------------------------------------------------------------- /app/views/people/_event_team_membership.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= link_to event_team_membership.event.name, event_path(event_team_membership.event) %> 3 | <%= link_to event_team_membership.team.name, team_path(event_team_membership.team) %> 4 | 5 | -------------------------------------------------------------------------------- /app/views/people/_event_team_memberships.html.erb: -------------------------------------------------------------------------------- 1 |

Event Teams

2 | <%= table class: "event_teams", collection: event_team_memberships, columns: 2 do %> 3 | 4 | Event 5 | Name 6 | 7 | <%= render partial: "people/event_team_membership", collection: event_team_memberships %> 8 | <% end -%> 9 | -------------------------------------------------------------------------------- /app/views/people/_events.html.erb: -------------------------------------------------------------------------------- 1 | <% if events.present? %> 2 | 3 |

Promoted Events

4 | <%= table class: "promoted_events", collection: events, columns: 2 do %> 5 | 6 | Date 7 | Name 8 | 9 | <%= render partial: "people/event", collection: events %> 10 | <% end -%> 11 | 12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/people/_mailing_lists.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/views/people/_orders.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/views/people/_orders.html.erb -------------------------------------------------------------------------------- /app/views/people/membership.html.erb: -------------------------------------------------------------------------------- 1 | <% if @person.member? -%> 2 |

Your membership runs through <%= @person.member_to.to_s(:long) %>

3 | <%- else -%> 4 |

Your are not a member

5 | <%- end -%> 6 | 7 |

8 | <%= link_to "Your Account", edit_person_path(@person) %> | 9 | <%= link_to "#{RacingAssociation.current.name} Home", root_path %> 10 |

11 | -------------------------------------------------------------------------------- /app/views/person_mailer/new_login_confirmation.html.erb: -------------------------------------------------------------------------------- 1 |

Your new <%= RacingAssociation.current.short_name %> login is ready to go!

2 | 3 |

4 | Login: <%= @person.login %>
5 | <%= link_to "Your account", account_url(host: RacingAssociation.current.rails_host) %> 6 |

7 | 8 |

<%= RacingAssociation.current.short_name %> respects your privacy. Information regarding your personal information can be viewed at http://obra.org/privacy_policy

9 | 10 |

11 | Welcome, <%= @person.name_or_login %> 12 |

13 | -------------------------------------------------------------------------------- /app/views/person_mailer/new_login_confirmation.text.erb: -------------------------------------------------------------------------------- 1 | Your new <%= RacingAssociation.current.short_name %> login is ready to go! 2 | 3 | Login: <%= @person.login %> 4 | Your account: <%= account_url host: RacingAssociation.current.rails_host %> 5 | 6 | <%= RacingAssociation.current.short_name %> respects your privacy. Information regarding your personal information can be viewed at http://obra.org/privacy_policy 7 | 8 | Welcome, <%= @person.name_or_login %> 9 | 10 | -------------------------------------------------------------------------------- /app/views/person_sessions/show.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Logged-in as #{current_person.login}" %> 2 | 3 |

You are logged in as <%= current_person.login %>

4 | 5 | 13 | -------------------------------------------------------------------------------- /app/views/photos/_photo.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag :tr, class: "photo_row", id: "photo_#{photo.id}_row" do %> 2 | 3 | 4 | <%= photo.title %> 5 | 6 | 7 | <%= link_to 'Edit', edit_photo_path(photo), id: "edit_#{photo.id}" %> 8 | 9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/posts/_pagination.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | <%= will_paginate posts, 6 | page_links: false, 7 | previous_label: "← Newer", 8 | next_label: "Older →" %> 9 |
10 |
11 | -------------------------------------------------------------------------------- /app/views/posts/_post.html.erb: -------------------------------------------------------------------------------- 1 | <% cache cache_key(post, current_page) do %> 2 | 3 | 4 | <% if post.replies_count > 0 -%> 5 | <%= link_to post_path(post, page: current_page), class: "image" do %><%= post.replies_count %><% end %> 6 | <% end -%> 7 | 8 | 9 | <%= link_to post.subject, post_path(post, page: current_page) %> 10 | 11 | <%= post.last_reply_from_name || post.from_name %> 12 | <%= link_to last_reply_at(post), post_path(post, page: current_page) %> 13 | 14 | <% end %> 15 | -------------------------------------------------------------------------------- /app/views/posts/index.atom.builder: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | atom_feed do |feed| 4 | feed.title @mailing_list.friendly_name 5 | feed.updated @posts.first.try(:date) 6 | 7 | @posts.each do |post| 8 | feed.entry(post, published: post.date) do |entry| 9 | entry.title post.subject 10 | entry.content post.body 11 | 12 | entry.author do |author| 13 | author.name post.from_email_obscured 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "#{@post.mailing_list.friendly_name}: #{truncate(@post.subject)}" %> 2 |

<%= @post.subject %>

3 | 4 | <%= render "show_pagination", post: @post %> 5 | <% cache cache_key(@post, params[:current_page]) do %> 6 | <%= render collection: @post.replies.sort_by(&:position).reverse.to_a << @post, partial: "posts/reply", locals: { current_page: params[:current_page] } %> 7 | <% end %> 8 | <%= render "show_pagination", post: @post %> 9 | 10 |
11 |
12 | <%= render "mailing_lists/links", mailing_list: @post.mailing_list %> 13 |
14 |
15 | -------------------------------------------------------------------------------- /app/views/racing_associations/_registration_engine.html.erb: -------------------------------------------------------------------------------- 1 | // extension point 2 | -------------------------------------------------------------------------------- /app/views/redirect.js.erb: -------------------------------------------------------------------------------- 1 | document.location = '<%= @redirect_to %>' 2 | -------------------------------------------------------------------------------- /app/views/results/_calculation.html.erb: -------------------------------------------------------------------------------- 1 | <% if calculation %> 2 |
3 | <%= link_to "Rules", calculation_path(calculation) %> | 4 | <%= link_to("Categories", calculations_event_categories_path(event_id: calculation.event_id)) if calculation.event_id %> | 5 | <%= link_to("All Results", calculations_event_results_path(@event)) %> 6 |
7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/views/results/_children.html.erb: -------------------------------------------------------------------------------- 1 | <%- if children.select(&:any_results?).present? -%> 2 |
3 | <%- children.select(&:any_results?).sort.each do |child| -%> 4 | <%= link_to child.name, event_results_path(child), { class: "obvious" } %>
5 | <%- end -%> 6 |
7 | <%- end -%> 8 | -------------------------------------------------------------------------------- /app/views/results/_date_and_parent.html.erb: -------------------------------------------------------------------------------- 1 | <%- if !event.all_year? || event.parent -%> 2 |
3 | <%- unless event.all_year? -%> 4 | <% if event.city_state.present? %> 5 | <%= event.city_state %>. 6 | <%- end -%> 7 | <%- if event.multiple_days? -%> 8 | <%= event.date_range_long_s %> 9 | <%- else -%> 10 | <%= event.date.to_s(:long) %> 11 | <%- end -%> 12 | <%- end -%> 13 | 14 | <%- if event.parent -%> 15 |

Part of the <%= link_to event.parent.name, event_results_path(event.parent) %>

16 | <%- end -%> 17 |
18 | <%- end -%> 19 | -------------------------------------------------------------------------------- /app/views/results/_event_teams.html.erb: -------------------------------------------------------------------------------- 1 | <% if event.event_teams? %> 2 |
3 |
4 | <%= link_to "View Teams", event_event_teams_path(event), class: "obvious" %> | 5 | <%= link_to "Join Team", new_event_event_team_membership_path(event), class: "obvious" %> 6 |
7 |
8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/results/_races.html.erb: -------------------------------------------------------------------------------- 1 | <% if races.select(&:any_results?).select(&:visible?).reject(&:rejected?).many? %> 2 |
3 | 4 | 5 | <%- races.select(&:any_results?).select(&:visible?).reject(&:rejected?).sort.each_row do |first_race, second_race| -%> 6 | 7 | 10 | 13 | 14 | <%- end -%> 15 | 16 |
8 | <%= link_to first_race.name, "#race_#{first_race.id}" %> 9 | 11 | <%= link_to(second_race.name, "#race_#{second_race.id}") if second_race %> 12 |
17 |
18 | <%- end -%> 19 | -------------------------------------------------------------------------------- /app/views/results/_result.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%- result.columns.each do |column| -%> 3 | <%= result.render(column).to_s.html_safe %> 4 | <%- end -%> 5 | 6 | -------------------------------------------------------------------------------- /app/views/results/_start_list.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/app/views/results/_start_list.html.erb -------------------------------------------------------------------------------- /app/views/results/_table.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <% table.columns.each do |column| %> 5 | 6 | <% end %> 7 | 8 | 9 | 10 | <%= render partial: "results/result", collection: table.rows, as: "result" %> 11 | 12 | <%- if table.rows.empty? -%> 13 | 14 | 15 | 16 | <%- end -%> 17 | 18 |
<%= column.render %>
No results
19 | -------------------------------------------------------------------------------- /app/views/results/_years.html.erb: -------------------------------------------------------------------------------- 1 | <%= tabs(year) do |tabs| 2 | years = (RacingAssociation.current.effective_year).downto(2006).to_a << year 3 | years.uniq.sort.reverse.each do |y| 4 | tabs.add(y, url_for(year: y)) 5 | end 6 | end -%> 7 | -------------------------------------------------------------------------------- /app/views/results/event.xlsx.axlsx: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | xlsx_package.workbook.add_worksheet(name: "results.xlsx") do |sheet| 4 | @event.races_with_results.each do |race| 5 | sheet.add_row [race.name] 6 | sheet.add_row(%w[ place name total_points ] + (1..(@event.source_events.size)).to_a) 7 | race.results.sort.each do |result| 8 | sheet.add_row([result.place, result.name, result.points] + result.scores.map(&:points).sort.reverse) 9 | end 10 | sheet.add_row 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/results/index.xml.builder: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | xml.instruct! 4 | cache [@year, @today, @discipline, RacingAssociation.current.updated_at.to_s(:number), false] do 5 | xml.events do 6 | @all_events.each do |event| 7 | xml.event do 8 | xml.id event.id 9 | xml.name event.full_name 10 | xml.date event.date 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/results/team.html.erb: -------------------------------------------------------------------------------- 1 | <% @page_title = "Results: #{@team.name}: #{@year}" %> 2 | 3 | <% cache cache_key(@year, @team) do %> 4 |

<%= @team.name %>

5 | 6 | <%= render_page "years", year: @year %> 7 | 8 | <%= participant_event_results_table @team, @event_results %> 9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/schedule/_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/views/schedule/_others.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/views/schedule/_regions.html.erb: -------------------------------------------------------------------------------- 1 | <% if regions.present? %> 2 | <%= tabs(@region.try(:name) || "All") do |tabs| 3 | tabs.add("All", schedule_path) 4 | regions.each do |r| 5 | tabs.add r.name, schedule_region_path(region: r, year: year) 6 | end 7 | end%> 8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/schedule/_sanctioning_organizations.html.erb: -------------------------------------------------------------------------------- 1 | <% if sanctioning_organizations.any? %> 2 | <%= tabs do |tabs| 3 | tabs.add('All', schedule_path) 4 | sanctioning_organizations.each do |org| 5 | tabs.add(org, schedule_sanctioning_organization_path(org)) 6 | end 7 | end%> 8 | <% end %> 9 | -------------------------------------------------------------------------------- /app/views/schedule/_tabs.html.erb: -------------------------------------------------------------------------------- 1 | <% if RacingAssociation.current.show_calendar_view? -%> 2 | <%= tabs(calendar_tab) do |tabs| 3 | tabs.add("Races", schedule_path) 4 | tabs.add("Races list with contact information", schedule_list_path) 5 | tabs.add("Community", schedule_index_path(discipline: "community", year: RacingAssociation.current.effective_year)) 6 | end -%> 7 | <% end -%> 8 | -------------------------------------------------------------------------------- /app/views/schedule/_tentative.html.erb: -------------------------------------------------------------------------------- 1 | <% if Time.zone.today < Time.zone.local(@year, 2).to_date %> 2 |

Tentative. Dates are subject to change.

3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/schedule/calendar.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/views/schedule/index.atom.builder: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # FIXME: Add promoter contact info 4 | atom_feed do |feed| 5 | feed.title "#{RacingAssociation.current.name} #{@year} Schedule" 6 | now = Time.zone.now.beginning_of_day.to_date 7 | events = @events.select { |e| e.flyer.present? && e.flyer_approved? && e.date >= now } 8 | feed.updated events.map(&:updated_at).max 9 | 10 | events.each do |event| 11 | url = nil 12 | url = event.flyer if event.flyer.present? && event.flyer_approved? 13 | 14 | feed.entry(event, url: url) do |entry| 15 | entry.title event.full_name 16 | entry.content "#{event.discipline} #{event.city_state}" 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/views/schedule/index.xlsx.axlsx: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | xlsx_package.workbook.add_worksheet(name: "schedule.xlsx") do |sheet| 4 | sheet.add_row %w[ id parent_id date name discipline flyer city state promoter_name promoter_phone promoter_email ] 5 | @events.each do |event| 6 | sheet.add_row [ 7 | event.id, 8 | event.parent_id, 9 | event.date.to_s(:db), 10 | event.full_name, 11 | event.discipline, 12 | event.flyer, 13 | event.city, 14 | event.state, 15 | event.promoter_name, 16 | event_phone(event), 17 | event_email(event) 18 | ] 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/views/shared/_city_state_zip.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= f.label :city, "City, State ZIP", class: "control-label col-sm-4" %> 3 |
4 | <%= f.text_field :city, class: "city form-control", maxlength: 30 %> 5 | <%= f.text_field :state, class: "state form-control", maxlength: 10 %> 6 | <%= f.text_field :zip, class: "zip form-control", maxlength: 9 %> 7 |
8 |
9 | -------------------------------------------------------------------------------- /app/views/shared/_disciplines.html.erb: -------------------------------------------------------------------------------- 1 | <% if discipline&.to_param != "community" %> 2 | <%= tabs(discipline.try(:name) || "All") do |tabs| 3 | tabs.add 'All', url_for(discipline: nil, year: year) 4 | Discipline.all 5 | .select { |d| d.to_param.in?(%w{ criterium cyclocross downhill gravel mountain_bike super_d road time_trial track }) } 6 | .sort_by(&:name) 7 | .each do |d| 8 | tabs.add d.name, url_for(discipline: d.to_param, year: year) 9 | end 10 | end %> 11 | <% end %> 12 | -------------------------------------------------------------------------------- /app/views/shared/_errors.html.erb: -------------------------------------------------------------------------------- 1 | <% if object.errors.present? %> 2 |
3 |
4 |
5 | 6 | <%- object.errors.full_messages.each do |message| %> 7 | <%= message %>
8 | <% end -%> 9 |
10 |
11 |
12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/shared/_google.html.erb: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/views/shared/_member.html.erb: -------------------------------------------------------------------------------- 1 | <%= check_box_tag "#{record.class.name.singularize.downcase}_member_#{record.id}", "1", record.member? %> 2 | 3 | <%= javascript_tag do %> 4 | $('#<%= "#{record.class.name.singularize.downcase}_member_#{record.id}" %>').click(function() { 5 | $.post('<%= "/admin/#{record.class.name.pluralize.downcase}/#{record.id}/toggle_member" %>'); 6 | }); 7 | <% end -%> 8 | -------------------------------------------------------------------------------- /app/views/shared/_months.html.erb: -------------------------------------------------------------------------------- 1 | <%= tabs do |tabs| 2 | Date::MONTHNAMES.compact.each do |month| 3 | tabs.add(month, "##{month.downcase}") 4 | end 5 | end -%> 6 | -------------------------------------------------------------------------------- /app/views/shared/_search.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= form_tag({}, { method: "get", class: "form-horizontal", role: "form" }) do %> 4 |
5 |
6 | <%= search_field_tag("name", @name, class: "wants_focus form-control", placeholder: placeholder) %> 7 | 8 | 9 | 10 |
11 |
12 | <% end -%> 13 |
14 |
15 | -------------------------------------------------------------------------------- /app/views/shared/_years.html.erb: -------------------------------------------------------------------------------- 1 | <%= tabs(year) do |tabs| 2 | years = Event.find_all_years << RacingAssociation.current.effective_year << year 3 | 4 | years.uniq.sort.reverse.each do |y| 5 | tabs.add(y, url_for(year: y, discipline: discipline)) 6 | end 7 | end -%> 8 | -------------------------------------------------------------------------------- /app/views/table/_base.html.erb: -------------------------------------------------------------------------------- 1 | "<%= " id='#{id}_table'".html_safe if id %><%= " data-id='#{dataid}'".html_safe if dataid %>> 2 | <%- if insert_header -%> 3 | 4 | 5 | <% columns.times do -%><%- end -%> 6 | 7 | 8 | <%- end -%> 9 | <%= body -%> 10 | <%- if body.blank? || collection.try(:empty?) -%> 11 | 12 | 13 | 14 | 15 | 16 | <%- end -%> 17 |
 
None
18 | -------------------------------------------------------------------------------- /app/views/table/_th.html.erb: -------------------------------------------------------------------------------- 1 | <% if sort_by.present? %> 2 | <%= link_to(title, {sort_by: "#{sort_by.join(',')}", sort_direction: sort_direction}.merge(sort_params)) -%> 3 | <% else -%> 4 | <%= title -%> 5 | <% end -%> 6 | -------------------------------------------------------------------------------- /app/views/tabs/_dropdown_tab.html.erb: -------------------------------------------------------------------------------- 1 | <%= tag.li class: dropdown_tab.css_class do %> 2 | <%= link_to dropdown_tab.text, dropdown_tab.path, id: "#{dropdown_tab.text.underscore.gsub(" ", "_")}_tab" %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/tabs/_dropdown_tabs.html.erb: -------------------------------------------------------------------------------- 1 | <%= tag.li class: "dropdown active", role: "presentation" do %> 2 | <%= link_to( 3 | tabs.dropdown.text, 4 | tabs.dropdown.path, 5 | "aria-haspopup": "true", 6 | "aria-expanded": "false", 7 | class: "dropdown-toggle", 8 | data: { toggle: "dropdown" }, 9 | id: "#{tabs.dropdown.text.underscore.gsub(" ", "_")}", 10 | role: "button" 11 | ) %> 12 | 15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/tabs/_tab.html.erb: -------------------------------------------------------------------------------- 1 | <%= tag.li class: tab.css_class, role: "presentation" do %> 2 | <%= link_to tab.text, tab.path, id: "#{tab.text.underscore.gsub(" ", "_")}_tab" %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/tabs/_tabs.html.erb: -------------------------------------------------------------------------------- 1 | <%# Use +tabs_array+ to distinguish from helper %> 2 | <% if tabs_array.many? || tabs_array.show_one? %> 3 |
4 | 7 |
8 | 9 | 14 | <% end %> 15 | -------------------------------------------------------------------------------- /app/views/teams/_team.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= link_to(team.name, team.website) unless team.website.blank? %> 4 | <%= team.name if team.website.blank? %> 5 | 6 | 7 | <%= raw team.sponsors %> 8 | 9 | 10 | <%= link_to_contact(team) %>
11 | <%= team.contact_phone %> 12 | 13 | 14 | <%= link_to "Results", team_path(team) -%> 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/views/teams/index.xlsx.axlsx: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | workbook = xlsx_package.workbook 4 | workbook.add_worksheet(name: "Member Teams") do |sheet| 5 | sheet.add_row %w[ 6 | id 7 | name 8 | city 9 | state 10 | contact_name 11 | contact_email 12 | contact_phone 13 | sponsors 14 | website 15 | ] 16 | @teams.sort_by(&:downcased_name).each do |team| 17 | sheet.add_row [ 18 | team.id, 19 | team.name, 20 | team.city, 21 | team.state, 22 | team.contact_name, 23 | team.contact_email, 24 | team.contact_phone, 25 | team.sponsors, 26 | team.website 27 | ] 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /bin/ascii85: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'ascii85' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("Ascii85", "ascii85") 19 | -------------------------------------------------------------------------------- /bin/byebug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'byebug' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("byebug", "byebug") 19 | -------------------------------------------------------------------------------- /bin/cap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'cap' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("capistrano", "cap") 19 | -------------------------------------------------------------------------------- /bin/capify: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'capify' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("capistrano", "capify") 19 | -------------------------------------------------------------------------------- /bin/erubis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'erubis' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("erubis", "erubis") 19 | -------------------------------------------------------------------------------- /bin/httparty: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'httparty' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("httparty", "httparty") 19 | -------------------------------------------------------------------------------- /bin/jeweler: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'jeweler' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("jeweler", "jeweler") 19 | -------------------------------------------------------------------------------- /bin/launchy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'launchy' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("launchy", "launchy") 19 | -------------------------------------------------------------------------------- /bin/mongrel_rpm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'mongrel_rpm' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("newrelic_rpm", "mongrel_rpm") 19 | -------------------------------------------------------------------------------- /bin/newrelic: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'newrelic' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("newrelic_rpm", "newrelic") 19 | -------------------------------------------------------------------------------- /bin/newrelic_cmd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'newrelic_cmd' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("newrelic_rpm", "newrelic_cmd") 19 | -------------------------------------------------------------------------------- /bin/nokogiri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'nokogiri' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("nokogiri", "nokogiri") 19 | -------------------------------------------------------------------------------- /bin/nrdebug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'nrdebug' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("newrelic_rpm", "nrdebug") 19 | -------------------------------------------------------------------------------- /bin/oletool: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'oletool' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("ruby-ole", "oletool") 19 | -------------------------------------------------------------------------------- /bin/pdf_callbacks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pdf_callbacks' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("pdf-reader", "pdf_callbacks") 19 | -------------------------------------------------------------------------------- /bin/pdf_list_callbacks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pdf_list_callbacks' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("pdf-reader", "pdf_list_callbacks") 19 | -------------------------------------------------------------------------------- /bin/pdf_object: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pdf_object' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("pdf-reader", "pdf_object") 19 | -------------------------------------------------------------------------------- /bin/pdf_text: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pdf_text' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("pdf-reader", "pdf_text") 19 | -------------------------------------------------------------------------------- /bin/puma: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'puma' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("puma", "puma") 19 | -------------------------------------------------------------------------------- /bin/pumactl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pumactl' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("puma", "pumactl") 19 | -------------------------------------------------------------------------------- /bin/rackup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rackup' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("rack", "rackup") 19 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require_relative "../config/boot" 5 | require "rake" 6 | Rake.application.run 7 | -------------------------------------------------------------------------------- /bin/rdoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rdoc' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("rdoc", "rdoc") 19 | -------------------------------------------------------------------------------- /bin/redcarpet: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'redcarpet' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("redcarpet", "redcarpet") 19 | -------------------------------------------------------------------------------- /bin/ri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'ri' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("rdoc", "ri") 19 | -------------------------------------------------------------------------------- /bin/ri_cal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'ri_cal' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("ri_cal", "ri_cal") 19 | -------------------------------------------------------------------------------- /bin/rubocop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rubocop' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("rubocop", "rubocop") 19 | -------------------------------------------------------------------------------- /bin/sass: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sass' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("sass", "sass") 19 | -------------------------------------------------------------------------------- /bin/sass-convert: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sass-convert' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("sass", "sass-convert") 19 | -------------------------------------------------------------------------------- /bin/scss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'scss' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("sass", "scss") 19 | -------------------------------------------------------------------------------- /bin/sprockets: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'sprockets' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("sprockets", "sprockets") 19 | -------------------------------------------------------------------------------- /bin/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | bin/test_ruby 6 | bundle exec rails test 7 | bundle exec rails test registration_engine/test/{controllers,helpers,integration,mailers,models}/**/*_test.rb 8 | bundle exec rails test:system 9 | bundle exec rails test registration_engine/test/system 10 | -------------------------------------------------------------------------------- /bin/test_ruby: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | bundle exec rake -f test_ruby/Rakefile 6 | -------------------------------------------------------------------------------- /bin/thor: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'thor' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("thor", "thor") 19 | -------------------------------------------------------------------------------- /bin/tilt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'tilt' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("tilt", "tilt") 19 | -------------------------------------------------------------------------------- /bin/tt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'tt' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("treetop", "tt") 19 | -------------------------------------------------------------------------------- /bin/unicorn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'unicorn' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("unicorn", "unicorn") 19 | -------------------------------------------------------------------------------- /bin/unicorn_rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'unicorn_rails' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("unicorn", "unicorn_rails") 19 | -------------------------------------------------------------------------------- /bin/xlsopcodes: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'xlsopcodes' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | require "rubygems" 16 | require "bundler/setup" 17 | 18 | load Gem.bin_path("spreadsheet", "xlsopcodes") 19 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is used by Rack-based servers to start the application. 4 | 5 | require_relative "config/environment" 6 | 7 | run Rails.application 8 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) 4 | 5 | require "bundler/setup" # Set up gems listed in the Gemfile. 6 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. 7 | -------------------------------------------------------------------------------- /config/brakeman.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :app_path: "." 3 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: racing_on_rails_production 11 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: mysql2 3 | database: racing_on_rails_development 4 | username: ror_development 5 | host: localhost 6 | encoding: utf8 7 | 8 | test: 9 | adapter: mysql2 10 | database: racing_on_rails_test<%= ENV["TEST_ENV_NUMBER"] %> 11 | username: ror_test 12 | host: localhost 13 | encoding: utf8 14 | -------------------------------------------------------------------------------- /config/deploy/production.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | role :app, "app@obra.org" 4 | role :web, "app@obra.org" 5 | role :db, "app@obra.org" 6 | -------------------------------------------------------------------------------- /config/deploy/staging.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | role :app, "app@staging.obra.org" 4 | role :web, "app@staging.obra.org" 5 | role :db, "app@staging.obra.org" 6 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Load the Rails application. 4 | require_relative "application" 5 | 6 | # Initialize the Rails application. 7 | Rails.application.initialize! 8 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.config.assets.paths << Rails.root.join("node_modules") 4 | Rails.application.config.assets.paths << Rails.root.join("local/app/assets/images") 5 | Rails.application.config.assets.paths << Rails.root.join("local/app/assets/javascripts") 6 | Rails.application.config.assets.paths << Rails.root.join("local/app/assets/stylesheets") 7 | 8 | Rails.application.config.assets.version = "6.1" 9 | -------------------------------------------------------------------------------- /config/initializers/ckeditor.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Use this hook to configure ckeditor 4 | Ckeditor.setup do |_| 5 | require "ckeditor/orm/active_record" 6 | end 7 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ActiveSupport::Inflector.inflections(:en) do |inflect| 4 | inflect.acronym "TT" 5 | inflect.acronym "USAC" 6 | end 7 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Mime::Type.register "application/vnd.ms-excel", :xls 4 | Mime::Type.register "application/vnd.ms-excel", :ppl 5 | -------------------------------------------------------------------------------- /config/initializers/new_relic.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | NewRelic::Agent.after_fork(force_reconnect: true) if defined? Puma 4 | -------------------------------------------------------------------------------- /config/initializers/raygun.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | if Rails.env.production? 4 | Raygun.setup do |config| 5 | config.api_key = "jXyEmb3vjngvdkib6L4O6w==" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.application.config.session_store :cookie_store, key: "_racing_on_rails_session" 4 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ActiveSupport.on_load(:action_controller) do 4 | wrap_parameters format: [:json] 5 | end 6 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | below_minimum_events: "%{minimum_events} event minimum" 3 | calculated: "Not an event result" 4 | category_worst_result: "Worst 10% in category" 5 | dnf: "DNF" 6 | discipline: "%{discipline} result" 7 | members_only: Must be an annual member 8 | no_points: "No points" 9 | no_source_results: "No results" 10 | not_calculation_category: "Not a calculation category" 11 | rejected_category: "Not a calculation category" 12 | results_per_event: "Only first %{results_per_event} results count" 13 | sanctioned_by: "Must be sanctioned by %{racing_association}" 14 | weekday: "Weekday event" 15 | worse_result: "Worst results do not count" 16 | -------------------------------------------------------------------------------- /config/performance.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | load "deploy" 4 | load "config/deploy" 5 | load "config/db" 6 | load "local/config/performance.rb" if File.exist?("local/config/performance.rb") 7 | 8 | set :rails_env, "performance" 9 | -------------------------------------------------------------------------------- /config/semaphore_database.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: mysql2 3 | database: racing_on_rails_development 4 | host: 0.0.0.0 5 | username: root 6 | 7 | test: 8 | adapter: mysql2 9 | database: racing_on_rails_test 10 | host: 0.0.0.0 11 | username: root 12 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Spring.watch( 4 | ".ruby-version", 5 | ".rbenv-vars", 6 | "tmp/restart.txt", 7 | "tmp/caching-dev.txt" 8 | ) 9 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /db/grants.sql: -------------------------------------------------------------------------------- 1 | create user if not exists 'ror_development'@'localhost'; 2 | create user if not exists 'ror_test'@'localhost'; 3 | 4 | grant all privileges on racing_on_rails_development.* to 'ror_development'@'localhost'; 5 | grant all privileges on `racing_on_rails_test%`.* to 'ror_test'@'localhost'; 6 | -------------------------------------------------------------------------------- /db/migrate/20200106032705_add_calculation_category_discipline.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddCalculationCategoryDiscipline < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :calculations_categories_categories, :discipline_id, :integer, default: nil, null: true 6 | add_foreign_key :calculations_categories_categories, :disciplines, column: :discipline_id, on_delete: :cascade 7 | rename_table :calculations_categories_categories, :calculations_categories_mappings 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200117183910_add_race_discipline.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddRaceDiscipline < ActiveRecord::Migration[5.2] 4 | def change 5 | change_table :races do |t| 6 | t.belongs_to :discipline, foreign_key: true, type: :integer 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200120224522_add_product_team.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddProductTeam < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :products, :team, :boolean, default: false, null: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200120225216_add_line_item_team.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddLineItemTeam < ActiveRecord::Migration[5.2] 4 | def change 5 | change_table :line_items do |t| 6 | t.belongs_to :team, foreign_key: true, type: :integer 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200120235814_add_order_people_team_id.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddOrderPeopleTeamId < ActiveRecord::Migration[5.2] 4 | def change 5 | change_table :order_people do |t| 6 | t.belongs_to :team, foreign_key: true, type: :integer 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200125000755_add_racing_association_card_colors.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddRacingAssociationCardColors < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :racing_associations, :card_background_color, :string, null: false, default: "000000" 6 | add_column :racing_associations, :card_text_color, :string, null: false, default: "ffffff" 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200301154515_add_people_fabric_road_numbers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddPeopleFabricRoadNumbers < ActiveRecord::Migration[5.2] 4 | def change 5 | change_table :people do |t| 6 | t.boolean :fabric_road_numbers, default: true, null: false 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200303004002_allow_discount_null_event.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AllowDiscountNullEvent < ActiveRecord::Migration[5.2] 4 | def change 5 | change_column :discount_codes, :event_id, :integer, null: true, default: nil 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200308011251_add_usac_license.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddUsacLicense < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :people, :usac_license, :string, default: nil, null: true 6 | add_index :people, :usac_license 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200308013135_add_order_person_license.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddOrderPersonLicense < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :order_people, :usac_license, :string, default: nil, null: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200425160436_add_events_tentative.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddEventsTentative < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :events, :tentative, :boolean, default: false, null: false 6 | rename_column :events, :cancelled, :canceled 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200501151835_add_unique_team_name_index.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddUniqueTeamNameIndex < ActiveRecord::Migration[6.0] 4 | def change 5 | remove_index :teams, name: :index_teams_on_name 6 | add_index :teams, :name, unique: true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200603161935_create_community_discipline.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateCommunityDiscipline < ActiveRecord::Migration[5.2] 4 | def up 5 | Discipline.find_by(name: "Community")&.destroy! 6 | Discipline.create!(name: "Community", bar: false) 7 | end 8 | 9 | def down 10 | Discipline.find_by(name: "Community")&.destroy! 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20201219173227_remove_mobile_site.rb: -------------------------------------------------------------------------------- 1 | class RemoveMobileSite < ActiveRecord::Migration[6.0] 2 | def change 3 | remove_column :racing_associations, :mobile_site, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210311164253_add_race_rejection_defaults.rb: -------------------------------------------------------------------------------- 1 | class AddRaceRejectionDefaults < ActiveRecord::Migration[6.1] 2 | def change 3 | Race.where(rejected: nil).update_all(rejected: false) 4 | change_column :races, :rejected, :boolean, null: false, default: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210312171017_correct_calculation_dates.rb: -------------------------------------------------------------------------------- 1 | class CorrectCalculationDates < ActiveRecord::Migration[6.1] 2 | def change 3 | Calculations::V3::Calculation.where(key: :ironman).map(&:event).each do |e| 4 | e.update_column(:date, Date.new(e.year)) 5 | e.update_column(:end_date, Date.new(e.year, 12, 31)) 6 | end 7 | 8 | Calculations::V3::Calculation.where("`key` like ?", "%bar%").map(&:event).compact.each do |e| 9 | e.update_column(:date, Date.new(e.year)) 10 | e.update_column(:end_date, Date.new(e.year, 12, 31)) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20210315224418_add_calculation_show_zero_point_source_results.rb: -------------------------------------------------------------------------------- 1 | class AddCalculationShowZeroPointSourceResults < ActiveRecord::Migration[6.1] 2 | def change 3 | change_table :calculations do |t| 4 | t.boolean :show_zero_point_source_results, default: true, null: false 5 | end 6 | 7 | Calculations::V3::Calculation.where(key: [:age_graded_bar, :overall_bar]).update_all( 8 | show_zero_point_source_results: false 9 | ) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # This file should contain all the record creation needed to seed the database with its default values. 3 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 4 | # 5 | # Examples: 6 | # 7 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 8 | # Mayor.create(name: 'Daley', city: cities.first) 9 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /lib/action_view/inline_template_extension.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Add relative path method so we can use inline-rendered Pages as partials 4 | # Did not copy "memoize :relative_path" from base template. Not sure if it matters. 5 | module ActionView #:nodoc: 6 | class InlineTemplate #:nodoc: 7 | def relative_path 8 | path = File.expand_path(filename) 9 | path.sub!(%r{^#{Regexp.escape(File.expand_path(::Rails.root.to_s))}/}, "") if defined?(::Rails.root.to_s) 10 | path 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/acts_as_tree/validation.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ActsAsTree 4 | module Validation 5 | extend ActiveSupport::Concern 6 | 7 | included do 8 | validate :valid_parent 9 | end 10 | 11 | def valid_parent 12 | if parent == self 13 | errors.add :parent, "can't be own parent" 14 | return false 15 | end 16 | 17 | true 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/array/each_row.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Array 4 | # [a, b, c, d].each_row.do |first, second| 5 | # puts("#{first}, #{second}") 6 | # end 7 | # >> "a, b" 8 | # >> "c, d" 9 | # 10 | # Used for races table on top of results page 11 | def each_row 12 | return [nil, nil] if empty? 13 | 14 | rows = [] 15 | row_count = (size + 1) / 2 16 | 17 | (0..(row_count - 1)).each do |row_index| 18 | row = [self[row_index]] 19 | second_element_index = (row_count - 1) + row_index + 1 20 | row << self[second_element_index] if second_element_index < size 21 | rows << row 22 | yield row 23 | end 24 | 25 | rows 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/carrier_wave/mini_magick/processing.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module CarrierWave 4 | module MiniMagick 5 | def quality(percentage) 6 | manipulate! do |img| 7 | img.quality(percentage.to_s) 8 | img = yield(img) if block_given? 9 | img 10 | end 11 | end 12 | 13 | def interlace 14 | manipulate! do |img| 15 | img.interlace "Plane" 16 | img 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/exception_notification/logging.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ExceptionNotification 4 | class Logging 5 | def self.track_exception(e) 6 | Rails.logger.error e 7 | Rails.logger.error e.backtrace.join("\n") if e.respond_to?(:backtrace) && e.backtrace 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/test.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "rails/test_unit/runner" 4 | 5 | namespace :test do 6 | desc "Test calculations" 7 | task calculations: :ruby do 8 | $LOAD_PATH << "test" 9 | test_files = FileList["test/models/calculations/v3/**/*_test.rb"] 10 | Rails::TestUnit::Runner.run test_files 11 | end 12 | 13 | task ruby: :environment do 14 | test_files = FileList["test_ruby/**/*_test.rb"] 15 | Rails::TestUnit::Runner.run test_files 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "racing_on_rails", 3 | "private": true, 4 | "dependencies": { 5 | "@rails/actioncable": "^6.0.0", 6 | "@rails/activestorage": "^6.0.0", 7 | "@rails/ujs": "^6.0.0", 8 | "@rails/webpacker": "4.2.2", 9 | "turbolinks": "^5.2.0" 10 | }, 11 | "version": "0.1.0", 12 | "devDependencies": { 13 | "webpack-dev-server": "^3.10.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # Only asks for txt, which causes errors in Rails 3.0 2 | User-agent: discobot 3 | Disallow: / 4 | -------------------------------------------------------------------------------- /script/archive_email: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo `date` >> /var/log/mailman_archiver.log 2>&1 4 | 5 | curl https://0.0.0.0/admin/mailing_lists/1/posts/receive -X POST -F "raw=@-" >> /var/log/mailman_archiver.log 2>&1 6 | -------------------------------------------------------------------------------- /script/competition_results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | year = Time.current.year 4 | 5 | year = ENV["YEAR"].to_i if ENV["YEAR"] 6 | 7 | events = Event.competition.year(year).includes(races: :category).all.order(:date, :name) 8 | 9 | events.each do |competition| 10 | competition.races.sort_by(&:name).each do |race| 11 | puts "#{competition.full_name} #{race.name} #{race.results.count}" 12 | end 13 | end 14 | 15 | events.each do |competition| 16 | competition.races.sort_by(&:name).each do |race| 17 | puts "#{competition.full_name} #{race.name} #{race.results.sum(:points)}" 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /script/deploy: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | %w[ obra aba mbra wsba ].each do |association| 5 | puts "Deploy #{association}" 6 | `script/local #{association}` 7 | puts `cap production deploy` 8 | puts `cap production puma:stop` 9 | puts `cap production puma:start` 10 | end 11 | -------------------------------------------------------------------------------- /script/deploy_staging: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | %w[ obra ].each do |association| 5 | puts "Deploy #{association}" 6 | `script/local #{association}` 7 | puts `cap staging deploy` 8 | end 9 | -------------------------------------------------------------------------------- /script/or_tt_cup_distances.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Race.where(event_id: 24_520).update_all(distance: 11.2) 4 | Race.where(event_id: 24_649).update_all(distance: 22.8) 5 | Race.where(id: [576_807, 576_808, 576_809, 576_810, 576_811, 576_812, 576_813, 576_814]).update_all(distance: 13.8) 6 | Race.where(event_id: 24_558).update_all(distance: 22.8) 7 | Race.where(id: [576_423]).update_all(distance: 6.8) 8 | Race.where(id: [576_425, 576_427, 576_428, 576_429, 576_430, 576_432, 578_250]).update_all(distance: 13.8) 9 | Race.where(event_id: 24_580).update_all(distance: 5.5) 10 | Result.find(31_597_641).destroy! 11 | -------------------------------------------------------------------------------- /script/read_mbox.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | message = nil 4 | count = 0 5 | posts_count = Post.count 6 | 7 | MailingList.transaction do 8 | File.readlines(ARGV.last).each do |line| 9 | if line.match?(/\AFrom /) 10 | puts line 11 | MailingListMailer.receive(message) if message.present? 12 | message = "" 13 | count += 1 14 | else 15 | message << line.sub(/^>From/, "From") 16 | end 17 | rescue StandardError => e 18 | puts "#{e}: #{line}" 19 | end 20 | 21 | puts "Read #{count} messages. Created #{Post.count - posts_count} posts." 22 | 23 | raise(ActiveRecord::Rollback) if ENV["DOIT"].blank? 24 | end 25 | -------------------------------------------------------------------------------- /script/restart: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | %w[ aba mbra obra wsba ].each do |association| 5 | puts "Restart #{association}" 6 | `script/local #{association}` 7 | puts `cap production puma:stop` 8 | puts `cap production puma:start` 9 | end 10 | -------------------------------------------------------------------------------- /script/update_categories.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | ::Category.order(:name).all.each do |category| 5 | category.set_abilities_from_name 6 | category.set_ages_from_name 7 | category.set_equipment_from_name 8 | category.set_gender_from_name 9 | category.set_weight_from_name 10 | 11 | if category.changed? 12 | puts "#{category.name} #{category.changes}" 13 | end 14 | 15 | category.save! 16 | end.size 17 | -------------------------------------------------------------------------------- /test/.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: ../.rubocop.yml 2 | 3 | Metrics/BlockLength: 4 | Max: 100 5 | -------------------------------------------------------------------------------- /test/controllers/admin/home_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | module Admin 7 | class HomeControllerTest < ActionController::TestCase 8 | setup :create_administrator_session, :use_ssl 9 | 10 | test "index" do 11 | get :index 12 | assert_redirected_to admin_events_path 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /test/controllers/caching_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "test_helper" 4 | 5 | # :stopdoc: 6 | class CachingTest < ActionController::TestCase 7 | class TestController < ApplicationController 8 | include Caching 9 | end 10 | 11 | test "expire_cache" do 12 | controller = TestController.new 13 | TestController.expects(:expire_cache) 14 | controller.send :expire_cache 15 | end 16 | 17 | test "class expire_cache" do 18 | RacingAssociation.current.update_column :updated_at, 2.days.ago 19 | TestController.expire_cache 20 | assert RacingAssociation.current.reload.updated_at > 2.days.ago 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /test/controllers/calculations/categories_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "test_helper" 4 | 5 | module Calculations 6 | # :stopdoc: 7 | class CategoriesControllerTest < ActionController::TestCase 8 | test "redirects to event result page if there is no calculation" do 9 | event = FactoryBot.create(:event) 10 | get :index, params: { event_id: event } 11 | assert_redirected_to event_results_path(event) 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/controllers/dates_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "test_helper" 4 | 5 | # :stopdoc: 6 | class DatesTest < ActionController::TestCase 7 | tests HomeController 8 | 9 | test "assign_today" do 10 | travel_to Time.zone.local(2014, 2, 3) do 11 | get :index 12 | assert_equal Time.zone.local(2014, 2, 3).to_date, assigns("today") 13 | end 14 | end 15 | 16 | test "assign_year" do 17 | travel_to Time.zone.local(2014, 2, 3) do 18 | get :index 19 | assert_equal 2014, assigns("year") 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /test/controllers/mailing_lists_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class MailingListsControllerTest < ActionController::TestCase 7 | test "index" do 8 | get :index 9 | assert_response(:success) 10 | assert_template("mailing_lists/index") 11 | assert_not_nil(assigns["mailing_lists"], "Should assign mailing_lists") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/controllers/memberships_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class MembershipsControllerTest < ActionController::TestCase 7 | test "show" do 8 | use_ssl 9 | person = FactoryBot.create(:person) 10 | login_as person 11 | get :show, params: { person_id: person } 12 | assert_equal person, assigns(:person), "@person" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/controllers/versions_controller_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class VersionsControllerTest < ActionController::TestCase 7 | def setup 8 | super 9 | create_administrator_session 10 | use_ssl 11 | end 12 | 13 | test "index for person" do 14 | person = FactoryBot.create(:person) 15 | get :index, params: { person_id: person.to_param } 16 | assert_response :success 17 | assert_equal person, assigns(:person), "@person" 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /test/fixtures/files/admin/member_mailer/email: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/admin/member_mailer/email -------------------------------------------------------------------------------- /test/fixtures/files/email/outlook_expected.eml: -------------------------------------------------------------------------------- 1 | Hey, this is from Bloodhound in the basement. 2 | 3 | http://RacingAssociation.current.static_host 4 | 5 | I am the lonely, forgotten computer. 6 | 7 | 1.. Where are my friends? 8 | Slugger 9 | 2.. Lizard 10 | 11 | Still loyal: 12 | Pavilion 13 | -------------------------------------------------------------------------------- /test/fixtures/files/mailing_list_mailer/reply: -------------------------------------------------------------------------------- 1 | Lots of singlespeeds for sale. 2 | Studded tires, too. 3 | 4 | Check it out, 5 | Mollie -------------------------------------------------------------------------------- /test/fixtures/files/membership/duplicates.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/membership/duplicates.xlsx -------------------------------------------------------------------------------- /test/fixtures/files/membership/upload.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/membership/upload.xlsx -------------------------------------------------------------------------------- /test/fixtures/files/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/photo.jpg -------------------------------------------------------------------------------- /test/fixtures/files/race_day_mailer/members_export: -------------------------------------------------------------------------------- 1 | Blank|Road Number|Last Name|First Name|Address|Country|City|State|Zip|Phone|Road Cat|Track Cat|Age|Gender|Blank|Club|Team|Blank|Blank 2 | ||Cameron|Molly||US||||||||F|||Vanilla|| 3 | ||Matson|Mark||US||||||||M|||Kona|| 4 | ||Pennington|Alice||US||||||||F|||Gentle Lovers|| 5 | |7123811|Tonkin|Erik|127 SE Lambert|US|Portland|OR|19990|415 221-3773|1|5|30|M|||Kona|| 6 | ||Weaver|Ryan||US||||||||M|||Gentle Lovers|| 7 | -------------------------------------------------------------------------------- /test/fixtures/files/results/2006_v2.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/2006_v2.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/custom_columns.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/custom_columns.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/dh.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/dh.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/dupe_people.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/dupe_people.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/mtb.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/mtb.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/no_first_place_finisher.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/no_first_place_finisher.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/non_sequential_results.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/non_sequential_results.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/non_sequential_usac_results.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/non_sequential_usac_results.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/pir_2006_format.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/pir_2006_format.xlsx -------------------------------------------------------------------------------- /test/fixtures/files/results/small_event.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/small_event.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/stage_race.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/stage_race.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/times.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/times.xlsx -------------------------------------------------------------------------------- /test/fixtures/files/results/tt.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/tt.xlsx -------------------------------------------------------------------------------- /test/fixtures/files/results/tt_usac.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/tt_usac.xls -------------------------------------------------------------------------------- /test/fixtures/files/results/ttt.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/results/ttt.xls -------------------------------------------------------------------------------- /test/fixtures/files/schedule/comma-delimited.csv: -------------------------------------------------------------------------------- 1 | Date,Race,CityState,Discipline,Promoter,PromoterPhone,PromoterEmail,SponsoringTeam,SanctionedBy,Website,FlyerApproved 2 | 1/1/99,Butte Hillclimb,Butte,,,,,,,, 3 | 2/12/99,Valentine Criterium,"Missoula, MT",Criterium,Al Pendergrass,(414) 333-1100,al@gmail.com,1200000,USA Cycling,http://geocities.com/bikes,1 -------------------------------------------------------------------------------- /test/fixtures/files/schedule/excel.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/test/fixtures/files/schedule/excel.xls -------------------------------------------------------------------------------- /test/fixtures/files/schedule/tab-delimited.txt: -------------------------------------------------------------------------------- 1 | Date Race CityState Discipline Promoter PromoterPhone PromoterEmail SponsoringTeam SanctionedBy Website FlyerApproved 2 | 1/1/99 Butte Hillclimb Butte 3 | 2/12/99 Valentine Criterium "Missoula, MT" Criterium Al Pendergrass (414) 333-1100 al@gmail.com 1200000 USA Cycling http://geocities.com/bikes 1 -------------------------------------------------------------------------------- /test/fixtures/views/fake/_flash_messages.html.erb: -------------------------------------------------------------------------------- 1 |

2 | <%= flash[:notice] %> 3 |

4 | -------------------------------------------------------------------------------- /test/fixtures/views/fake/missing_partial.html.erb: -------------------------------------------------------------------------------- 1 | <%= render_page "does/not/exist" %> 2 | -------------------------------------------------------------------------------- /test/fixtures/views/fake/partial_using_action.html.erb: -------------------------------------------------------------------------------- 1 | <%= render_page "plain" %> 2 | -------------------------------------------------------------------------------- /test/fixtures/views/fake/partial_using_partials_action.html.erb: -------------------------------------------------------------------------------- 1 |

Other Page as partial

2 | <%= render_page "plain" %> 3 | 4 |

Template as partial

5 | <%= render "flash_messages" %> 6 | -------------------------------------------------------------------------------- /test/fixtures/views/static/about.html.erb: -------------------------------------------------------------------------------- 1 |

2 | The WSBA is the governing body of bicycle racing in the state of Washington. 3 |

4 | -------------------------------------------------------------------------------- /test/fixtures/views/static/join.html.erb: -------------------------------------------------------------------------------- 1 | Join today! <%= Time.zone.today %> 2 | -------------------------------------------------------------------------------- /test/fixtures/views/static/women/cat4.html.erb: -------------------------------------------------------------------------------- 1 |

Cat 4 Women Series

2 | -------------------------------------------------------------------------------- /test/helpers/whitespace_helper_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "test_helper" 4 | 5 | # :stopdoc: 6 | class WhitespaceTest < ActionView::TestCase 7 | include WhitespaceHelper 8 | 9 | test "show_whitespace" do 10 | assert_nil show_whitespace(nil), "nil" 11 | assert_equal "", show_whitespace(""), "blank" 12 | assert_equal "Senior", show_whitespace("Senior"), "Senior" 13 | assert_equal "·Senior··", show_whitespace(" Senior "), "Senior with whitespace" 14 | assert_equal "Senior Men", show_whitespace("Senior Men"), "Senior Men" 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /test/integration/event_team_membership_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "racing_on_rails/integration_test" 4 | 5 | # :stopdoc: 6 | class EventTeamMembershipTest < RacingOnRails::IntegrationTest 7 | test "join" do 8 | https! 9 | event = FactoryBot.create(:event, slug: "ojcs-team") 10 | get "/ojcs-team/join" 11 | assert_redirected_to event_event_teams_path(event) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/integration/racing_on_rails/integration_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "../../test_helper" 4 | 5 | module RacingOnRails 6 | class IntegrationTest < ActionDispatch::IntegrationTest 7 | def go_to_login 8 | get new_person_session_path 9 | assert_response :success 10 | assert_template "person_sessions/new" 11 | end 12 | 13 | def login(options) 14 | post person_session_path, **options 15 | assert_response :redirect 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/jobs/calculations_job_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "test_helper" 4 | 5 | class CalculationsJobTest < ActiveJob::TestCase 6 | test "perfom" do 7 | CalculationsJob.perform_now 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/mailers/person_mailer_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "../test_helper" 4 | 5 | # :stopdoc: 6 | class PersonMailerTest < ActionMailer::TestCase 7 | test "new login confirmation" do 8 | person = FactoryBot.create(:person, email: "rr@example.com") 9 | email = PersonMailer.new_login_confirmation(person) 10 | assert_equal ["rr@example.com"], email.to 11 | assert_equal "New #{RacingAssociation.current.short_name} Login", email.subject 12 | assert_match(/new #{RacingAssociation.current.short_name} login/, email.encoded) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/models/article_category_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class ArticleCategoryTest < ActiveSupport::TestCase 7 | test "is a tree" do 8 | root = FactoryBot.create(:article_category) 9 | child = root.children.create! 10 | assert_equal root, child.root, "root" 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/models/mailing_lists/mailing_list_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class MailingListTest < ActiveSupport::TestCase 7 | test "save" do 8 | mailing_list = MailingList.new 9 | mailing_list.name = "nwcycling" 10 | mailing_list.friendly_name = "NW Cycling" 11 | mailing_list.subject_line_prefix = "NW Cycling" 12 | mailing_list.save! 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/models/name_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class NameTest < ActiveSupport::TestCase 7 | test "no duplicates" do 8 | team = FactoryBot.create(:team) 9 | team.names.create!(name: "Sacha's Team", year: 2001) 10 | name = team.names.build(name: "White Express", year: 2001) 11 | assert_not(name.valid?, "No duplications") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/models/number_issuer_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class NumberIssuerTest < ActiveSupport::TestCase 7 | test "create" do 8 | NumberIssuer.create(name: "Elkhorn Classic SR") 9 | assert_not(NumberIssuer.new.valid?, "Null name") 10 | assert_not(NumberIssuer.new(name: "").valid?, "Empty name") 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/models/person_session_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class PersonSessionTest < ActiveSupport::TestCase 7 | test "login should be case insensitive" do 8 | FactoryBot.create(:person_with_login, login: "my.name@example.com") 9 | session = PersonSession.new(login: "My.name@example.com", password: "secret") 10 | assert session.save, "Should create session" 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/models/photo_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "test_helper" 4 | 5 | class PhotoTest < ActiveSupport::TestCase 6 | test "create" do 7 | FactoryBot.create :photo 8 | end 9 | 10 | test "set title on validate from caption" do 11 | photo = Photo.new(caption: "Foo") 12 | photo.valid? 13 | assert_equal "Foo", photo.title, "title" 14 | end 15 | 16 | test "validation" do 17 | photo = Photo.new 18 | photo.valid? 19 | assert photo.errors[:caption] 20 | assert photo.errors[:image] 21 | assert photo.errors[:height] 22 | assert photo.errors[:width] 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /test/models/region_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class RegionTest < ActiveSupport::TestCase 7 | test "set friendly param" do 8 | region = Region.create!(name: "New York") 9 | assert_equal "new-york", region.friendly_param 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /test/models/velodrome_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require File.expand_path("../test_helper", __dir__) 4 | 5 | # :stopdoc: 6 | class VelodromeTest < ActiveSupport::TestCase 7 | test "find name" do 8 | Velodrome.create!(name: "Hellyer", website: "hellyer.org") 9 | velodrome = Velodrome.find_by(name: "Hellyer") 10 | assert_not_nil(velodrome, "Should find new Velodrome") 11 | assert_equal("hellyer.org", velodrome.website, "website") 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /test/performance/mailing_lists.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | CelluloidBenchmark::Session.define do 4 | benchmark :mailing_list_posts 5 | page = get("http://staging.obra.org/mailing_lists/1/posts") 6 | 7 | 20.times do 8 | link = page.links_with(href: %r{/posts/\d+}).sample 9 | benchmark :post_show, 5 10 | link.click 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/performance/results.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | CelluloidBenchmark::Session.define do 4 | benchmark :results_index, 1.2 5 | page = get("http://staging.obra.org/results") 6 | 7 | 20.times do 8 | link = page.links_with(class: "event").sample 9 | benchmark :results_event_show, 0.6 10 | link.click 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/system/admin/calculations_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "application_system_test_case" 4 | 5 | # :stopdoc: 6 | class Admin::CategoriesTest < ApplicationSystemTestCase 7 | test "edit" do 8 | FactoryBot.create(:discipline) 9 | 10 | Calculations::V3::Calculation.create!( 11 | members_only: true, 12 | name: "Ironman", 13 | points_for_place: 1 14 | ) 15 | 16 | login_as FactoryBot.create(:administrator) 17 | 18 | visit "/calculations" 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /test/system/admin/home_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "application_system_test_case" 4 | 5 | # :stopdoc: 6 | module Admin 7 | class HomeTest < ApplicationSystemTestCase 8 | test "edit" do 9 | visit "/" 10 | login_as FactoryBot.create(:administrator) 11 | 12 | visit "/photos/new" 13 | attach_file "photo_image", "#{Rails.root}/test/fixtures/files/photo.jpg" 14 | fill_in "Caption", with: "Bike racer wins the bike race" 15 | click_button "Save" 16 | 17 | assert_equal "900", find("#photo_height").text 18 | assert_equal "1199", find("#photo_width").text 19 | 20 | visit "/home/edit" 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /test/system/admin/photos_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "application_system_test_case" 4 | 5 | # :stopdoc: 6 | module Admin 7 | class PhotosTest < ApplicationSystemTestCase 8 | test "edit" do 9 | visit "/" 10 | login_as FactoryBot.create(:administrator) 11 | 12 | visit "/photos/new" 13 | attach_file "photo_image", "#{Rails.root}/test/fixtures/files/photo.jpg" 14 | fill_in "Caption", with: "Bike racer wins the bike race" 15 | click_button "Save" 16 | 17 | assert_equal "900", find("#photo_height").text 18 | assert_equal "1199", find("#photo_width").text 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /test_ruby/.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: ../.rubocop.yml 2 | 3 | Metrics/BlockLength: 4 | Max: 100 5 | 6 | Metrics/AbcSize: 7 | Max: 80 8 | -------------------------------------------------------------------------------- /test_ruby/Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "rake/testtask" 4 | 5 | Rake::TestTask.new do |t| 6 | t.test_files = FileList["test_ruby/**/*_test.rb"] 7 | end 8 | desc "Run Ruby tests (no Rails)" 9 | 10 | task default: :test 11 | -------------------------------------------------------------------------------- /test_ruby/helpers/results/mapper_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "../../test_case" 4 | require_relative "../../../app/helpers/results/mapper" 5 | 6 | # :stopdoc: 7 | module Results 8 | class MapperTest < Ruby::TestCase 9 | def test_numeric_custom_columns 10 | mapper = Results::Mapper.new([], [20_130_501]) 11 | result = mock("result", custom_attribute: 3) 12 | mapper.map result 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /test_ruby/models/calculations/v3/rules_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "../v3" 4 | 5 | module Calculations 6 | module V3 7 | # :stopdoc: 8 | class RulesTest < Ruby::TestCase 9 | def test_new 10 | category = Models::Category.new("Masters Men") 11 | 12 | rules = Rules.new(category_rules: [Models::CategoryRule.new(category)]) 13 | 14 | assert_nil rules.points_for_place 15 | assert_equal [category], rules.categories 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /test_ruby/models/photos/dimensions_test.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative "../../test_case" 4 | require_relative "../../../app/models/photos/dimensions" 5 | 6 | # :stopdoc: 7 | class Photos::DimensionsTest < Ruby::TestCase 8 | class TestPhoto 9 | include Photos::Dimensions 10 | attr_accessor :height, :width 11 | end 12 | 13 | def test_nil_safe 14 | photo = TestPhoto.new 15 | assert !photo.landscape?, "landscape?" 16 | assert !photo.portrait?, "portrait?" 17 | assert !photo.widescreen?, "widescreen?" 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /test_ruby/test_case.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "minitest/autorun" 4 | require File.expand_path("../lib/test/enumerable_assertions", __dir__) 5 | require "active_support/core_ext/object/blank" 6 | require "active_support/core_ext/object/try" 7 | require "active_support/concern" 8 | require "mocha/minitest" 9 | 10 | module Ruby 11 | class TestCase < Minitest::Test 12 | include Test::EnumerableAssertions 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/vendor/assets/stylesheets/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /vendor/assets/stylesheets/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/vendor/assets/stylesheets/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /vendor/assets/stylesheets/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/vendor/assets/stylesheets/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /vendor/assets/stylesheets/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/vendor/assets/stylesheets/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /vendor/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottwillson/racing_on_rails/8a81707d15a0e42613a505c449d8a70713fc6c4e/vendor/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /vendor/assets/stylesheets/jquery-ui-timepicker-addon.css: -------------------------------------------------------------------------------- 1 | .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } 2 | .ui-timepicker-div dl { text-align: left; } 3 | .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } 4 | .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } 5 | .ui-timepicker-div td { font-size: 90%; } 6 | .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } 7 | 8 | .ui-timepicker-rtl{ direction: rtl; } 9 | .ui-timepicker-rtl dl { text-align: right; } 10 | .ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; } -------------------------------------------------------------------------------- /vendor/sentient_user/sentient_controller.rb: -------------------------------------------------------------------------------- 1 | module SentientController 2 | def self.included(base) 3 | base.class_eval { 4 | before_action do |controller| 5 | Person.current = controller.send(:current_person) 6 | end 7 | } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /vendor/sentient_user/sentient_user.rb: -------------------------------------------------------------------------------- 1 | # From https://github.com/bokmann/sentient_user 2 | module SentientUser 3 | def self.included(base) 4 | base.class_eval { 5 | def self.current 6 | RequestLocals.fetch(:person) { nil } 7 | end 8 | 9 | def self.current=(o) 10 | raise(ArgumentError, 11 | "Expected an object of class '#{self}', got #{o.inspect}") unless (o.is_a?(self) || o.nil?) 12 | RequestLocals.store[:person] = o 13 | end 14 | 15 | def make_current 16 | RequestLocals.store[:person] = self 17 | end 18 | 19 | def current? 20 | RequestLocals.exist?(:person) && self.id == current.id 21 | end 22 | } 23 | end 24 | end 25 | --------------------------------------------------------------------------------