diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..1214fa7 --- /dev/null +++ b/Gemfile @@ -0,0 +1,44 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 5.0.0', '>= 5.0.0.1' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use Puma as the app server +gem 'puma', '~> 3.0' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.2' +# See https://github.com/rails/execjs#readme for more supported runtimes +gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks +gem 'turbolinks', '~> 5' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 3.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platform: :mri +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. + gem 'web-console' +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..89df73e --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,174 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.0.0.1) + actionpack (= 5.0.0.1) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.0.0.1) + actionview (= 5.0.0.1) + activesupport (= 5.0.0.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.0.1) + activesupport (= 5.0.0.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (5.0.0.1) + activesupport (= 5.0.0.1) + globalid (>= 0.3.6) + activemodel (5.0.0.1) + activesupport (= 5.0.0.1) + activerecord (5.0.0.1) + activemodel (= 5.0.0.1) + activesupport (= 5.0.0.1) + arel (~> 7.0) + activesupport (5.0.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (7.1.2) + builder (3.2.2) + byebug (9.0.5) + coffee-rails (4.2.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.2.x) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.10.0) + concurrent-ruby (1.0.2) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.7.0) + globalid (0.3.7) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.6.0) + activesupport (>= 3.0.0, < 5.1) + multi_json (~> 1.2) + jquery-rails (4.2.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + libv8 (3.16.14.15) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.4) + mime-types (>= 1.16, < 4) + method_source (0.8.2) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.1.0) + minitest (5.9.1) + multi_json (1.12.1) + nio4r (1.2.1) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) + nokogiri (1.6.8-x86-mingw32) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) + pkg-config (1.1.7) + puma (3.6.0) + rack (2.0.1) + rack-test (0.6.3) + rack (>= 1.0) + rails (5.0.0.1) + actioncable (= 5.0.0.1) + actionmailer (= 5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + activemodel (= 5.0.0.1) + activerecord (= 5.0.0.1) + activesupport (= 5.0.0.1) + bundler (>= 1.3.0, < 2.0) + railties (= 5.0.0.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.1) + activesupport (>= 4.2.0, < 6.0) + nokogiri (~> 1.6.0) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (5.0.0.1) + actionpack (= 5.0.0.1) + activesupport (= 5.0.0.1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (11.3.0) + ref (2.0.0) + sass (3.4.22) + sass-rails (5.0.6) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + sprockets (3.7.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.11) + sqlite3 (1.3.11-x86-mingw32) + therubyracer (0.12.2) + libv8 (~> 3.16.14.0) + ref + thor (0.19.1) + thread_safe (0.3.5) + tilt (2.0.5) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) + tzinfo-data (1.2016.6) + tzinfo (>= 1.0.0) + uglifier (3.0.2) + execjs (>= 0.3.0, < 3) + web-console (3.3.1) + actionview (>= 5.0) + activemodel (>= 5.0) + debug_inspector + railties (>= 5.0) + websocket-driver (0.6.4) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) + +PLATFORMS + ruby + x86-mingw32 + +DEPENDENCIES + byebug + coffee-rails (~> 4.2) + jbuilder (~> 2.5) + jquery-rails + puma (~> 3.0) + rails (~> 5.0.0, >= 5.0.0.1) + sass-rails (~> 5.0) + sqlite3 + therubyracer + turbolinks (~> 5) + tzinfo-data + uglifier (>= 1.3.0) + web-console + +BUNDLED WITH + 1.13.1 diff --git a/README.md b/README.md index d573a30..7db80e4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,24 @@ -# Team Manager +# README -This application is the Team Manager application for the Web Application -Architectures class. +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..e85f913 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative 'config/application' + +Rails.application.load_tasks diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..b16e53d --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/addresses.coffee b/app/assets/javascripts/addresses.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/addresses.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..b12018d --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/app/assets/javascripts/athletes.coffee b/app/assets/javascripts/athletes.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/athletes.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js new file mode 100644 index 0000000..71ee1e6 --- /dev/null +++ b/app/assets/javascripts/cable.js @@ -0,0 +1,13 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the rails generate channel command. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/coaches.coffee b/app/assets/javascripts/coaches.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/coaches.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/leagues.coffee b/app/assets/javascripts/leagues.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/leagues.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/managers.coffee b/app/assets/javascripts/managers.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/managers.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/parents.coffee b/app/assets/javascripts/parents.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/parents.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/people.coffee b/app/assets/javascripts/people.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/people.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/teams.coffee b/app/assets/javascripts/teams.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/teams.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/addresses.scss b/app/assets/stylesheets/addresses.scss new file mode 100644 index 0000000..2d3819e --- /dev/null +++ b/app/assets/stylesheets/addresses.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the addresses controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..0ebd7fe --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/app/assets/stylesheets/athletes.scss b/app/assets/stylesheets/athletes.scss new file mode 100644 index 0000000..9f38cb8 --- /dev/null +++ b/app/assets/stylesheets/athletes.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the athletes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/coaches.scss b/app/assets/stylesheets/coaches.scss new file mode 100644 index 0000000..7d97a41 --- /dev/null +++ b/app/assets/stylesheets/coaches.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the coaches controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/leagues.scss b/app/assets/stylesheets/leagues.scss new file mode 100644 index 0000000..4d3a3d8 --- /dev/null +++ b/app/assets/stylesheets/leagues.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the leagues controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/managers.scss b/app/assets/stylesheets/managers.scss new file mode 100644 index 0000000..ebf5d38 --- /dev/null +++ b/app/assets/stylesheets/managers.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the managers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/parents.scss b/app/assets/stylesheets/parents.scss new file mode 100644 index 0000000..8caaba7 --- /dev/null +++ b/app/assets/stylesheets/parents.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the parents controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/people.scss b/app/assets/stylesheets/people.scss new file mode 100644 index 0000000..e6ee13d --- /dev/null +++ b/app/assets/stylesheets/people.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the people controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss new file mode 100644 index 0000000..4ce4266 --- /dev/null +++ b/app/assets/stylesheets/scaffolds.scss @@ -0,0 +1,89 @@ +body { + background-color: #fff; + color: #333; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; + margin: 33px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; + margin: 33px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + + &:visited { + color: #666; + } + + &:hover { + color: #fff; + background-color: #000; + } +} + +th { + padding-bottom: 5px; +} + +td { + padding-bottom: 7px; + padding-left: 5px; + padding-right: 5px; +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px; + padding-bottom: 0; + margin-bottom: 20px; + background-color: #f0f0f0; + + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + margin-bottom: 0; + background-color: #c00; + color: #fff; + } + + ul li { + font-size: 12px; + list-style: square; + } +} + +label { + display: block; +} diff --git a/app/assets/stylesheets/teams.scss b/app/assets/stylesheets/teams.scss new file mode 100644 index 0000000..320d00d --- /dev/null +++ b/app/assets/stylesheets/teams.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the teams controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb new file mode 100644 index 0000000..d672697 --- /dev/null +++ b/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 0000000..0ff5442 --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/controllers/addresses_controller.rb b/app/controllers/addresses_controller.rb new file mode 100644 index 0000000..2fe9b78 --- /dev/null +++ b/app/controllers/addresses_controller.rb @@ -0,0 +1,74 @@ +class AddressesController < ApplicationController + before_action :set_address, only: [:show, :edit, :update, :destroy] + + # GET /addresses + # GET /addresses.json + def index + @addresses = Address.all + end + + # GET /addresses/1 + # GET /addresses/1.json + def show + end + + # GET /addresses/new + def new + @address = Address.new + end + + # GET /addresses/1/edit + def edit + end + + # POST /addresses + # POST /addresses.json + def create + @address = Address.new(address_params) + + respond_to do |format| + if @address.save + format.html { redirect_to @address, notice: 'Address was successfully created.' } + format.json { render :show, status: :created, location: @address } + else + format.html { render :new } + format.json { render json: @address.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /addresses/1 + # PATCH/PUT /addresses/1.json + def update + respond_to do |format| + if @address.update(address_params) + format.html { redirect_to @address, notice: 'Address was successfully updated.' } + format.json { render :show, status: :ok, location: @address } + else + format.html { render :edit } + format.json { render json: @address.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /addresses/1 + # DELETE /addresses/1.json + def destroy + @address.destroy + respond_to do |format| + format.html { redirect_to addresses_url, notice: 'Address was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_address + @address = Address.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def address_params + params.require(:address).permit(:addressline1, :addressline2, :city, :state, :zipcode, :country) + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..1c07694 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery with: :exception +end diff --git a/app/controllers/athletes_controller.rb b/app/controllers/athletes_controller.rb new file mode 100644 index 0000000..340dbe0 --- /dev/null +++ b/app/controllers/athletes_controller.rb @@ -0,0 +1,74 @@ +class AthletesController < ApplicationController + before_action :set_athlete, only: [:show, :edit, :update, :destroy] + + # GET /athletes + # GET /athletes.json + def index + @athletes = Athlete.all + end + + # GET /athletes/1 + # GET /athletes/1.json + def show + end + + # GET /athletes/new + def new + @athlete = Athlete.new + end + + # GET /athletes/1/edit + def edit + end + + # POST /athletes + # POST /athletes.json + def create + @athlete = Athlete.new(athlete_params) + + respond_to do |format| + if @athlete.save + format.html { redirect_to @athlete, notice: 'Athlete was successfully created.' } + format.json { render :show, status: :created, location: @athlete } + else + format.html { render :new } + format.json { render json: @athlete.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /athletes/1 + # PATCH/PUT /athletes/1.json + def update + respond_to do |format| + if @athlete.update(athlete_params) + format.html { redirect_to @athlete, notice: 'Athlete was successfully updated.' } + format.json { render :show, status: :ok, location: @athlete } + else + format.html { render :edit } + format.json { render json: @athlete.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /athletes/1 + # DELETE /athletes/1.json + def destroy + @athlete.destroy + respond_to do |format| + format.html { redirect_to athletes_url, notice: 'Athlete was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_athlete + @athlete = Athlete.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def athlete_params + params.require(:athlete).permit(:roster, :person_id, :leagueteam_id) + end +end diff --git a/app/controllers/coaches_controller.rb b/app/controllers/coaches_controller.rb new file mode 100644 index 0000000..55fc426 --- /dev/null +++ b/app/controllers/coaches_controller.rb @@ -0,0 +1,74 @@ +class CoachesController < ApplicationController + before_action :set_coach, only: [:show, :edit, :update, :destroy] + + # GET /coaches + # GET /coaches.json + def index + @coaches = Coach.all + end + + # GET /coaches/1 + # GET /coaches/1.json + def show + end + + # GET /coaches/new + def new + @coach = Coach.new + end + + # GET /coaches/1/edit + def edit + end + + # POST /coaches + # POST /coaches.json + def create + @coach = Coach.new(coach_params) + + respond_to do |format| + if @coach.save + format.html { redirect_to @coach, notice: 'Coach was successfully created.' } + format.json { render :show, status: :created, location: @coach } + else + format.html { render :new } + format.json { render json: @coach.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /coaches/1 + # PATCH/PUT /coaches/1.json + def update + respond_to do |format| + if @coach.update(coach_params) + format.html { redirect_to @coach, notice: 'Coach was successfully updated.' } + format.json { render :show, status: :ok, location: @coach } + else + format.html { render :edit } + format.json { render json: @coach.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /coaches/1 + # DELETE /coaches/1.json + def destroy + @coach.destroy + respond_to do |format| + format.html { redirect_to coaches_url, notice: 'Coach was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_coach + @coach = Coach.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def coach_params + params.require(:coach).permit(:license, :person_id, :leagueteam_id) + end +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/leagues_controller.rb b/app/controllers/leagues_controller.rb new file mode 100644 index 0000000..5832454 --- /dev/null +++ b/app/controllers/leagues_controller.rb @@ -0,0 +1,74 @@ +class LeaguesController < ApplicationController + before_action :set_league, only: [:show, :edit, :update, :destroy] + + # GET /leagues + # GET /leagues.json + def index + @leagues = League.all + end + + # GET /leagues/1 + # GET /leagues/1.json + def show + end + + # GET /leagues/new + def new + @league = League.new + end + + # GET /leagues/1/edit + def edit + end + + # POST /leagues + # POST /leagues.json + def create + @league = League.new(league_params) + + respond_to do |format| + if @league.save + format.html { redirect_to @league, notice: 'League was successfully created.' } + format.json { render :show, status: :created, location: @league } + else + format.html { render :new } + format.json { render json: @league.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /leagues/1 + # PATCH/PUT /leagues/1.json + def update + respond_to do |format| + if @league.update(league_params) + format.html { redirect_to @league, notice: 'League was successfully updated.' } + format.json { render :show, status: :ok, location: @league } + else + format.html { render :edit } + format.json { render json: @league.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /leagues/1 + # DELETE /leagues/1.json + def destroy + @league.destroy + respond_to do |format| + format.html { redirect_to leagues_url, notice: 'League was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_league + @league = League.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def league_params + params.require(:league).permit(:leaguename, :club) + end +end diff --git a/app/controllers/managers_controller.rb b/app/controllers/managers_controller.rb new file mode 100644 index 0000000..d60719b --- /dev/null +++ b/app/controllers/managers_controller.rb @@ -0,0 +1,74 @@ +class ManagersController < ApplicationController + before_action :set_manager, only: [:show, :edit, :update, :destroy] + + # GET /managers + # GET /managers.json + def index + @managers = Manager.all + end + + # GET /managers/1 + # GET /managers/1.json + def show + end + + # GET /managers/new + def new + @manager = Manager.new + end + + # GET /managers/1/edit + def edit + end + + # POST /managers + # POST /managers.json + def create + @manager = Manager.new(manager_params) + + respond_to do |format| + if @manager.save + format.html { redirect_to @manager, notice: 'Manager was successfully created.' } + format.json { render :show, status: :created, location: @manager } + else + format.html { render :new } + format.json { render json: @manager.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /managers/1 + # PATCH/PUT /managers/1.json + def update + respond_to do |format| + if @manager.update(manager_params) + format.html { redirect_to @manager, notice: 'Manager was successfully updated.' } + format.json { render :show, status: :ok, location: @manager } + else + format.html { render :edit } + format.json { render json: @manager.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /managers/1 + # DELETE /managers/1.json + def destroy + @manager.destroy + respond_to do |format| + format.html { redirect_to managers_url, notice: 'Manager was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_manager + @manager = Manager.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def manager_params + params.require(:manager).permit(:person_id, :leagueteam_id) + end +end diff --git a/app/controllers/parents_controller.rb b/app/controllers/parents_controller.rb new file mode 100644 index 0000000..270a016 --- /dev/null +++ b/app/controllers/parents_controller.rb @@ -0,0 +1,74 @@ +class ParentsController < ApplicationController + before_action :set_parent, only: [:show, :edit, :update, :destroy] + + # GET /parents + # GET /parents.json + def index + @parents = Parent.all + end + + # GET /parents/1 + # GET /parents/1.json + def show + end + + # GET /parents/new + def new + @parent = Parent.new + end + + # GET /parents/1/edit + def edit + end + + # POST /parents + # POST /parents.json + def create + @parent = Parent.new(parent_params) + + respond_to do |format| + if @parent.save + format.html { redirect_to @parent, notice: 'Parent was successfully created.' } + format.json { render :show, status: :created, location: @parent } + else + format.html { render :new } + format.json { render json: @parent.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /parents/1 + # PATCH/PUT /parents/1.json + def update + respond_to do |format| + if @parent.update(parent_params) + format.html { redirect_to @parent, notice: 'Parent was successfully updated.' } + format.json { render :show, status: :ok, location: @parent } + else + format.html { render :edit } + format.json { render json: @parent.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /parents/1 + # DELETE /parents/1.json + def destroy + @parent.destroy + respond_to do |format| + format.html { redirect_to parents_url, notice: 'Parent was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_parent + @parent = Parent.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def parent_params + params.require(:parent).permit(:person_id) + end +end diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb new file mode 100644 index 0000000..859629d --- /dev/null +++ b/app/controllers/people_controller.rb @@ -0,0 +1,74 @@ +class PeopleController < ApplicationController + before_action :set_person, only: [:show, :edit, :update, :destroy] + + # GET /people + # GET /people.json + def index + @people = Person.all + end + + # GET /people/1 + # GET /people/1.json + def show + end + + # GET /people/new + def new + @person = Person.new + end + + # GET /people/1/edit + def edit + end + + # POST /people + # POST /people.json + def create + @person = Person.new(person_params) + + respond_to do |format| + if @person.save + format.html { redirect_to @person, notice: 'Person was successfully created.' } + format.json { render :show, status: :created, location: @person } + else + format.html { render :new } + format.json { render json: @person.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /people/1 + # PATCH/PUT /people/1.json + def update + respond_to do |format| + if @person.update(person_params) + format.html { redirect_to @person, notice: 'Person was successfully updated.' } + format.json { render :show, status: :ok, location: @person } + else + format.html { render :edit } + format.json { render json: @person.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /people/1 + # DELETE /people/1.json + def destroy + @person.destroy + respond_to do |format| + format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_person + @person = Person.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def person_params + params.require(:person).permit(:firstname, :lastname, :email, :phone1, :phone2, :dateofbirth, :gender, :height, :weight, :jerseynum) + end +end diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb new file mode 100644 index 0000000..bc3f0ad --- /dev/null +++ b/app/controllers/teams_controller.rb @@ -0,0 +1,74 @@ +class TeamsController < ApplicationController + before_action :set_team, only: [:show, :edit, :update, :destroy] + + # GET /teams + # GET /teams.json + def index + @teams = Team.all + end + + # GET /teams/1 + # GET /teams/1.json + def show + end + + # GET /teams/new + def new + @team = Team.new + end + + # GET /teams/1/edit + def edit + end + + # POST /teams + # POST /teams.json + def create + @team = Team.new(team_params) + + respond_to do |format| + if @team.save + format.html { redirect_to @team, notice: 'Team was successfully created.' } + format.json { render :show, status: :created, location: @team } + else + format.html { render :new } + format.json { render json: @team.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /teams/1 + # PATCH/PUT /teams/1.json + def update + respond_to do |format| + if @team.update(team_params) + format.html { redirect_to @team, notice: 'Team was successfully updated.' } + format.json { render :show, status: :ok, location: @team } + else + format.html { render :edit } + format.json { render json: @team.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /teams/1 + # DELETE /teams/1.json + def destroy + @team.destroy + respond_to do |format| + format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_team + @team = Team.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def team_params + params.require(:team).permit(:teamname, :teamtype, :agegroup) + end +end diff --git a/app/helpers/addresses_helper.rb b/app/helpers/addresses_helper.rb new file mode 100644 index 0000000..5f4dc13 --- /dev/null +++ b/app/helpers/addresses_helper.rb @@ -0,0 +1,2 @@ +module AddressesHelper +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/athletes_helper.rb b/app/helpers/athletes_helper.rb new file mode 100644 index 0000000..2bc6949 --- /dev/null +++ b/app/helpers/athletes_helper.rb @@ -0,0 +1,2 @@ +module AthletesHelper +end diff --git a/app/helpers/coaches_helper.rb b/app/helpers/coaches_helper.rb new file mode 100644 index 0000000..4a533de --- /dev/null +++ b/app/helpers/coaches_helper.rb @@ -0,0 +1,2 @@ +module CoachesHelper +end diff --git a/app/helpers/leagues_helper.rb b/app/helpers/leagues_helper.rb new file mode 100644 index 0000000..cf00be6 --- /dev/null +++ b/app/helpers/leagues_helper.rb @@ -0,0 +1,2 @@ +module LeaguesHelper +end diff --git a/app/helpers/managers_helper.rb b/app/helpers/managers_helper.rb new file mode 100644 index 0000000..bc2ab9a --- /dev/null +++ b/app/helpers/managers_helper.rb @@ -0,0 +1,2 @@ +module ManagersHelper +end diff --git a/app/helpers/parents_helper.rb b/app/helpers/parents_helper.rb new file mode 100644 index 0000000..2b0361c --- /dev/null +++ b/app/helpers/parents_helper.rb @@ -0,0 +1,2 @@ +module ParentsHelper +end diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb new file mode 100644 index 0000000..b682fbf --- /dev/null +++ b/app/helpers/people_helper.rb @@ -0,0 +1,2 @@ +module PeopleHelper +end diff --git a/app/helpers/teams_helper.rb b/app/helpers/teams_helper.rb new file mode 100644 index 0000000..5fb41eb --- /dev/null +++ b/app/helpers/teams_helper.rb @@ -0,0 +1,2 @@ +module TeamsHelper +end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000..a009ace --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 0000000..286b223 --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/app/models/address.rb b/app/models/address.rb new file mode 100644 index 0000000..1b75e10 --- /dev/null +++ b/app/models/address.rb @@ -0,0 +1,4 @@ +class Address < ApplicationRecord + has_and_belongs_to_many :person + validates_presence_of :addressline1, :city, :state, :zipcode, :country +end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..10a4cba --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/athlete.rb b/app/models/athlete.rb new file mode 100644 index 0000000..207e2ec --- /dev/null +++ b/app/models/athlete.rb @@ -0,0 +1,4 @@ +class Athlete < ApplicationRecord + belongs_to :person + belongs_to :leagueteam +end diff --git a/app/models/coach.rb b/app/models/coach.rb new file mode 100644 index 0000000..14427de --- /dev/null +++ b/app/models/coach.rb @@ -0,0 +1,4 @@ +class Coach < ApplicationRecord + belongs_to :person + belongs_to :leagueteam +end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/league.rb b/app/models/league.rb new file mode 100644 index 0000000..3c59323 --- /dev/null +++ b/app/models/league.rb @@ -0,0 +1,6 @@ +class League < ApplicationRecord + has_and_belongs_to_many :teams + has_many :athletes + has_many :coaches + has_many :managers +end diff --git a/app/models/manager.rb b/app/models/manager.rb new file mode 100644 index 0000000..330b245 --- /dev/null +++ b/app/models/manager.rb @@ -0,0 +1,4 @@ +class Manager < ApplicationRecord + belongs_to :person + belongs_to :leagueteam +end diff --git a/app/models/parent.rb b/app/models/parent.rb new file mode 100644 index 0000000..afe3133 --- /dev/null +++ b/app/models/parent.rb @@ -0,0 +1,3 @@ +class Parent < ApplicationRecord + belongs_to :person +end diff --git a/app/models/person.rb b/app/models/person.rb new file mode 100644 index 0000000..c6e3d3b --- /dev/null +++ b/app/models/person.rb @@ -0,0 +1,12 @@ +class Person < ApplicationRecord + has_many :parents, dependent: :destroy + has_many :athletes, dependent: :destroy + has_many :coaches, dependent: :destroy + has_many :managers, dependent: :destroy + has_and_belongs_to_many :addresses, dependent: :destroy + validates_presence_of :firstname + validates_presence_of :lastname + validates_presence_of :email + validates_presence_of :phone1 + validates_presence_of :gender +end diff --git a/app/models/team.rb b/app/models/team.rb new file mode 100644 index 0000000..dce2384 --- /dev/null +++ b/app/models/team.rb @@ -0,0 +1,7 @@ +class Team < ApplicationRecord + has_and_belongs_to_many :leagues + has_many :athletes + has_many :coaches + has_many :managers + validates_presence_of :teamname, :teamtype, :agegroup +end diff --git a/app/views/addresses/_address.json.jbuilder b/app/views/addresses/_address.json.jbuilder new file mode 100644 index 0000000..bd53e69 --- /dev/null +++ b/app/views/addresses/_address.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! address, :id, :addressline1, :addressline2, :city, :state, :zipcode, :country, :created_at, :updated_at +json.url address_url(address, format: :json) \ No newline at end of file diff --git a/app/views/addresses/_form.html.erb b/app/views/addresses/_form.html.erb new file mode 100644 index 0000000..d6bfcd1 --- /dev/null +++ b/app/views/addresses/_form.html.erb @@ -0,0 +1,47 @@ +<%= form_for(address) do |f| %> + <% if address.errors.any? %> +
<%= notice %>
+ +| Addressline1 | +Addressline2 | +City | +State | +Zipcode | +Country | ++ | ||
|---|---|---|---|---|---|---|---|---|
| <%= address.addressline1 %> | +<%= address.addressline2 %> | +<%= address.city %> | +<%= address.state %> | +<%= address.zipcode %> | +<%= address.country %> | +<%= link_to 'Show', address %> | +<%= link_to 'Edit', edit_address_path(address) %> | +<%= link_to 'Destroy', address, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Addressline1: + <%= @address.addressline1 %> +
+ ++ Addressline2: + <%= @address.addressline2 %> +
+ ++ City: + <%= @address.city %> +
+ ++ State: + <%= @address.state %> +
+ ++ Zipcode: + <%= @address.zipcode %> +
+ ++ Country: + <%= @address.country %> +
+ +<%= link_to 'Edit', edit_address_path(@address) %> | +<%= link_to 'Back', addresses_path %> diff --git a/app/views/addresses/show.json.jbuilder b/app/views/addresses/show.json.jbuilder new file mode 100644 index 0000000..e47c94a --- /dev/null +++ b/app/views/addresses/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "addresses/address", address: @address \ No newline at end of file diff --git a/app/views/athletes/_athlete.json.jbuilder b/app/views/athletes/_athlete.json.jbuilder new file mode 100644 index 0000000..5ca2f9b --- /dev/null +++ b/app/views/athletes/_athlete.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! athlete, :id, :roster, :person_id, :leagueteam_id, :created_at, :updated_at +json.url athlete_url(athlete, format: :json) \ No newline at end of file diff --git a/app/views/athletes/_form.html.erb b/app/views/athletes/_form.html.erb new file mode 100644 index 0000000..3346d37 --- /dev/null +++ b/app/views/athletes/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_for(athlete) do |f| %> + <% if athlete.errors.any? %> +<%= notice %>
+ +| Roster | +Person | +Leagueteam | ++ | ||
|---|---|---|---|---|---|
| <%= athlete.roster %> | +<%= athlete.person %> | +<%= athlete.leagueteam %> | +<%= link_to 'Show', athlete %> | +<%= link_to 'Edit', edit_athlete_path(athlete) %> | +<%= link_to 'Destroy', athlete, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Roster: + <%= @athlete.roster %> +
+ ++ Person: + <%= @athlete.person %> +
+ ++ Leagueteam: + <%= @athlete.leagueteam %> +
+ +<%= link_to 'Edit', edit_athlete_path(@athlete) %> | +<%= link_to 'Back', athletes_path %> diff --git a/app/views/athletes/show.json.jbuilder b/app/views/athletes/show.json.jbuilder new file mode 100644 index 0000000..8e9ca79 --- /dev/null +++ b/app/views/athletes/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "athletes/athlete", athlete: @athlete \ No newline at end of file diff --git a/app/views/coaches/_coach.json.jbuilder b/app/views/coaches/_coach.json.jbuilder new file mode 100644 index 0000000..f1dfde3 --- /dev/null +++ b/app/views/coaches/_coach.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! coach, :id, :license, :person_id, :leagueteam_id, :created_at, :updated_at +json.url coach_url(coach, format: :json) \ No newline at end of file diff --git a/app/views/coaches/_form.html.erb b/app/views/coaches/_form.html.erb new file mode 100644 index 0000000..33e0e0b --- /dev/null +++ b/app/views/coaches/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_for(coach) do |f| %> + <% if coach.errors.any? %> +<%= notice %>
+ +| License | +Person | +Leagueteam | ++ | ||
|---|---|---|---|---|---|
| <%= coach.license %> | +<%= coach.person %> | +<%= coach.leagueteam %> | +<%= link_to 'Show', coach %> | +<%= link_to 'Edit', edit_coach_path(coach) %> | +<%= link_to 'Destroy', coach, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ License: + <%= @coach.license %> +
+ ++ Person: + <%= @coach.person %> +
+ ++ Leagueteam: + <%= @coach.leagueteam %> +
+ +<%= link_to 'Edit', edit_coach_path(@coach) %> | +<%= link_to 'Back', coaches_path %> diff --git a/app/views/coaches/show.json.jbuilder b/app/views/coaches/show.json.jbuilder new file mode 100644 index 0000000..00a9132 --- /dev/null +++ b/app/views/coaches/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "coaches/coach", coach: @coach \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..7d49807 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + +<%= notice %>
+ +| Leaguename | +Club | ++ | ||
|---|---|---|---|---|
| <%= league.leaguename %> | +<%= league.club %> | +<%= link_to 'Show', league %> | +<%= link_to 'Edit', edit_league_path(league) %> | +<%= link_to 'Destroy', league, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Leaguename: + <%= @league.leaguename %> +
+ ++ Club: + <%= @league.club %> +
+ +<%= link_to 'Edit', edit_league_path(@league) %> | +<%= link_to 'Back', leagues_path %> diff --git a/app/views/leagues/show.json.jbuilder b/app/views/leagues/show.json.jbuilder new file mode 100644 index 0000000..aeef5be --- /dev/null +++ b/app/views/leagues/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "leagues/league", league: @league \ No newline at end of file diff --git a/app/views/managers/_form.html.erb b/app/views/managers/_form.html.erb new file mode 100644 index 0000000..2a8b5ae --- /dev/null +++ b/app/views/managers/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_for(manager) do |f| %> + <% if manager.errors.any? %> +<%= notice %>
+ +| Person | +Leagueteam | ++ | ||
|---|---|---|---|---|
| <%= manager.person %> | +<%= manager.leagueteam %> | +<%= link_to 'Show', manager %> | +<%= link_to 'Edit', edit_manager_path(manager) %> | +<%= link_to 'Destroy', manager, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Person: + <%= @manager.person %> +
+ ++ Leagueteam: + <%= @manager.leagueteam %> +
+ +<%= link_to 'Edit', edit_manager_path(@manager) %> | +<%= link_to 'Back', managers_path %> diff --git a/app/views/managers/show.json.jbuilder b/app/views/managers/show.json.jbuilder new file mode 100644 index 0000000..8428a61 --- /dev/null +++ b/app/views/managers/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "managers/manager", manager: @manager \ No newline at end of file diff --git a/app/views/parents/_form.html.erb b/app/views/parents/_form.html.erb new file mode 100644 index 0000000..651e1f8 --- /dev/null +++ b/app/views/parents/_form.html.erb @@ -0,0 +1,22 @@ +<%= form_for(parent) do |f| %> + <% if parent.errors.any? %> +<%= notice %>
+ +| Person | ++ | ||
|---|---|---|---|
| <%= parent.person %> | +<%= link_to 'Show', parent %> | +<%= link_to 'Edit', edit_parent_path(parent) %> | +<%= link_to 'Destroy', parent, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Person: + <%= @parent.person %> +
+ +<%= link_to 'Edit', edit_parent_path(@parent) %> | +<%= link_to 'Back', parents_path %> diff --git a/app/views/parents/show.json.jbuilder b/app/views/parents/show.json.jbuilder new file mode 100644 index 0000000..2dd2d4b --- /dev/null +++ b/app/views/parents/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "parents/parent", parent: @parent \ No newline at end of file diff --git a/app/views/people/_form.html.erb b/app/views/people/_form.html.erb new file mode 100644 index 0000000..d9fe12e --- /dev/null +++ b/app/views/people/_form.html.erb @@ -0,0 +1,67 @@ +<%= form_for(person) do |f| %> + <% if person.errors.any? %> +<%= notice %>
+ +| Firstname | +Lastname | +Phone1 | +Phone2 | +Dateofbirth | +Gender | +Height | +Weight | +Jerseynum | ++ | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <%= person.firstname %> | +<%= person.lastname %> | +<%= person.email %> | +<%= person.phone1 %> | +<%= person.phone2 %> | +<%= person.dateofbirth %> | +<%= person.gender %> | +<%= person.height %> | +<%= person.weight %> | +<%= person.jerseynum %> | +<%= link_to 'Show', person %> | +<%= link_to 'Edit', edit_person_path(person) %> | +<%= link_to 'Destroy', person, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Firstname: + <%= @person.firstname %> +
+ ++ Lastname: + <%= @person.lastname %> +
+ ++ Email: + <%= @person.email %> +
+ ++ Phone1: + <%= @person.phone1 %> +
+ ++ Phone2: + <%= @person.phone2 %> +
+ ++ Dateofbirth: + <%= @person.dateofbirth %> +
+ ++ Gender: + <%= @person.gender %> +
+ ++ Height: + <%= @person.height %> +
+ ++ Weight: + <%= @person.weight %> +
+ ++ Jerseynum: + <%= @person.jerseynum %> +
+ +<%= link_to 'Edit', edit_person_path(@person) %> | +<%= link_to 'Back', people_path %> diff --git a/app/views/people/show.json.jbuilder b/app/views/people/show.json.jbuilder new file mode 100644 index 0000000..727d7ec --- /dev/null +++ b/app/views/people/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "people/person", person: @person \ No newline at end of file diff --git a/app/views/teams/_form.html.erb b/app/views/teams/_form.html.erb new file mode 100644 index 0000000..7594039 --- /dev/null +++ b/app/views/teams/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_for(team) do |f| %> + <% if team.errors.any? %> +<%= notice %>
+ +| Teamname | +Teamtype | +Agegroup | ++ | ||
|---|---|---|---|---|---|
| <%= team.teamname %> | +<%= team.teamtype %> | +<%= team.agegroup %> | +<%= link_to 'Show', team %> | +<%= link_to 'Edit', edit_team_path(team) %> | +<%= link_to 'Destroy', team, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Teamname: + <%= @team.teamname %> +
+ ++ Teamtype: + <%= @team.teamtype %> +
+ ++ Agegroup: + <%= @team.agegroup %> +
+ +<%= link_to 'Edit', edit_team_path(@team) %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.json.jbuilder b/app/views/teams/show.json.jbuilder new file mode 100644 index 0000000..8a3edb3 --- /dev/null +++ b/app/views/teams/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "teams/team", team: @team \ No newline at end of file diff --git a/artifacts/organization.mwb b/artifacts/organization.mwb new file mode 100644 index 0000000..00847c8 Binary files /dev/null and b/artifacts/organization.mwb differ diff --git a/bin/bundle b/bin/bundle new file mode 100644 index 0000000..e3c2f62 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby.exe +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100644 index 0000000..bec72ac --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby.exe +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100644 index 0000000..f6ed5a2 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby.exe +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100644 index 0000000..929edb7 --- /dev/null +++ b/bin/setup @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby.exe +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/update b/bin/update new file mode 100644 index 0000000..deb1df2 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby.exe +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..f7ba0b5 --- /dev/null +++ b/config.ru @@ -0,0 +1,5 @@ +# This file is used by Rack-based servers to start the application. + +require_relative 'config/environment' + +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..0ee0d35 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,15 @@ +require_relative 'boot' + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module AthleteTeam + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..30f5120 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..0bbde6f --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,9 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..426333b --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..e64889c --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,54 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Suppress logger output for asset requests. + config.assets.quiet = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..c9ad47a --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,86 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "Athlete_Team_#{Rails.env}" + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..30587ef --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=3600' + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000..51639b6 --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..5a6a32d --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 0000000..0706caf --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,24 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Read the Rails 5.0 release notes for more info on each option. + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = true + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = true + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = true + +# Require `belongs_to` associations by default. Previous versions had false. +Rails.application.config.active_record.belongs_to_required_by_default = true + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Previous versions had false. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..84405ee --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_Athlete_Team_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..bbfc396 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..c7f311f --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,47 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..1635d8a --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,11 @@ +Rails.application.routes.draw do + resources :addresses + resources :parents + resources :managers + resources :coaches + resources :athletes + resources :leagues + resources :teams + resources :people + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html +end diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..9b094c3 --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: df682c880996e98a816829e4a9e88a15f940a2fcf50f9f646295f329e6937343dd6ce79cd15213fc9d73faa1af95d1b13b27d290af8d5eaa5b68d5825b7e2034 + +test: + secret_key_base: dc53ab24c794ea96f7fba8bbf5910101e347fb47e5ad8da8cc5eef6d793c54245cfd7a666bab9f29fd210ebd009585dce3b498edc93bdb4453e126915c4f710b + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/db/migrate/20160927223712_create_people.rb b/db/migrate/20160927223712_create_people.rb new file mode 100644 index 0000000..0933161 --- /dev/null +++ b/db/migrate/20160927223712_create_people.rb @@ -0,0 +1,18 @@ +class CreatePeople < ActiveRecord::Migration[5.0] + def change + create_table :people do |t| + t.string :firstname + t.string :lastname + t.string :email + t.integer :phone1 + t.integer :phone2 + t.date :dateofbirth + t.string :gender + t.string :height + t.string :weight + t.integer :jerseynum + + t.timestamps + end + end +end diff --git a/db/migrate/20160927223949_create_teams.rb b/db/migrate/20160927223949_create_teams.rb new file mode 100644 index 0000000..1acf1c7 --- /dev/null +++ b/db/migrate/20160927223949_create_teams.rb @@ -0,0 +1,11 @@ +class CreateTeams < ActiveRecord::Migration[5.0] + def change + create_table :teams do |t| + t.string :teamname + t.string :teamtype + t.string :agegroup + + t.timestamps + end + end +end diff --git a/db/migrate/20160927224333_create_leagues.rb b/db/migrate/20160927224333_create_leagues.rb new file mode 100644 index 0000000..5cf46cb --- /dev/null +++ b/db/migrate/20160927224333_create_leagues.rb @@ -0,0 +1,10 @@ +class CreateLeagues < ActiveRecord::Migration[5.0] + def change + create_table :leagues do |t| + t.string :leaguename + t.string :club + + t.timestamps + end + end +end diff --git a/db/migrate/20160927225120_create_athletes.rb b/db/migrate/20160927225120_create_athletes.rb new file mode 100644 index 0000000..adf6075 --- /dev/null +++ b/db/migrate/20160927225120_create_athletes.rb @@ -0,0 +1,11 @@ +class CreateAthletes < ActiveRecord::Migration[5.0] + def change + create_table :athletes do |t| + t.string :roster + t.references :person, foreign_key: true + t.references :leagueteam, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20160927225256_create_coaches.rb b/db/migrate/20160927225256_create_coaches.rb new file mode 100644 index 0000000..c2cefbb --- /dev/null +++ b/db/migrate/20160927225256_create_coaches.rb @@ -0,0 +1,11 @@ +class CreateCoaches < ActiveRecord::Migration[5.0] + def change + create_table :coaches do |t| + t.string :license + t.references :person, foreign_key: true + t.references :leagueteam, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20160927225328_create_managers.rb b/db/migrate/20160927225328_create_managers.rb new file mode 100644 index 0000000..b579929 --- /dev/null +++ b/db/migrate/20160927225328_create_managers.rb @@ -0,0 +1,10 @@ +class CreateManagers < ActiveRecord::Migration[5.0] + def change + create_table :managers do |t| + t.references :person, foreign_key: true + t.references :leagueteam, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20160927225409_create_parents.rb b/db/migrate/20160927225409_create_parents.rb new file mode 100644 index 0000000..3b3f6b7 --- /dev/null +++ b/db/migrate/20160927225409_create_parents.rb @@ -0,0 +1,9 @@ +class CreateParents < ActiveRecord::Migration[5.0] + def change + create_table :parents do |t| + t.references :person, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20160927230344_create_addresses.rb b/db/migrate/20160927230344_create_addresses.rb new file mode 100644 index 0000000..d16e927 --- /dev/null +++ b/db/migrate/20160927230344_create_addresses.rb @@ -0,0 +1,14 @@ +class CreateAddresses < ActiveRecord::Migration[5.0] + def change + create_table :addresses do |t| + t.string :addressline1 + t.string :addressline2 + t.string :city + t.string :state + t.integer :zipcode + t.string :country + + t.timestamps + end + end +end diff --git a/db/migrate/20160928072926_create_join_table_people_adresses.rb b/db/migrate/20160928072926_create_join_table_people_adresses.rb new file mode 100644 index 0000000..fe97562 --- /dev/null +++ b/db/migrate/20160928072926_create_join_table_people_adresses.rb @@ -0,0 +1,8 @@ +class CreateJoinTablePeopleAdresses < ActiveRecord::Migration[5.0] + def change + create_join_table :people, :addresses do |t| + # t.index [:person_id, :address_id] + # t.index [:address_id, :person_id] + end + end +end diff --git a/db/migrate/20160928072949_create_join_table_teams_leagues.rb b/db/migrate/20160928072949_create_join_table_teams_leagues.rb new file mode 100644 index 0000000..1f29759 --- /dev/null +++ b/db/migrate/20160928072949_create_join_table_teams_leagues.rb @@ -0,0 +1,8 @@ +class CreateJoinTableTeamsLeagues < ActiveRecord::Migration[5.0] + def change + create_join_table :teams, :leagues do |t| + # t.index [:team_id, :league_id] + # t.index [:league_id, :team_id] + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..a5e03bd --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,102 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20160928072949) do + + create_table "addresses", force: :cascade do |t| + t.string "addressline1" + t.string "addressline2" + t.string "city" + t.string "state" + t.integer "zipcode" + t.string "country" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "addresses_people", id: false, force: :cascade do |t| + t.integer "person_id", null: false + t.integer "address_id", null: false + end + + create_table "athletes", force: :cascade do |t| + t.string "roster" + t.integer "person_id" + t.integer "leagueteam_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["leagueteam_id"], name: "index_athletes_on_leagueteam_id" + t.index ["person_id"], name: "index_athletes_on_person_id" + end + + create_table "coaches", force: :cascade do |t| + t.string "license" + t.integer "person_id" + t.integer "leagueteam_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["leagueteam_id"], name: "index_coaches_on_leagueteam_id" + t.index ["person_id"], name: "index_coaches_on_person_id" + end + + create_table "leagues", force: :cascade do |t| + t.string "leaguename" + t.string "club" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "leagues_teams", id: false, force: :cascade do |t| + t.integer "team_id", null: false + t.integer "league_id", null: false + end + + create_table "managers", force: :cascade do |t| + t.integer "person_id" + t.integer "leagueteam_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["leagueteam_id"], name: "index_managers_on_leagueteam_id" + t.index ["person_id"], name: "index_managers_on_person_id" + end + + create_table "parents", force: :cascade do |t| + t.integer "person_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["person_id"], name: "index_parents_on_person_id" + end + + create_table "people", force: :cascade do |t| + t.string "firstname" + t.string "lastname" + t.string "email" + t.integer "phone1" + t.integer "phone2" + t.date "dateofbirth" + t.string "gender" + t.string "height" + t.string "weight" + t.integer "jerseynum" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "teams", force: :cascade do |t| + t.string "teamname" + t.string "teamtype" + t.string "agegroup" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..1beea2a --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). +# +# Examples: +# +# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) +# Character.create(name: 'Luke', movie: movies.first) diff --git a/erd.png b/erd.png new file mode 100644 index 0000000..1e2203f Binary files /dev/null and b/erd.png differ diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/log/.keep b/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/public/404.html @@ -0,0 +1,67 @@ + + + +You may have mistyped the address or the page may have moved.
+If you are the application owner check the logs for more information.
+Maybe you tried to change something you didn't have access to.
+If you are the application owner check the logs for more information.
+If you are the application owner check the logs for more information.
+