From abb97043609b2263ab51d75d5436ef97b536df4c Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 13:49:57 -0700 Subject: [PATCH 01/47] created rails app --- .gitignore | 46 ++--- Gemfile | 47 +++++ Gemfile.lock | 163 ++++++++++++++++++ README.rdoc | 28 +++ Rakefile | 6 + app/assets/images/.keep | 0 app/assets/javascripts/application.js | 16 ++ app/assets/stylesheets/application.css | 15 ++ app/controllers/application_controller.rb | 5 + app/controllers/concerns/.keep | 0 app/helpers/application_helper.rb | 2 + app/mailers/.keep | 0 app/models/.keep | 0 app/models/concerns/.keep | 0 app/views/layouts/application.html.erb | 14 ++ bin/bundle | 3 + bin/rails | 9 + bin/rake | 9 + bin/setup | 29 ++++ bin/spring | 15 ++ config.ru | 4 + config/application.rb | 26 +++ config/boot.rb | 3 + config/database.yml | 25 +++ config/environment.rb | 5 + config/environments/development.rb | 41 +++++ config/environments/production.rb | 79 +++++++++ config/environments/test.rb | 42 +++++ config/initializers/assets.rb | 11 ++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/cookies_serializer.rb | 3 + .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 ++ config/initializers/mime_types.rb | 4 + config/initializers/session_store.rb | 3 + config/initializers/wrap_parameters.rb | 14 ++ config/locales/en.yml | 23 +++ config/routes.rb | 56 ++++++ config/secrets.yml | 22 +++ db/seeds.rb | 7 + lib/assets/.keep | 0 lib/tasks/.keep | 0 log/.keep | 0 public/404.html | 67 +++++++ public/422.html | 67 +++++++ public/500.html | 66 +++++++ public/favicon.ico | 0 public/robots.txt | 5 + test/controllers/.keep | 0 test/fixtures/.keep | 0 test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/test_helper.rb | 10 ++ vendor/assets/javascripts/.keep | 0 vendor/assets/stylesheets/.keep | 0 57 files changed, 985 insertions(+), 32 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/helpers/application_helper.rb create mode 100644 app/mailers/.keep create mode 100644 app/models/.keep create mode 100644 app/models/concerns/.keep create mode 100644 app/views/layouts/application.html.erb create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/setup create mode 100755 bin/spring create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 config/secrets.yml create mode 100644 db/seeds.rb create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 log/.keep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 test/controllers/.keep create mode 100644 test/fixtures/.keep create mode 100644 test/helpers/.keep create mode 100644 test/integration/.keep create mode 100644 test/mailers/.keep create mode 100644 test/models/.keep create mode 100644 test/test_helper.rb create mode 100644 vendor/assets/javascripts/.keep create mode 100644 vendor/assets/stylesheets/.keep diff --git a/.gitignore b/.gitignore index 28f484983..050c9d95c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,35 +1,17 @@ -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/test/tmp/ -/test/version_tmp/ -/tmp/ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' -## Specific to RubyMotion: -.dat* -.repl_history -build/ +# Ignore bundler config. +/.bundle -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal -## Environment normalisation: -/.bundle/ -/vendor/bundle -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..e87fad5fc --- /dev/null +++ b/Gemfile @@ -0,0 +1,47 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.7' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# 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.1.0' +# 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 following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc + +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# 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' +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..187046034 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,163 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.7) + actionpack (= 4.2.7) + actionview (= 4.2.7) + activejob (= 4.2.7) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.7) + actionview (= 4.2.7) + activesupport (= 4.2.7) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.7) + activesupport (= 4.2.7) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.7) + activesupport (= 4.2.7) + globalid (>= 0.3.0) + activemodel (4.2.7) + activesupport (= 4.2.7) + builder (~> 3.1) + activerecord (4.2.7) + activemodel (= 4.2.7) + activesupport (= 4.2.7) + arel (~> 6.0) + activesupport (4.2.7) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.3) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + byebug (9.0.5) + coffee-rails (4.1.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.1.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) + json (1.8.3) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.4) + mime-types (>= 1.16, < 4) + 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) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) + pkg-config (1.1.7) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.7) + actionmailer (= 4.2.7) + actionpack (= 4.2.7) + actionview (= 4.2.7) + activejob (= 4.2.7) + activemodel (= 4.2.7) + activerecord (= 4.2.7) + activesupport (= 4.2.7) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.7) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (4.2.7) + actionpack (= 4.2.7) + activesupport (= 4.2.7) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (11.3.0) + rdoc (4.2.2) + json (~> 1.4) + 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) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + spring (1.7.2) + 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) + 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) + uglifier (3.0.2) + execjs (>= 0.3.0, < 3) + web-console (2.3.0) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + rails (= 4.2.7) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.13.1 diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 000000000..dd4e97e22 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,28 @@ +== README + +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 + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/Rakefile b/Rakefile new file mode 100644 index 000000000..ba6b733dd --- /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 File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 000000000..e07c5a830 --- /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. +// +// 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/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 000000000..f9cd5b348 --- /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 styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 000000000..d83690e1b --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 000000000..de6be7945 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/mailers/.keep b/app/mailers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/models/.keep b/app/models/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 000000000..46eeb110b --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + TaskListRails + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 000000000..66e9889e8 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +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 100755 index 000000000..0138d79b7 --- /dev/null +++ b/bin/rails @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 000000000..d87d5f578 --- /dev/null +++ b/bin/rake @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 000000000..acdb2c138 --- /dev/null +++ b/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.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 || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/bin/spring b/bin/spring new file mode 100755 index 000000000..7fe232c3a --- /dev/null +++ b/bin/spring @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require 'rubygems' + require 'bundler' + + if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) + Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } + gem 'spring', match[1] + require 'spring/binstub' + end +end diff --git a/config.ru b/config.ru new file mode 100644 index 000000000..bd83b2541 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 000000000..902432bad --- /dev/null +++ b/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +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 TaskListRails + 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. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 000000000..6b750f00b --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 000000000..1c1a37ca8 --- /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 000000000..ee8d90dc6 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 000000000..b55e2144b --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,41 @@ +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 and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = 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 + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 000000000..5c1b32e48 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,79 @@ +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 + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = 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 + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # 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 + + # 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 = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # 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 + + # 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 000000000..1c19f08b2 --- /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 static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_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 + + # 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 + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # 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/assets.rb b/config/initializers/assets.rb new file mode 100644 index 000000000..01ef3e663 --- /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 000000000..59385cdf3 --- /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 000000000..7f70458de --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +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 000000000..4a994e1e7 --- /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 000000000..ac033bf9d --- /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 000000000..dc1899682 --- /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/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 000000000..15d065a84 --- /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: '_TaskListRails_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 000000000..33725e95f --- /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] if respond_to?(:wrap_parameters) +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 000000000..065395716 --- /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/routes.rb b/config/routes.rb new file mode 100644 index 000000000..3f66539d5 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,56 @@ +Rails.application.routes.draw do + # The priority is based upon order of creation: first created -> highest priority. + # See how all your routes lay out with "rake routes". + + # You can have the root of your site routed with "root" + # root 'welcome#index' + + # Example of regular route: + # get 'products/:id' => 'catalog#view' + + # Example of named route that can be invoked with purchase_url(id: product.id) + # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase + + # Example resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Example resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Example resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Example resource route with more complex sub-resources: + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', on: :collection + # end + # end + + # Example resource route with concerns: + # concern :toggleable do + # post 'toggle' + # end + # resources :posts, concerns: :toggleable + # resources :photos, concerns: :toggleable + + # Example resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end +end diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 000000000..6d2fcb1fe --- /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 `rake 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: c55096e1452a0dc896cf1a7bc96a295fc2cecf490d60e204218177b0c23d0d811c93e27d125685ae5d66e7bba4f60d98e779cd31db50251d3f48f3b457656f47 + +test: + secret_key_base: ccd7ac321070304ba099562d545c30e20c8e9f10ca391214b7713bfd8ba82376e80b82af93e6f3f0890fb1e13fa27f30e28490acf9cbb2f08d5ea2382aec1778 + +# 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/seeds.rb b/db/seeds.rb new file mode 100644 index 000000000..4edb1e857 --- /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 rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/log/.keep b/log/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/public/404.html b/public/404.html new file mode 100644 index 000000000..b612547fc --- /dev/null +++ b/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 000000000..a21f82b3b --- /dev/null +++ b/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 000000000..061abc587 --- /dev/null +++ b/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 000000000..e69de29bb diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 000000000..3c9c7c01f --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 000000000..92e39b2d7 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep new file mode 100644 index 000000000..e69de29bb From f0165341319ce211f2cb90864384232a3056d664 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 14:06:30 -0700 Subject: [PATCH 02/47] created controller for tasks --- app/assets/javascripts/tasks.coffee | 3 +++ app/assets/stylesheets/tasks.scss | 3 +++ app/controllers/tasks_controller.rb | 16 +++++++++++++ app/helpers/tasks_helper.rb | 2 ++ app/views/tasks/delete.html.erb | 2 ++ app/views/tasks/index.html.erb | 2 ++ app/views/tasks/new.html.erb | 2 ++ app/views/tasks/show.html.erb | 2 ++ app/views/tasks/update.html.erb | 2 ++ config/routes.rb | 10 ++++++++ test/controllers/tasks_controller_test.rb | 29 +++++++++++++++++++++++ 11 files changed, 73 insertions(+) create mode 100644 app/assets/javascripts/tasks.coffee create mode 100644 app/assets/stylesheets/tasks.scss create mode 100644 app/controllers/tasks_controller.rb create mode 100644 app/helpers/tasks_helper.rb create mode 100644 app/views/tasks/delete.html.erb create mode 100644 app/views/tasks/index.html.erb create mode 100644 app/views/tasks/new.html.erb create mode 100644 app/views/tasks/show.html.erb create mode 100644 app/views/tasks/update.html.erb create mode 100644 test/controllers/tasks_controller_test.rb diff --git a/app/assets/javascripts/tasks.coffee b/app/assets/javascripts/tasks.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/tasks.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/tasks.scss b/app/assets/stylesheets/tasks.scss new file mode 100644 index 000000000..c5e7712d4 --- /dev/null +++ b/app/assets/stylesheets/tasks.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Tasks controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb new file mode 100644 index 000000000..9621fb185 --- /dev/null +++ b/app/controllers/tasks_controller.rb @@ -0,0 +1,16 @@ +class TasksController < ApplicationController + def index + end + + def new + end + + def update + end + + def delete + end + + def show + end +end diff --git a/app/helpers/tasks_helper.rb b/app/helpers/tasks_helper.rb new file mode 100644 index 000000000..ce894d00c --- /dev/null +++ b/app/helpers/tasks_helper.rb @@ -0,0 +1,2 @@ +module TasksHelper +end diff --git a/app/views/tasks/delete.html.erb b/app/views/tasks/delete.html.erb new file mode 100644 index 000000000..ea72c29cf --- /dev/null +++ b/app/views/tasks/delete.html.erb @@ -0,0 +1,2 @@ +

Tasks#delete

+

Find me in app/views/tasks/delete.html.erb

diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb new file mode 100644 index 000000000..b16c10310 --- /dev/null +++ b/app/views/tasks/index.html.erb @@ -0,0 +1,2 @@ +

Tasks#index

+

Find me in app/views/tasks/index.html.erb

diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb new file mode 100644 index 000000000..2484008a3 --- /dev/null +++ b/app/views/tasks/new.html.erb @@ -0,0 +1,2 @@ +

Tasks#new

+

Find me in app/views/tasks/new.html.erb

diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb new file mode 100644 index 000000000..1139224db --- /dev/null +++ b/app/views/tasks/show.html.erb @@ -0,0 +1,2 @@ +

Tasks#show

+

Find me in app/views/tasks/show.html.erb

diff --git a/app/views/tasks/update.html.erb b/app/views/tasks/update.html.erb new file mode 100644 index 000000000..fdb1ea609 --- /dev/null +++ b/app/views/tasks/update.html.erb @@ -0,0 +1,2 @@ +

Tasks#update

+

Find me in app/views/tasks/update.html.erb

diff --git a/config/routes.rb b/config/routes.rb index 3f66539d5..fd016ed21 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,14 @@ Rails.application.routes.draw do + get 'tasks/index' + + get 'tasks/new' + + get 'tasks/update' + + get 'tasks/delete' + + get 'tasks/show' + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/test/controllers/tasks_controller_test.rb b/test/controllers/tasks_controller_test.rb new file mode 100644 index 000000000..dffa5f67c --- /dev/null +++ b/test/controllers/tasks_controller_test.rb @@ -0,0 +1,29 @@ +require 'test_helper' + +class TasksControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + + test "should get new" do + get :new + assert_response :success + end + + test "should get update" do + get :update + assert_response :success + end + + test "should get delete" do + get :delete + assert_response :success + end + + test "should get show" do + get :show + assert_response :success + end + +end From 737e405401b3faabf990fdf269d946b059c0c46e Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 14:59:02 -0700 Subject: [PATCH 03/47] finished Wave 1, started Wave 2. forgot to commit earlier... --- app/controllers/tasks_controller.rb | 36 ++++++++++++++++++- app/views/tasks/create.html.erb | 2 ++ .../{delete.html.erb => destroy.html.erb} | 0 app/views/tasks/edit.html.erb | 2 ++ app/views/tasks/index.html.erb | 13 +++++-- app/views/tasks/show.html.erb | 18 ++++++++-- config/routes.rb | 12 +++++-- 7 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 app/views/tasks/create.html.erb rename app/views/tasks/{delete.html.erb => destroy.html.erb} (100%) create mode 100644 app/views/tasks/edit.html.erb diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 9621fb185..92eaf65fb 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -1,16 +1,50 @@ class TasksController < ApplicationController def index + @tasks = TasksController.alltasks end def new end + def create + @params = params + @title = params[:title] + @description = params[:description] + @completion_status = params[:completion_status] + @completion_date = params[:completion_date] + end + def update end - def delete + def destroy + end + + def edit end def show + @tasks = TasksController.alltasks + @mytask = nil + + @tasks.each do |task| + number = params[:id].to_i + if number == task[:id] + @mytask = task + end + end + if @mytask == nil + render :file => 'public/404.html', + :status => :not_found, :layout => false + end + end + + def self.alltasks + [ + {id: 1, title: "Clean Bathroom", description: "wash towels, scour sink, clean bathtub", completion_status: true, completion_date:Time.now}, + {id: 2, title: "Read", description: "read for 20 minutes", completion_status: false}, + {id: 3, title: "Exercise", description: "yoga, run for 30 minutes", completion_status: true, completion_date:Time.now} + ] + end end diff --git a/app/views/tasks/create.html.erb b/app/views/tasks/create.html.erb new file mode 100644 index 000000000..e0a729bf7 --- /dev/null +++ b/app/views/tasks/create.html.erb @@ -0,0 +1,2 @@ +

Tasks#create

+

Find me in app/views/tasks/new.html.erb

diff --git a/app/views/tasks/delete.html.erb b/app/views/tasks/destroy.html.erb similarity index 100% rename from app/views/tasks/delete.html.erb rename to app/views/tasks/destroy.html.erb diff --git a/app/views/tasks/edit.html.erb b/app/views/tasks/edit.html.erb new file mode 100644 index 000000000..e0a729bf7 --- /dev/null +++ b/app/views/tasks/edit.html.erb @@ -0,0 +1,2 @@ +

Tasks#create

+

Find me in app/views/tasks/new.html.erb

diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index b16c10310..d7113419d 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,2 +1,11 @@ -

Tasks#index

-

Find me in app/views/tasks/index.html.erb

+

Welcome to Your Tasks

+ +<% @tasks.each do |task| %> + +
+

<%= link_to(task[:title], show_path(task[:id])) %>

+
+ +<% end %> + +

<%= link_to("Add New Task", new_path(@mytask[:id]) %>

diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index 1139224db..13b315d64 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -1,2 +1,16 @@ -

Tasks#show

-

Find me in app/views/tasks/show.html.erb

+
+

Task Name: <%= @mytask[:title]%>

+

Description: <%= @mytask[:description] %>

+

Completed? + <% if @mytask[:completion_status] == true %> + <%= "Yes" %> + <% else %> + <%= "Not yet completed" %> + <% end %> + +

Completed Time and Date: <%= @mytask[:completion_date] %>

+ <%= link_to( "Edit", edit_path(@mytask[:id]) ) %> + + <%= link_to( "Delete", delete_path(@mytask[:id]), method: :delete ) %> + +
diff --git a/config/routes.rb b/config/routes.rb index fd016ed21..bcf222b9c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,13 +1,19 @@ Rails.application.routes.draw do + root to: "posts#index" + get 'tasks/index' - get 'tasks/new' + get 'tasks/new'=> "tasks#new", as: "new" + + post 'tasks/create' => 'tasks#create' get 'tasks/update' - get 'tasks/delete' + get 'tasks/show/:id' => 'tasks#show', as: 'show' + + delete 'tasks/:id/destroy' => "tasks#destroy", as: "delete" - get 'tasks/show' + get "tasks/:id/edit" => "tasks#edit", as: "edit" # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From 8516c9e09883895d654a9ba8dc08a16ef121f659 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 15:00:56 -0700 Subject: [PATCH 04/47] created model --- app/models/task.rb | 2 ++ db/migrate/20160928220045_create_tasks.rb | 12 ++++++++++++ test/fixtures/tasks.yml | 13 +++++++++++++ test/models/task_test.rb | 7 +++++++ 4 files changed, 34 insertions(+) create mode 100644 app/models/task.rb create mode 100644 db/migrate/20160928220045_create_tasks.rb create mode 100644 test/fixtures/tasks.yml create mode 100644 test/models/task_test.rb diff --git a/app/models/task.rb b/app/models/task.rb new file mode 100644 index 000000000..935f76e12 --- /dev/null +++ b/app/models/task.rb @@ -0,0 +1,2 @@ +class Task < ActiveRecord::Base +end diff --git a/db/migrate/20160928220045_create_tasks.rb b/db/migrate/20160928220045_create_tasks.rb new file mode 100644 index 000000000..e6e5b55aa --- /dev/null +++ b/db/migrate/20160928220045_create_tasks.rb @@ -0,0 +1,12 @@ +class CreateTasks < ActiveRecord::Migration + def change + create_table :tasks do |t| + t.string :title + t.string :description + t.boolean :completion_status + t.datetime :completed_at + + t.timestamps null: false + end + end +end diff --git a/test/fixtures/tasks.yml b/test/fixtures/tasks.yml new file mode 100644 index 000000000..8b1100441 --- /dev/null +++ b/test/fixtures/tasks.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + description: MyString + completion_status: false + completed_at: 2016-09-28 15:00:45 + +two: + title: MyString + description: MyString + completion_status: false + completed_at: 2016-09-28 15:00:45 diff --git a/test/models/task_test.rb b/test/models/task_test.rb new file mode 100644 index 000000000..3ca215970 --- /dev/null +++ b/test/models/task_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TaskTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From c77ca4dd2e35ee41128b84a596c810756dab5ce9 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 15:06:09 -0700 Subject: [PATCH 05/47] migrated database --- db/migrate/20160928220045_create_tasks.rb | 2 +- db/schema.rb | 25 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 db/schema.rb diff --git a/db/migrate/20160928220045_create_tasks.rb b/db/migrate/20160928220045_create_tasks.rb index e6e5b55aa..36b7bee37 100644 --- a/db/migrate/20160928220045_create_tasks.rb +++ b/db/migrate/20160928220045_create_tasks.rb @@ -5,7 +5,7 @@ def change t.string :description t.boolean :completion_status t.datetime :completed_at - + t.timestamps null: false end end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 000000000..1c912097b --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,25 @@ +# encoding: UTF-8 +# 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: 20160928220045) do + + create_table "tasks", force: :cascade do |t| + t.string "title" + t.string "description" + t.boolean "completion_status" + t.datetime "completed_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end From b671c9b70ddc862d14d0089cc0b2d0fcebb8e68b Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 15:19:26 -0700 Subject: [PATCH 06/47] added three tasks to database --- app/controllers/tasks_controller.rb | 6 +++--- app/views/tasks/index.html.erb | 2 -- app/views/tasks/show.html.erb | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 92eaf65fb..5dc4e6497 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -11,7 +11,7 @@ def create @title = params[:title] @description = params[:description] @completion_status = params[:completion_status] - @completion_date = params[:completion_date] + @completion_date = params[:completed_at] end def update @@ -41,9 +41,9 @@ def show def self.alltasks [ - {id: 1, title: "Clean Bathroom", description: "wash towels, scour sink, clean bathtub", completion_status: true, completion_date:Time.now}, + {id: 1, title: "Clean Bathroom", description: "wash towels, scour sink, clean bathtub", completion_status: true, completed_at:Time.now}, {id: 2, title: "Read", description: "read for 20 minutes", completion_status: false}, - {id: 3, title: "Exercise", description: "yoga, run for 30 minutes", completion_status: true, completion_date:Time.now} + {id: 3, title: "Exercise", description: "yoga, run for 30 minutes", completion_status: true, completed_at:Time.now} ] end diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index d7113419d..55cdce454 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -7,5 +7,3 @@ <% end %> - -

<%= link_to("Add New Task", new_path(@mytask[:id]) %>

diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index 13b315d64..cfec37ab0 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -8,7 +8,7 @@ <%= "Not yet completed" %> <% end %> -

Completed Time and Date: <%= @mytask[:completion_date] %>

+

Completed Time and Date: <%= @mytask[:completed_at] %>

<%= link_to( "Edit", edit_path(@mytask[:id]) ) %> <%= link_to( "Delete", delete_path(@mytask[:id]), method: :delete ) %> From d1a67250a5d70b710ec2a6e0d2c3d1f39fd1328b Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 15:57:05 -0700 Subject: [PATCH 07/47] finished new.html.erb form along with routes and controllers --- app/controllers/tasks_controller.rb | 28 +++++++++++++--------------- app/views/tasks/index.html.erb | 10 ++++++++-- app/views/tasks/new.html.erb | 18 ++++++++++++++++-- config/routes.rb | 2 +- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 5dc4e6497..d0aa41ffe 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -1,30 +1,28 @@ class TasksController < ApplicationController def index - @tasks = TasksController.alltasks + @tasks = Task.all end def new end def create - @params = params - @title = params[:title] - @description = params[:description] - @completion_status = params[:completion_status] - @completion_date = params[:completed_at] + Task.create(title: params[:title], description: params[:description]) + redirect_to action: "index" end def update end def destroy + # Task.destroy{} end def edit end def show - @tasks = TasksController.alltasks + @tasks = Task.all @mytask = nil @tasks.each do |task| @@ -39,12 +37,12 @@ def show end end - def self.alltasks - [ - {id: 1, title: "Clean Bathroom", description: "wash towels, scour sink, clean bathtub", completion_status: true, completed_at:Time.now}, - {id: 2, title: "Read", description: "read for 20 minutes", completion_status: false}, - {id: 3, title: "Exercise", description: "yoga, run for 30 minutes", completion_status: true, completed_at:Time.now} - ] - - end + # def self.alltasks + # [ + # {id: 1, title: "Clean Bathroom", description: "wash towels, scour sink, clean bathtub", completion_status: true, completed_at:Time.now}, + # {id: 2, title: "Read", description: "read for 20 minutes", completion_status: false}, + # {id: 3, title: "Exercise", description: "yoga, run for 30 minutes", completion_status: true, completed_at:Time.now} + # ] + # + # end end diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 55cdce454..0d1c4d8b4 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,9 +1,15 @@ -

Welcome to Your Tasks

+

Welcome to Your Tasks

<% @tasks.each do |task| %>
-

<%= link_to(task[:title], show_path(task[:id])) %>

+
    +
  • +

    <%= link_to(task[:title], show_path(task[:id])) %>

    +
  • +
<% end %> + + diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 2484008a3..674c25b37 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,2 +1,16 @@ -

Tasks#new

-

Find me in app/views/tasks/new.html.erb

+

Create a New Task

+ +
+ + + + + + +
+ + <%= tag(:input, :type => "hidden", + :name => request_forgery_protection_token.to_s, + :value => form_authenticity_token) %> + + diff --git a/config/routes.rb b/config/routes.rb index bcf222b9c..05eaee484 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do root to: "posts#index" - get 'tasks/index' + get 'tasks/index', as: 'index' get 'tasks/new'=> "tasks#new", as: "new" From 221527b9b17e4d3bb1e0f941453d4241be36aa51 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 16:15:01 -0700 Subject: [PATCH 08/47] added delete function from wave2 --- app/controllers/tasks_controller.rb | 22 ++++++++++------------ app/views/tasks/index.html.erb | 4 ++++ app/views/tasks/show.html.erb | 12 ++++++------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index d0aa41ffe..fed0a9c6b 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -15,26 +15,24 @@ def update end def destroy - # Task.destroy{} + @task = Task.find(params[:id]) + @task.destroy + + redirect_to action: "index" + end def edit + @task = Task.find(params[:id]) end def show - @tasks = Task.all - @mytask = nil + @task = Task.find(params[:id]) - @tasks.each do |task| - number = params[:id].to_i - if number == task[:id] - @mytask = task - end + if @task == nil + render :file => 'public/404.html', + :status => :not_found, :layout => false end - if @mytask == nil - render :file => 'public/404.html', - :status => :not_found, :layout => false - end end # def self.alltasks diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 0d1c4d8b4..3a4020692 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -6,6 +6,10 @@
  • <%= link_to(task[:title], show_path(task[:id])) %>

    +
    <%= link_to 'Edit', edit_path(task) %>
    +
    <%= link_to 'Delete', delete_path(task), + method: :delete, + data: { confirm: 'Are you sure?' } %>
diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index cfec37ab0..f17d783c0 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -1,16 +1,16 @@
-

Task Name: <%= @mytask[:title]%>

-

Description: <%= @mytask[:description] %>

+

Task Name: <%= @task[:title]%>

+

Description: <%= @task[:description] %>

Completed? - <% if @mytask[:completion_status] == true %> + <% if @task[:completion_status] == true %> <%= "Yes" %> <% else %> <%= "Not yet completed" %> <% end %> -

Completed Time and Date: <%= @mytask[:completed_at] %>

- <%= link_to( "Edit", edit_path(@mytask[:id]) ) %> +

Completed Time and Date: <%= @task[:completed_at] %>

+ <%= link_to( "Edit", edit_path(@task[:id]) ) %> - <%= link_to( "Delete", delete_path(@mytask[:id]), method: :delete ) %> + <%= link_to( "Delete", delete_path(@task[:id]), method: :delete, data: { confirm: 'Are you sure?' } ) %>
From d7ce1157f439570ecef649b7c256c2f0307c07a1 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 28 Sep 2016 16:30:54 -0700 Subject: [PATCH 09/47] finished edit and delete functions --- app/controllers/tasks_controller.rb | 7 +++++++ app/views/tasks/edit.html.erb | 20 ++++++++++++++++++-- app/views/tasks/index.html.erb | 6 +++--- app/views/tasks/new.html.erb | 1 + config/routes.rb | 2 ++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index fed0a9c6b..499677a5a 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -12,6 +12,13 @@ def create end def update + @task = Task.find(params[:id]) + + if @task.update(title: params[:title], description: params[:description]) + redirect_to action: "show" + else + render 'edit' + end end def destroy diff --git a/app/views/tasks/edit.html.erb b/app/views/tasks/edit.html.erb index e0a729bf7..4fa558eab 100644 --- a/app/views/tasks/edit.html.erb +++ b/app/views/tasks/edit.html.erb @@ -1,2 +1,18 @@ -

Tasks#create

-

Find me in app/views/tasks/new.html.erb

+

Edit Task

+ + + + + + + + + +
+ + <%= tag(:input, :type => "hidden", + :name => request_forgery_protection_token.to_s, + :value => form_authenticity_token) %> + + + diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 3a4020692..721af4992 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -6,10 +6,10 @@
  • <%= link_to(task[:title], show_path(task[:id])) %>

    -
    <%= link_to 'Edit', edit_path(task) %>
    -
    <%= link_to 'Delete', delete_path(task), +

    <%= link_to 'Edit', edit_path(task) %> + <%= link_to 'Delete', delete_path(task), method: :delete, - data: { confirm: 'Are you sure?' } %>

    + data: { confirm: 'Are you sure?' } %>

diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 674c25b37..19aed76da 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -14,3 +14,4 @@ :value => form_authenticity_token) %> + diff --git a/config/routes.rb b/config/routes.rb index 05eaee484..3f4645021 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,8 @@ get 'tasks/update' + put "tasks/:id/update" => "tasks#update" + get 'tasks/show/:id' => 'tasks#show', as: 'show' delete 'tasks/:id/destroy' => "tasks#destroy", as: "delete" From d2859f7445dd7ac0c4eb979805530dfcd3e7168d Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 13:52:52 -0700 Subject: [PATCH 10/47] working on complete checkbox function --- app/controllers/tasks_controller.rb | 12 ++++++++++++ app/views/tasks/completion_status.html.erb | 2 ++ app/views/tasks/index.html.erb | 17 +++++++++++------ app/views/tasks/show.html.erb | 9 ++++++--- config/routes.rb | 6 +++++- 5 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 app/views/tasks/completion_status.html.erb diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 499677a5a..f2f9687c6 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -42,6 +42,18 @@ def show end end + def completion_status + @task = Task.find(params[:id]) + + if @task.completion_status == true + @task.completion_date = Time.now + else + redirect_to action: "index" + end + + end + + # used this before creating model # def self.alltasks # [ # {id: 1, title: "Clean Bathroom", description: "wash towels, scour sink, clean bathtub", completion_status: true, completed_at:Time.now}, diff --git a/app/views/tasks/completion_status.html.erb b/app/views/tasks/completion_status.html.erb new file mode 100644 index 000000000..d8edfc6ec --- /dev/null +++ b/app/views/tasks/completion_status.html.erb @@ -0,0 +1,2 @@ +

Tasks#completion_status

+

Find me in app/views/tasks/new.html.erb

diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 721af4992..dd27668c1 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,16 +1,21 @@ -

Welcome to Your Tasks

+

Daily Task List

<% @tasks.each do |task| %>
  • -

    <%= link_to(task[:title], show_path(task[:id])) %>

    -

    <%= link_to 'Edit', edit_path(task) %> - <%= link_to 'Delete', delete_path(task), - method: :delete, - data: { confirm: 'Are you sure?' } %>

    + <%= check_box_tag(task[:completion_status]) %> + <%= label_tag(task[:completion_status], link_to(task[:title], show_path(task[:id])) + ) %>
  • + +
      +
    • <%= button_to 'Edit', edit_path(task) %>
    • +
    • <%= button_to 'Delete', delete_path(task), + method: :delete, + data: { confirm: 'Are you sure?' } %>
    • +
diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index f17d783c0..ab344bf5c 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -9,8 +9,11 @@ <% end %>

Completed Time and Date: <%= @task[:completed_at] %>

- <%= link_to( "Edit", edit_path(@task[:id]) ) %> - - <%= link_to( "Delete", delete_path(@task[:id]), method: :delete, data: { confirm: 'Are you sure?' } ) %> +
    +
  • <%= button_to 'Edit', edit_path(@task) %>
  • +
  • <%= button_to 'Delete', delete_path(@task), + method: :delete, + data: { confirm: 'Are you sure?' } %>
  • +
diff --git a/config/routes.rb b/config/routes.rb index 3f4645021..fd862019f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,7 +15,11 @@ delete 'tasks/:id/destroy' => "tasks#destroy", as: "delete" - get "tasks/:id/edit" => "tasks#edit", as: "edit" + post "tasks/:id/edit" => "tasks#edit", as: "edit" + + patch 'tasks/:id/completion_status' => 'tasks#completion_status', as: "complete" + + # post 'tasks/:id/completion_status' => 'tasks#completion_status', as: "completed" # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From bcb207c75f64ef874c5cbce0b77f66c40c678700 Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 14:05:13 -0700 Subject: [PATCH 11/47] added gemfile for awesome_print --- Gemfile | 3 +-- Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index e87fad5fc..d7371e6c2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' - +gem 'awesome_print' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' # Use sqlite3 as the database for Active Record @@ -44,4 +44,3 @@ group :development do # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' end - diff --git a/Gemfile.lock b/Gemfile.lock index 187046034..b6d552c2c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,6 +37,7 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + awesome_print (1.7.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) @@ -146,6 +147,7 @@ PLATFORMS ruby DEPENDENCIES + awesome_print byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) From a4653744aa6ebf6f43bf0fad4980a9140365208a Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 14:45:20 -0700 Subject: [PATCH 12/47] changed new.html.erb to Ruby form --- app/assets/stylesheets/normalize.css | 419 +++++++++++++++++++++++++++ app/assets/stylesheets/style.css | 188 ++++++++++++ app/controllers/tasks_controller.rb | 9 +- app/views/tasks/create.html.erb | 10 +- app/views/tasks/new.html.erb | 21 +- config/routes.rb | 4 +- 6 files changed, 644 insertions(+), 7 deletions(-) create mode 100644 app/assets/stylesheets/normalize.css create mode 100644 app/assets/stylesheets/style.css diff --git a/app/assets/stylesheets/normalize.css b/app/assets/stylesheets/normalize.css new file mode 100644 index 000000000..18ddf7fed --- /dev/null +++ b/app/assets/stylesheets/normalize.css @@ -0,0 +1,419 @@ +/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */ + +/** + * 1. Change the default font family in all browsers (opinionated). + * 2. Prevent adjustments of font size after orientation changes in IE and iOS. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove the margin in all browsers (opinionated). + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Add the correct display in IE 9-. + * 1. Add the correct display in Edge, IE, and Firefox. + * 2. Add the correct display in IE. + */ + +article, +aside, +details, /* 1 */ +figcaption, +figure, +footer, +header, +main, /* 2 */ +menu, +nav, +section, +summary { /* 1 */ + display: block; +} + +/** + * Add the correct display in IE 9-. + */ + +audio, +canvas, +progress, +video { + display: inline-block; +} + +/** + * Add the correct display in iOS 4-7. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Add the correct display in IE 10-. + * 1. Add the correct display in IE. + */ + +template, /* 1 */ +[hidden] { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * 1. Remove the gray background on active links in IE 10. + * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + */ + +a { + background-color: transparent; /* 1 */ + -webkit-text-decoration-skip: objects; /* 2 */ +} + +/** + * Remove the outline on focused links when they are also active or hovered + * in all browsers (opinionated). + */ + +a:active, +a:hover { + outline-width: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * 1. Remove the bottom border in Firefox 39-. + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + */ + +b, +strong { + font-weight: inherit; +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * Add the correct font style in Android 4.3-. + */ + +dfn { + font-style: italic; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Add the correct background and color in IE 9-. + */ + +mark { + background-color: #ff0; + color: #000; +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10-. + */ + +img { + border-style: none; +} + +/** + * Hide the overflow in IE. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct margin in IE 8. + */ + +figure { + margin: 1em 40px; +} + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change font properties to `inherit` in all browsers (opinionated). + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +select, +textarea { + font: inherit; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Restore the font weight unset by the previous rule. + */ + +optgroup { + font-weight: bold; +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` + * controls in Android 4. + * 2. Correct the inability to style clickable types in iOS and Safari. + */ + +button, +html [type="button"], /* 1 */ +[type="reset"], +[type="submit"] { + -webkit-appearance: button; /* 2 */ +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Change the border, margin, and padding in all browsers (opinionated). + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Remove the default vertical scrollbar in IE. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10-. + * 2. Remove the padding in IE 10-. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding and cancel buttons in Chrome and Safari on OS X. + */ + +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Correct the text style of placeholders in Chrome, Edge, and Safari. + */ + +::-webkit-input-placeholder { + color: inherit; + opacity: 0.54; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} diff --git a/app/assets/stylesheets/style.css b/app/assets/stylesheets/style.css new file mode 100644 index 000000000..6124d1041 --- /dev/null +++ b/app/assets/stylesheets/style.css @@ -0,0 +1,188 @@ +@import 'https://fonts.googleapis.com/css?family=Amatic+SC|Josefin+Sans'; + +html { +font: normal normal 14px/1 "Josefin Sans"; +/*, Helvetica, Arial, sans-serif;*/ +} +/************************************/ +/* NAVIGATION BAR AND HEADER SECTION */ +/************************************/ + +.social-media-container { + width: 100%; + text-align: center; + margin: 0 auto; +} + +.social-media-container li { + list-style-type: none; + display: inline; + padding: 0; +} + +.social-media-container ul { + padding: 0; + margin: 0; +} + +/*header section { + background-color: #b24569; +}*/ + +.navigation-container { + width: 100%; + height: 10%; + text-align:center; + /*position: fixed;*/ + /*background-color: #fff796;*/ +} + +.navigation-container li { + list-style-type: none; + padding: 0 2% 0 2%; + display: inline-block; +} + +.navigation-container ul { + padding: 0 0 2% 0; + margin: 0; +} + + +/************************************/ +/* FORMS and BUTTONS */ +/************************************/ + +button { + display: block; + background-color: #4fb1cc; /* Green */ + border: none; + color: white; + padding: 10px 20px; + text-align: center; + text-decoration: none; + font-size: 16px; +} + + +/************************************/ +/* LINKS */ +/************************************/ +.navigation-container li a { + color: #000000; + font-size: 30px; + font-family: 'Amatic SC'; + text-decoration: none; + text-align: center; +} + +.navigation-container img { + padding-left: 1.75%; +} + +.social-media-container a { + padding: 0 5px 0 5px; +} + +.navigation-container li a:hover { + /*color: #ff7ca7;*/ + color: #b24569; +} + +a:hover { + /*color: #c98f8f;*/ + color: #4fb1cc; +} + +/*a:visited { + color: #000000 +}*/ + +a:link { + color: #000000; + text-decoration: none; +} + + + +/************************************/ +/* MAIN BODY SECTION - INDEX.HTML */ +/************************************/ +body { + margin-left: .5%; + margin-right: .5%; +} + +h2 { + font-family: 'Amatic SC'; + font-size: 2em; + text-align: left; + /*width: 30%;*/ + margin: 5px 2px 5px 2px; +} + +.blog-images { + padding: 5%; + height: 175px; +} + +.format-about-me { + height: 300px; + width: 100%; +} + +.format-about-me img { + border-radius: 50%; + float: left; + width: 25%; + padding-left: 5%; +} + +.format-about-me p { + float: right; + width: 60%; + padding: 0 5% 0 5%; +} + +section article { + display: inline-block; + width: 29%; + vertical-align: top; +} + +.article-format { + text-align: center; +} + +.article-format p, h3, h4 { + text-align: left; + margin: 0 4% 0 4%; +} + + +/************************************/ +/* FOOTER */ +/************************************/ +footer { + clear: both; + width: 100%; + margin: 0 auto; + margin-top: 1%; + height: 3%; + bottom:0; +} + +footer section { + float: right; + width: 10%; + margin: 0; +} + +footer section a { + padding: 0 1% .5% 1%; +} + +footer p { + float: left; + /*width: 90%;*/ +} diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index f2f9687c6..47eaa28ab 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -4,11 +4,18 @@ def index end def new + @mytask = Task.new end def create - Task.create(title: params[:title], description: params[:description]) + @params = params + @mytask = Task.new + @mytask.title = params[:task][:title] + @mytask.description = params[:task][:description] + @mytask.save redirect_to action: "index" + + # Task.create(title: params[:title], description: params[:description]) end def update diff --git a/app/views/tasks/create.html.erb b/app/views/tasks/create.html.erb index e0a729bf7..f73eb32d0 100644 --- a/app/views/tasks/create.html.erb +++ b/app/views/tasks/create.html.erb @@ -1,2 +1,8 @@ -

Tasks#create

-

Find me in app/views/tasks/new.html.erb

+
+

+

<%= @params%>

+
<%= @mytask.title %>
+

<%= @mytask.description %>

+

+ +
diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 19aed76da..043a1453d 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,6 +1,23 @@

Create a New Task

-
+<%= form_for @mytask, + url: create_path do |f| %> + <%= f.label :title %> + <%= f.text_field :title %> + + <%= f.label :description %> + <%= f.text_field :description %> + + <%= f.submit %> + + <%= tag(:input, :type => "hidden", + :name => request_forgery_protection_token.to_s, + :value => form_authenticity_token) %> + + <% end %> + + + diff --git a/config/routes.rb b/config/routes.rb index fd862019f..2d87f8374 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,11 +5,11 @@ get 'tasks/new'=> "tasks#new", as: "new" - post 'tasks/create' => 'tasks#create' + post 'tasks/create' => 'tasks#create', as: "create" get 'tasks/update' - put "tasks/:id/update" => "tasks#update" + put "tasks/:id/update" => "tasks#update", as: "update" get 'tasks/show/:id' => 'tasks#show', as: 'show' From 450f1feda578d621a72ae30ea0f8b34b5ddb860e Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 16:13:02 -0700 Subject: [PATCH 13/47] added css styling and layout --- app/assets/stylesheets/style.css | 110 +++++++------------------ app/controllers/tasks_controller.rb | 8 +- app/views/layouts/application.html.erb | 17 ++++ app/views/tasks/edit.html.erb | 8 +- app/views/tasks/index.html.erb | 11 +-- app/views/tasks/new.html.erb | 4 +- app/views/tasks/show.html.erb | 12 +-- 7 files changed, 67 insertions(+), 103 deletions(-) diff --git a/app/assets/stylesheets/style.css b/app/assets/stylesheets/style.css index 6124d1041..e233bb6bb 100644 --- a/app/assets/stylesheets/style.css +++ b/app/assets/stylesheets/style.css @@ -1,5 +1,6 @@ @import 'https://fonts.googleapis.com/css?family=Amatic+SC|Josefin+Sans'; + html { font: normal normal 14px/1 "Josefin Sans"; /*, Helvetica, Arial, sans-serif;*/ @@ -8,33 +9,12 @@ font: normal normal 14px/1 "Josefin Sans"; /* NAVIGATION BAR AND HEADER SECTION */ /************************************/ -.social-media-container { - width: 100%; - text-align: center; - margin: 0 auto; -} - -.social-media-container li { - list-style-type: none; - display: inline; - padding: 0; -} - -.social-media-container ul { - padding: 0; - margin: 0; -} - -/*header section { - background-color: #b24569; -}*/ - .navigation-container { width: 100%; height: 10%; - text-align:center; + text-align:right; /*position: fixed;*/ - /*background-color: #fff796;*/ + background-color: #fff796; } .navigation-container li { @@ -44,26 +24,40 @@ font: normal normal 14px/1 "Josefin Sans"; } .navigation-container ul { - padding: 0 0 2% 0; + padding: 1% 0 0 0; margin: 0; } - /************************************/ /* FORMS and BUTTONS */ /************************************/ -button { +.button { display: block; - background-color: #4fb1cc; /* Green */ + background-color: #4fb1cc; border: none; - color: white; - padding: 10px 20px; + color: #fff796; + padding: 5px 10px; text-align: center; text-decoration: none; font-size: 16px; } +ul li { + list-style-type: none; + padding: 1% 0 0 0; +} + +label{ + display: block; + width: 200px; + padding: 10px 0 10px 0; + +} +input { + display: block; + +} /************************************/ /* LINKS */ @@ -76,14 +70,6 @@ button { text-align: center; } -.navigation-container img { - padding-left: 1.75%; -} - -.social-media-container a { - padding: 0 5px 0 5px; -} - .navigation-container li a:hover { /*color: #ff7ca7;*/ color: #b24569; @@ -94,17 +80,11 @@ a:hover { color: #4fb1cc; } -/*a:visited { - color: #000000 -}*/ - a:link { color: #000000; text-decoration: none; } - - /************************************/ /* MAIN BODY SECTION - INDEX.HTML */ /************************************/ @@ -113,53 +93,19 @@ body { margin-right: .5%; } -h2 { +h3 { font-family: 'Amatic SC'; - font-size: 2em; + font-size: 2.5em; text-align: left; + padding-top: 10px; /*width: 30%;*/ margin: 5px 2px 5px 2px; } -.blog-images { - padding: 5%; - height: 175px; -} - -.format-about-me { - height: 300px; - width: 100%; -} - -.format-about-me img { - border-radius: 50%; - float: left; - width: 25%; - padding-left: 5%; -} - -.format-about-me p { - float: right; - width: 60%; - padding: 0 5% 0 5%; -} - -section article { - display: inline-block; - width: 29%; - vertical-align: top; -} - -.article-format { - text-align: center; -} - -.article-format p, h3, h4 { - text-align: left; - margin: 0 4% 0 4%; +.font-style { + font-size: 2em; } - /************************************/ /* FOOTER */ /************************************/ diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 47eaa28ab..7de8c1aa7 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -52,11 +52,9 @@ def show def completion_status @task = Task.find(params[:id]) - if @task.completion_status == true - @task.completion_date = Time.now - else - redirect_to action: "index" - end + @task.update_attribute(:completed_at, Time.now) + + redirect_to action: 'index', notice: "task item completed" end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 46eeb110b..d25645149 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,8 +7,25 @@ <%= csrf_meta_tags %> +
+ + +
+ <%= yield %> +
+

+ Copyright 2016, Rachel Pavilanis +

+ +
+ diff --git a/app/views/tasks/edit.html.erb b/app/views/tasks/edit.html.erb index 4fa558eab..f4dc29ec0 100644 --- a/app/views/tasks/edit.html.erb +++ b/app/views/tasks/edit.html.erb @@ -7,12 +7,14 @@ - -
+ <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) %> - + + diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index dd27668c1..6a23abbc1 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -4,15 +4,16 @@
    -
  • - <%= check_box_tag(task[:completion_status]) %> - <%= label_tag(task[:completion_status], link_to(task[:title], show_path(task[:id])) +
  • + + <%= label_tag(task.completion_status, link_to(task.title, show_path(task.id)) ) %>
    • -
    • <%= button_to 'Edit', edit_path(task) %>
    • -
    • <%= button_to 'Delete', delete_path(task), +
    • <%= button_to 'Complete', complete_path(task), :class => 'button' %>
    • +
    • <%= button_to 'Edit', edit_path(task), :class => 'button' %>
    • +
    • <%= button_to 'Delete', delete_path(task), :class => 'button', method: :delete, data: { confirm: 'Are you sure?' } %>
    diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 043a1453d..226646937 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -6,9 +6,9 @@ <%= f.text_field :title %> <%= f.label :description %> - <%= f.text_field :description %> + <%= f.text_area :description %> - <%= f.submit %> + <%= f.submit :class=>"button" %> <%= tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index ab344bf5c..a39b9626a 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -1,17 +1,17 @@
    -

    Task Name: <%= @task[:title]%>

    -

    Description: <%= @task[:description] %>

    +

    Task Name: <%= @task.title%>

    +

    Description: <%= @task.description %>

    Completed? - <% if @task[:completion_status] == true %> + <% if @task.completion_status == true %> <%= "Yes" %> <% else %> <%= "Not yet completed" %> <% end %> -

    Completed Time and Date: <%= @task[:completed_at] %>

    +

    Completed Time and Date: <%= @task.completed_at %>

      -
    • <%= button_to 'Edit', edit_path(@task) %>
    • -
    • <%= button_to 'Delete', delete_path(@task), +
    • <%= button_to 'Edit', edit_path(@task), :class => 'button' %>
    • +
    • <%= button_to 'Delete', delete_path(@task), :class => 'button', method: :delete, data: { confirm: 'Are you sure?' } %>
    From 1b33b3ce5b4c1485da849823f4f0351342dc43b6 Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 16:14:55 -0700 Subject: [PATCH 14/47] moved buttons into a line --- app/assets/stylesheets/style.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/style.css b/app/assets/stylesheets/style.css index e233bb6bb..9aea31b85 100644 --- a/app/assets/stylesheets/style.css +++ b/app/assets/stylesheets/style.css @@ -45,7 +45,8 @@ font: normal normal 14px/1 "Josefin Sans"; ul li { list-style-type: none; - padding: 1% 0 0 0; + padding: 0 1% 0 1%; + display: inline-block; } label{ From d82691ad1e03c277c4be203fb6830763633ab24b Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 16:26:31 -0700 Subject: [PATCH 15/47] complete method now working --- app/controllers/tasks_controller.rb | 4 +++- app/views/tasks/index.html.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 7de8c1aa7..7aef807f3 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -53,8 +53,10 @@ def completion_status @task = Task.find(params[:id]) @task.update_attribute(:completed_at, Time.now) + @task.update_attribute(:completion_status, true) - redirect_to action: 'index', notice: "task item completed" + + redirect_to action: 'index' end diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 6a23abbc1..1abdfc13c 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -11,7 +11,7 @@
      -
    • <%= button_to 'Complete', complete_path(task), :class => 'button' %>
    • +
    • <%= button_to 'Complete', complete_path(task), :class => 'button', method: :patch, data: { flash: "Task has been updated"} %>
    • <%= button_to 'Edit', edit_path(task), :class => 'button' %>
    • <%= button_to 'Delete', delete_path(task), :class => 'button', method: :delete, From 445b4ccb2c3a235a327fee0e956ab5df00bd8a8b Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 16:48:45 -0700 Subject: [PATCH 16/47] added strikethrough on completed tasks --- app/assets/stylesheets/style.css | 20 -------------------- app/controllers/tasks_controller.rb | 3 ++- app/views/layouts/application.html.erb | 1 + app/views/tasks/index.html.erb | 12 ++++++++---- app/views/tasks/new.html.erb | 17 ----------------- config/routes.rb | 3 --- 6 files changed, 11 insertions(+), 45 deletions(-) diff --git a/app/assets/stylesheets/style.css b/app/assets/stylesheets/style.css index 9aea31b85..69bc10ba8 100644 --- a/app/assets/stylesheets/style.css +++ b/app/assets/stylesheets/style.css @@ -99,7 +99,6 @@ h3 { font-size: 2.5em; text-align: left; padding-top: 10px; - /*width: 30%;*/ margin: 5px 2px 5px 2px; } @@ -110,26 +109,7 @@ h3 { /************************************/ /* FOOTER */ /************************************/ -footer { - clear: both; - width: 100%; - margin: 0 auto; - margin-top: 1%; - height: 3%; - bottom:0; -} - -footer section { - float: right; - width: 10%; - margin: 0; -} - -footer section a { - padding: 0 1% .5% 1%; -} footer p { float: left; - /*width: 90%;*/ } diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 7aef807f3..02f70bd21 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -24,6 +24,7 @@ def update if @task.update(title: params[:title], description: params[:description]) redirect_to action: "show" else + # another way to redirect render 'edit' end end @@ -55,9 +56,9 @@ def completion_status @task.update_attribute(:completed_at, Time.now) @task.update_attribute(:completion_status, true) - redirect_to action: 'index' + end # used this before creating model diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d25645149..2cf6bdb58 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -15,6 +15,7 @@
    • <%= link_to("Add New Task", new_path()) %>

    + diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 1abdfc13c..4c8545502 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -5,13 +5,17 @@
    • - - <%= label_tag(task.completion_status, link_to(task.title, show_path(task.id)) - ) %> + <% if task.completion_status == true %> + <%= label_tag(task.completion_status, link_to(task.title, show_path(task.id)) + ) %> + <% else %> + <%= label_tag(task.completion_status, link_to(task.title, show_path(task.id)) + ) %> + <% end %>
      • -
      • <%= button_to 'Complete', complete_path(task), :class => 'button', method: :patch, data: { flash: "Task has been updated"} %>
      • +
      • <%= button_to 'Complete', complete_path(task), :class => 'button', method: :patch %>
      • <%= button_to 'Edit', edit_path(task), :class => 'button' %>
      • <%= button_to 'Delete', delete_path(task), :class => 'button', method: :delete, diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 226646937..75cda1d7a 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -15,20 +15,3 @@ :value => form_authenticity_token) %> <% end %> - - - diff --git a/config/routes.rb b/config/routes.rb index 2d87f8374..a86f348a8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,7 +8,6 @@ post 'tasks/create' => 'tasks#create', as: "create" get 'tasks/update' - put "tasks/:id/update" => "tasks#update", as: "update" get 'tasks/show/:id' => 'tasks#show', as: 'show' @@ -19,8 +18,6 @@ patch 'tasks/:id/completion_status' => 'tasks#completion_status', as: "complete" - # post 'tasks/:id/completion_status' => 'tasks#completion_status', as: "completed" - # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From 9c1dffae0ef4a0c96e2da358b12040f100d3c919 Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 16:49:04 -0700 Subject: [PATCH 17/47] hadn't saved controller --- app/controllers/tasks_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 02f70bd21..fe8546da6 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -58,7 +58,6 @@ def completion_status redirect_to action: 'index' - end # used this before creating model From 6d1f6a51ff54d9612e40b35c6ec35a7db1d56a7e Mon Sep 17 00:00:00 2001 From: Rachel Date: Thu, 29 Sep 2016 20:30:34 -0700 Subject: [PATCH 18/47] added logo to task list home page --- .ruby-gemset | 1 - .ruby-version | 1 - app/assets/images/.DS_Store | Bin 0 -> 6148 bytes app/assets/stylesheets/style.css | 6 ++++++ app/controllers/tasks_controller.rb | 2 +- app/views/layouts/application.html.erb | 13 ++++++++----- public/Logo.png | Bin 0 -> 9148 bytes 7 files changed, 15 insertions(+), 8 deletions(-) delete mode 100644 .ruby-gemset delete mode 100644 .ruby-version create mode 100644 app/assets/images/.DS_Store create mode 100644 public/Logo.png diff --git a/.ruby-gemset b/.ruby-gemset deleted file mode 100644 index 5d2410e51..000000000 --- a/.ruby-gemset +++ /dev/null @@ -1 +0,0 @@ -TaskListRails diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 276cbf9e2..000000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.3.0 diff --git a/app/assets/images/.DS_Store b/app/assets/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0
        -
        diff --git a/public/Logo.png b/public/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..481ae20decd09af51c8fd55ae54293c98156aff7 GIT binary patch literal 9148 zcmV;tBSYMYP)eQ)I=ltr_sdEt2pW?t7uFI7#W2F=nBX9L0gRA_rE@?mD=k znZE#lhlmZI&*8fk4X$|ctvJ{Hc~0p_aw#C(CTQfGpSy6N=l=bfUPYVYfFB18FcD2` z2Ef@$x7fghU`#sF^?3w7oe-%KBavty5bop}Jk#8$KR17U@0)&%SHCL`)Pn={1QY3K z=PUpgM|Y62@z}|;@@r`IC2BRG9L7M)n0L6qBu}r zFfr!ZCxG+XGpS!p)I3GMYa?B!aim9#F^FC|JU9L5GY6N|%`n;Ls=$Q*$~)H2zxjl< zsD-Rf81XgiSb>SkV8V3Sg#X)v9RD#kup%423-zVq!1!^Xu3)0ZuKm6_T_3{+der0| zJ(WLn=)^^@m=^!FGIp4{=I~^c<(Vkn{{YY>0Q3@)RuWG^ z$fp6o$%J?g0vzk^kpS*HVx;wR`^%|FPBc`jw;~7Lu3&-)w(2dr-><;Lfg{zAoz&5| zeF{4Ri8TbJnll&$pgR!Y1aW^~Nq<-B8&Pl8kseb)%Kj^$z=Vuvf*{|R(~q1#*t^@0 zrF~~DnF$U0Rfw3hwHs_7`R5HxKpuTayC{OeoL9TT`-~vvM0YS^fQX;LSwM zQGp3bFcCEBJw3PU1E3lAwTIh=SRT)$E}f{wRQ)Or_;Emi2?ZwnWTf2ht4_F}so|KZ z-vyv)M9`??=;B40AH5Q`zlr=#8McY!u6N&x=Mw}bM7Lt|X-7}pf(WNs!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 zfU^2EEKkhu#**$CFF|zvJ}+y;GVOc{+umcD#jt`_B49W+w4r`-{3pl{l z@s2ho2(EueiN>b{a(LeI)uuzGY~2(0%W! zyeOUL#BullcsXd$TbMNr`;FbOxp^G6PZ$4-siViMe=}~5T|odzd)$|6T#f`QIkMZV ztM6*&I-dHq8al)whngpE9g91XzwWU1jf|b}(w(yMAhWMM!G!DpwP+_IPhXofd8W?! z3?epJLrzGrOGn%u&vu(R+3Wl#?(>EkcfE%pyc>zN3UWBWYfRUl3|dg7+*E|X=?#UlR!I#n3cN9G^jHpT8WA!vS0dQaI643P{Pn$WN_C6qFdZyj$b)(UIq3gLnNkXn(5xfx`h2)C&#y znLz9?gKCDagHF%KH@0pIb6Ap@`CCQ5dhHu%z+LsS6aNpz;Dsa@<_B~D0000 Date: Thu, 29 Sep 2016 20:37:28 -0700 Subject: [PATCH 19/47] added hover feature on buttons --- app/assets/stylesheets/style.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/style.css b/app/assets/stylesheets/style.css index c61677c2a..55473bb11 100644 --- a/app/assets/stylesheets/style.css +++ b/app/assets/stylesheets/style.css @@ -49,6 +49,11 @@ font: normal normal 14px/1 "Josefin Sans"; font-size: 16px; } +.button:hover { + background-color: #fff796; + color: #b24569; +} + ul li { list-style-type: none; padding: 0 1% 0 1%; From e00ef8a5b8caab922b7586411316a181717c0797 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 30 Sep 2016 10:00:07 -0700 Subject: [PATCH 20/47] created a people controller and a person model --- app/assets/javascripts/people.coffee | 3 ++ app/assets/stylesheets/people.scss | 3 ++ app/assets/stylesheets/style.css | 18 ++++++---- app/controllers/people_controller.rb | 22 ++++++++++++ app/helpers/people_helper.rb | 2 ++ app/models/person.rb | 2 ++ app/views/people/create.html.erb | 2 ++ app/views/people/destroy.html.erb | 2 ++ app/views/people/edit.html.erb | 2 ++ app/views/people/index.html.erb | 2 ++ app/views/people/new.html.erb | 2 ++ app/views/people/show.html.erb | 2 ++ app/views/people/update.html.erb | 2 ++ config/routes.rb | 16 ++++++++- db/migrate/20160930165830_create_people.rb | 9 +++++ db/schema.rb | 8 ++++- public/Logo.png | Bin 9148 -> 8736 bytes test/controllers/people_controller_test.rb | 39 +++++++++++++++++++++ test/fixtures/people.yml | 7 ++++ test/models/person_test.rb | 7 ++++ 20 files changed, 141 insertions(+), 9 deletions(-) create mode 100644 app/assets/javascripts/people.coffee create mode 100644 app/assets/stylesheets/people.scss create mode 100644 app/controllers/people_controller.rb create mode 100644 app/helpers/people_helper.rb create mode 100644 app/models/person.rb create mode 100644 app/views/people/create.html.erb create mode 100644 app/views/people/destroy.html.erb create mode 100644 app/views/people/edit.html.erb create mode 100644 app/views/people/index.html.erb create mode 100644 app/views/people/new.html.erb create mode 100644 app/views/people/show.html.erb create mode 100644 app/views/people/update.html.erb create mode 100644 db/migrate/20160930165830_create_people.rb create mode 100644 test/controllers/people_controller_test.rb create mode 100644 test/fixtures/people.yml create mode 100644 test/models/person_test.rb diff --git a/app/assets/javascripts/people.coffee b/app/assets/javascripts/people.coffee new file mode 100644 index 000000000..24f83d18b --- /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/stylesheets/people.scss b/app/assets/stylesheets/people.scss new file mode 100644 index 000000000..521746256 --- /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/style.css b/app/assets/stylesheets/style.css index 55473bb11..e69783f57 100644 --- a/app/assets/stylesheets/style.css +++ b/app/assets/stylesheets/style.css @@ -51,7 +51,7 @@ font: normal normal 14px/1 "Josefin Sans"; .button:hover { background-color: #fff796; - color: #b24569; + color: #FF7CA7; } ul li { @@ -84,12 +84,7 @@ input { .navigation-container li a:hover { /*color: #ff7ca7;*/ - color: #b24569; -} - -a:hover { - /*color: #c98f8f;*/ - color: #4fb1cc; + color: #FF7CA7; } a:link { @@ -100,6 +95,7 @@ a:link { /************************************/ /* MAIN BODY SECTION - INDEX.HTML */ /************************************/ + body { margin-left: .5%; margin-right: .5%; @@ -117,6 +113,14 @@ h3 { font-size: 2em; } +.font-style a:link { + color: #FF7CA7; +} + +.font-style a:hover { + color: #4fb1cc;; +} + /************************************/ /* FOOTER */ /************************************/ diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb new file mode 100644 index 000000000..24de03a6e --- /dev/null +++ b/app/controllers/people_controller.rb @@ -0,0 +1,22 @@ +class PeopleController < ApplicationController + def index + end + + def show + end + + def edit + end + + def create + end + + def new + end + + def update + end + + def destroy + end +end diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb new file mode 100644 index 000000000..b682fbf12 --- /dev/null +++ b/app/helpers/people_helper.rb @@ -0,0 +1,2 @@ +module PeopleHelper +end diff --git a/app/models/person.rb b/app/models/person.rb new file mode 100644 index 000000000..2f2e286c0 --- /dev/null +++ b/app/models/person.rb @@ -0,0 +1,2 @@ +class Person < ActiveRecord::Base +end diff --git a/app/views/people/create.html.erb b/app/views/people/create.html.erb new file mode 100644 index 000000000..eaa521a99 --- /dev/null +++ b/app/views/people/create.html.erb @@ -0,0 +1,2 @@ +

        People#create

        +

        Find me in app/views/people/create.html.erb

        diff --git a/app/views/people/destroy.html.erb b/app/views/people/destroy.html.erb new file mode 100644 index 000000000..42a6ded2c --- /dev/null +++ b/app/views/people/destroy.html.erb @@ -0,0 +1,2 @@ +

        People#destroy

        +

        Find me in app/views/people/destroy.html.erb

        diff --git a/app/views/people/edit.html.erb b/app/views/people/edit.html.erb new file mode 100644 index 000000000..b80753264 --- /dev/null +++ b/app/views/people/edit.html.erb @@ -0,0 +1,2 @@ +

        People#edit

        +

        Find me in app/views/people/edit.html.erb

        diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb new file mode 100644 index 000000000..72f624e4c --- /dev/null +++ b/app/views/people/index.html.erb @@ -0,0 +1,2 @@ +

        People#index

        +

        Find me in app/views/people/index.html.erb

        diff --git a/app/views/people/new.html.erb b/app/views/people/new.html.erb new file mode 100644 index 000000000..783270e08 --- /dev/null +++ b/app/views/people/new.html.erb @@ -0,0 +1,2 @@ +

        People#new

        +

        Find me in app/views/people/new.html.erb

        diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb new file mode 100644 index 000000000..0de309092 --- /dev/null +++ b/app/views/people/show.html.erb @@ -0,0 +1,2 @@ +

        People#show

        +

        Find me in app/views/people/show.html.erb

        diff --git a/app/views/people/update.html.erb b/app/views/people/update.html.erb new file mode 100644 index 000000000..79a6b9f23 --- /dev/null +++ b/app/views/people/update.html.erb @@ -0,0 +1,2 @@ +

        People#update

        +

        Find me in app/views/people/update.html.erb

        diff --git a/config/routes.rb b/config/routes.rb index a86f348a8..f21f83df4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,19 @@ Rails.application.routes.draw do - root to: "posts#index" + root to: "tasks#index" + + get 'people/index' + + get 'people/show' + + get 'people/edit' + + get 'people/create' + + get 'people/new' + + get 'people/update' + + get 'people/destroy' get 'tasks/index', as: 'index' diff --git a/db/migrate/20160930165830_create_people.rb b/db/migrate/20160930165830_create_people.rb new file mode 100644 index 000000000..727e50381 --- /dev/null +++ b/db/migrate/20160930165830_create_people.rb @@ -0,0 +1,9 @@ +class CreatePeople < ActiveRecord::Migration + def change + create_table :people do |t| + t.string :name + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1c912097b..c62457c12 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,13 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160928220045) do +ActiveRecord::Schema.define(version: 20160930165830) do + + create_table "people", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end create_table "tasks", force: :cascade do |t| t.string "title" diff --git a/public/Logo.png b/public/Logo.png index 481ae20decd09af51c8fd55ae54293c98156aff7..a125638207d323e2d5ff3f5aa194985ffe6d6e05 100644 GIT binary patch literal 8736 zcmYkiWmr_-7xz5@3=Iw~4MR$U(lDe$h(kz9OG%f6#2_uwEsZn?h%^F2htl0Slu{DX z-28vfb6?l}W?kpaKI^RS-q%@ceb$adYCI>xe~b?R0Eko&idp~w2>S5Mhl}%I{U0B} z0RSd|ilUs3x5>V-Pugpxy8A2>M92|TPJr2gC5lH*QCHR*4XKd^5(%k$!40sm<>2{Y zyTpX*|482@abW4BAc{Cxar{x7>z(YRkLIZ2{huSD^=OZOKBljhn*9G6HN5w=PAI+O zPj9Zvl-QoE8W#5??zkbu))m4RNJIV!#6wHC*?j^fySF}>6Y9HhYedoj)=0lYECb4a zVLjzqo#uTFv8vC@jtPG%YigGbfRV_}_P>hP3 z04}!pr-RcGMe}aTnGE4#ZYF_j!CfWC^=hC+AN|2DH!p#j9fa^0wiu2HI!nrNd|B8d?K9p)fnfYBmt8a`_Z8Dypy;mKp141R>A6%tz zMZr>IE15-r*~cie`qH*`;gk=yHr$>vZCWm$47%~vfM8f}*vK>hPx{fi{Jk8&8DKGe zZBatO3vm%a(eti8&TD6VpN-o~rZc<}=Wug8GY`O{X97xOt7fJ4d<*{z)@zXy!_Q4x z%GLyr5rWy*Ic@KjHSnpK%u$Mxm-akoLp_5O0L4t&+|u^G@f*F`CTgZUY*>O)!wF5Y zCvw9GFkdq!-5&jGZ=&=X^-oWPUGT(MoYM>y0)!5^)!>^9EdrpF`op=ZkQfZw&GO9d zU2(?sFd*_7ATp1y3EA{0(Wqg>8j2%bNe z<#ZqkhRx%_bU?Y!few7(kN9GIeeF-$>cy>}n${^l2tgQUn-bjXc2xG@`e5(K-v*^f z8x+z_+!LCC+SMerqDaeiFI~J0UR#i#NX$bqU=zj(z~y7LZ@&I-rQ62F{~Qp)$kTR= zu#n+a$+p)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x%A0D#&};agk_QEZgk> z7v&VBy5^8E9hKXJF`QmK8n4cpwZ{-((aWkC000AbNklkzfd?qNuN-x{;fMZ+3|wj3z}XH%9KmsRc72hfc)I} zh8`hE(tlwE#Xdkaee^{W7bD@1y$aEkn}j%#Fa~GGHgs>3O;znEe_Ug^mZed8(R><) zT@Mo|<7UT+(T^zG{*xKE$P3#Vgpqf{D+O#`duGKJKN79q-C*K~Tee&Up4;$iMI{1pJch_(nT|mHF2vbzJc4+lTw3iK4CYD)i;mZy0$4 zfU^2EEKkhu#**$CFF|zvJ}+y;GVOc{+umcD#jt`_B49W+w4r`-{3pl{l z@s2ho2(EueiN>b{a(LeI)uuzGY~2(0%W! zyeOUL#BullcsXd$TbMNr`;FbOxp^G6PZ$4-siViMe=}~5T|odzd)$|6T#f`QIkMZV ztM6*&I-dHq8al)whngpE9g91XzwWU1jf|b}(w(yMAhWMM!G!DpwP+_IPhXofd8W?! z3?epJLrzGrOGn%u&vu(R+3Wl#?(>EkcfE%pyc>zN3UWBWYfRUl3|dg7+*E|X=?#UlR!I#n3cN9G^jHpT8WA!vS0dQaI643P{Pn$WN_C6qFdZyj$b)(UIq3gLnNkXn(5xfx`h2)C&#y znLz9?gKCDagHF%KH@0pIb6Ap@`CCQ5dhHu%z+LsS6aNpz;Dsa@<_B~D0000 Date: Fri, 30 Sep 2016 10:16:02 -0700 Subject: [PATCH 21/47] created belongs_to association - a task belongs to a person --- Gemfile | 2 ++ Gemfile.lock | 7 +++++++ db/migrate/20160930171540_add_person_to_task.rb | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 db/migrate/20160930171540_add_person_to_task.rb diff --git a/Gemfile b/Gemfile index d7371e6c2..b8edd684d 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,8 @@ end group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' + gem "better_errors" + gem "binding_of_caller" # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' diff --git a/Gemfile.lock b/Gemfile.lock index b6d552c2c..86a8d23f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,10 +38,15 @@ GEM tzinfo (~> 1.1) arel (6.0.3) awesome_print (1.7.0) + better_errors (2.1.1) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) byebug (9.0.5) + coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) @@ -148,6 +153,8 @@ PLATFORMS DEPENDENCIES awesome_print + better_errors + binding_of_caller byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) diff --git a/db/migrate/20160930171540_add_person_to_task.rb b/db/migrate/20160930171540_add_person_to_task.rb new file mode 100644 index 000000000..9f031134b --- /dev/null +++ b/db/migrate/20160930171540_add_person_to_task.rb @@ -0,0 +1,5 @@ +class AddPersonToTask < ActiveRecord::Migration + def change + add_reference :tasks, :person, index: true, foreign_key: true + end +end From a3cba947f63aa9accb547baa9e912e8739931095 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 30 Sep 2016 10:18:56 -0700 Subject: [PATCH 22/47] migrated --- app/models/person.rb | 1 + app/models/task.rb | 1 + db/schema.rb | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/person.rb b/app/models/person.rb index 2f2e286c0..4ed22ba8b 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,2 +1,3 @@ class Person < ActiveRecord::Base + has_many :tasks end diff --git a/app/models/task.rb b/app/models/task.rb index 935f76e12..c3c534741 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,2 +1,3 @@ class Task < ActiveRecord::Base + belongs_to :person end diff --git a/db/schema.rb b/db/schema.rb index c62457c12..301fefd80 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160930165830) do +ActiveRecord::Schema.define(version: 20160930171540) do create_table "people", force: :cascade do |t| t.string "name" @@ -26,6 +26,9 @@ t.datetime "completed_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "person_id" end + add_index "tasks", ["person_id"], name: "index_tasks_on_person_id" + end From 9c04fbad8de3a629c9a4bccdb7a3956031da6c81 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 30 Sep 2016 11:36:44 -0700 Subject: [PATCH 23/47] got individualized index pages working for different people --- app/controllers/people_controller.rb | 9 +++++++++ app/controllers/tasks_controller.rb | 4 ++-- app/views/tasks/index.html.erb | 1 + app/views/tasks/show.html.erb | 3 ++- config/routes.rb | 28 ++++++++++++++-------------- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 24de03a6e..bf64a2b12 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -1,17 +1,26 @@ class PeopleController < ApplicationController def index + @people = Person.all end def show + @person = Person.find(params[:id]) + + if @person == nil + render :file => 'public/404.html', + :status => :not_found, :layout => false + end end def edit end def create + @person = Person.new end def new + @person = Person.new end def update diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 952ea5ff0..e12f68da3 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -1,6 +1,6 @@ class TasksController < ApplicationController def index - @tasks = Task.all + @tasks = Task.where(person_id: params[:id]) end def new @@ -52,7 +52,7 @@ def show def completion_status @task = Task.find(params[:id]) - + @task.update_attribute(:completed_at, Time.now) @task.update_attribute(:completion_status, true) diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 4c8545502..3e18b0d1a 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,3 +1,4 @@ +

        Daily Task List

        <% @tasks.each do |task| %> diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index a39b9626a..92b64eacb 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -1,5 +1,6 @@
        -

        Task Name: <%= @task.title%>

        + +

        Task Name: <%= @task.title%>

        Description: <%= @task.description %>

        Completed? <% if @task.completion_status == true %> diff --git a/config/routes.rb b/config/routes.rb index f21f83df4..05ee89aaf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,21 +1,21 @@ Rails.application.routes.draw do root to: "tasks#index" - - get 'people/index' - get 'people/show' - - get 'people/edit' - - get 'people/create' - - get 'people/new' - - get 'people/update' - - get 'people/destroy' + # get 'people/index', as: 'people-index' + # + # get 'people/show/:id', 'people#show', as: 'people-show' + # + # get 'people/edit' + # + # get 'people/create' + # + # get 'people/new' + # + # get 'people/update' + # + # get 'people/destroy' - get 'tasks/index', as: 'index' + get 'tasks/:id/index' => "tasks#index", as: 'index' get 'tasks/new'=> "tasks#new", as: "new" From f3c9395cb13e4b9615cea43497f2da447121b231 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 30 Sep 2016 13:55:30 -0700 Subject: [PATCH 24/47] has working individualized name on tasks index page. --- app/controllers/people_controller.rb | 9 +++++++++ app/controllers/tasks_controller.rb | 5 ++++- app/views/layouts/application.html.erb | 2 +- app/views/people/index.html.erb | 17 +++++++++++++++-- app/views/tasks/index.html.erb | 2 +- app/views/tasks/show.html.erb | 1 - config/routes.rb | 6 +++--- 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index bf64a2b12..5c4a727ae 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -1,6 +1,10 @@ class PeopleController < ApplicationController def index @people = Person.all + + @tasks = Task.where(person_id: params[:person_id]) + @incomplete_tasks = 0 + end def show @@ -17,6 +21,11 @@ def edit def create @person = Person.new + @params = params + @person.name = params[:person][:name] + + @person.save + redirect_to action: "people-index" end def new diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index e12f68da3..10ebd9a23 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -1,6 +1,8 @@ class TasksController < ApplicationController def index - @tasks = Task.where(person_id: params[:id]) + + @person = Person.find( params[:person_id].to_i) + @tasks = @person.tasks end def new @@ -42,6 +44,7 @@ def edit end def show + @task = Task.find(params[:id]) if @task == nil diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a98d7f3e0..495bd07a1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,7 +13,7 @@ diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb index 72f624e4c..98d4adad6 100644 --- a/app/views/people/index.html.erb +++ b/app/views/people/index.html.erb @@ -1,2 +1,15 @@ -

        People#index

        -

        Find me in app/views/people/index.html.erb

        +

        List of Current Users

        + +<% @people.each do |person| %> + + <% @tasks.each do |task| %> + <% if task.completion_status == false %> + <% @incomplete_tasks += 1 %> + <% end %> + <% end %> + +
          +
        • <%= person.name %>: <%= @incomplete_tasks %>
        • +
        + +<% end %> diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 3e18b0d1a..422fd263e 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,4 +1,4 @@ - +

        Hello, <%= @person.name %>!

        Daily Task List

        <% @tasks.each do |task| %> diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index 92b64eacb..4c4d68104 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -1,5 +1,4 @@
        -

        Task Name: <%= @task.title%>

        Description: <%= @task.description %>

        Completed? diff --git a/config/routes.rb b/config/routes.rb index 05ee89aaf..5bd13296c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do root to: "tasks#index" - # get 'people/index', as: 'people-index' + get 'people/index', as: 'people-index' # # get 'people/show/:id', 'people#show', as: 'people-show' # @@ -15,7 +15,7 @@ # # get 'people/destroy' - get 'tasks/:id/index' => "tasks#index", as: 'index' + get 'tasks/:person_id/index' => "tasks#index", as: 'index' get 'tasks/new'=> "tasks#new", as: "new" @@ -24,7 +24,7 @@ get 'tasks/update' put "tasks/:id/update" => "tasks#update", as: "update" - get 'tasks/show/:id' => 'tasks#show', as: 'show' + get 'tasks/show/:id/' => 'tasks#show', as: 'show' delete 'tasks/:id/destroy' => "tasks#destroy", as: "delete" From d2e62f7d068419c03a8a27fe762803dce3d50839 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 30 Sep 2016 14:58:29 -0700 Subject: [PATCH 25/47] changed main homepage to be list of current users and linked to individual task lists. created new layout so that current user list page has a link to add a new person. --- app/controllers/people_controller.rb | 9 ++++++- app/controllers/tasks_controller.rb | 2 ++ app/views/layouts/application.html.erb | 2 +- app/views/layouts/people.html.erb | 35 ++++++++++++++++++++++++++ app/views/people/index.html.erb | 2 +- app/views/people/new.html.erb | 16 ++++++++++-- app/views/tasks/new.html.erb | 2 ++ config/routes.rb | 12 ++++----- 8 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 app/views/layouts/people.html.erb diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 5c4a727ae..f4147ea52 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -1,4 +1,5 @@ class PeopleController < ApplicationController + def index @people = Person.all @@ -25,7 +26,7 @@ def create @person.name = params[:person][:name] @person.save - redirect_to action: "people-index" + redirect_to action: "index" end def new @@ -37,4 +38,10 @@ def update def destroy end + + private + def action + render :layout => 'people' + end + end diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 10ebd9a23..9391bf814 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -7,6 +7,7 @@ def index def new @mytask = Task.new + @people = Person.all end def create @@ -14,6 +15,7 @@ def create @mytask = Task.new @mytask.title = params[:task][:title] @mytask.description = params[:task][:description] + @mytask.person_id = params[:task][:person_id] @mytask.save redirect_to action: "index" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 495bd07a1..1fc6966bc 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,7 +13,7 @@ diff --git a/app/views/layouts/people.html.erb b/app/views/layouts/people.html.erb new file mode 100644 index 000000000..84d88e833 --- /dev/null +++ b/app/views/layouts/people.html.erb @@ -0,0 +1,35 @@ + + + + TaskListRails + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + +
        + + + +
        + + +<%= yield %> + +
        +

        + Copyright 2016, Rachel Pavilanis +

        + +
        + + + diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb index 98d4adad6..005832e6c 100644 --- a/app/views/people/index.html.erb +++ b/app/views/people/index.html.erb @@ -9,7 +9,7 @@ <% end %>
          -
        • <%= person.name %>: <%= @incomplete_tasks %>
        • +
        • <%= link_to(person.name, index_path(person.id)) %>: <%= @incomplete_tasks %>
        <% end %> diff --git a/app/views/people/new.html.erb b/app/views/people/new.html.erb index 783270e08..bdcd97247 100644 --- a/app/views/people/new.html.erb +++ b/app/views/people/new.html.erb @@ -1,2 +1,14 @@ -

        People#new

        -

        Find me in app/views/people/new.html.erb

        +

        Create a New Person

        + +<%= form_for @person, + url: createperson_path do |f| %> + <%= f.label :name %> + <%= f.text_field :name %> + + <%= f.submit :class=>"button" %> + + <%= tag(:input, :type => "hidden", + :name => request_forgery_protection_token.to_s, + :value => form_authenticity_token) %> + + <% end %> diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 75cda1d7a..a53d48277 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -8,6 +8,8 @@ <%= f.label :description %> <%= f.text_area :description %> + <%= select("person", "person_id", @people.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) %> + <%= f.submit :class=>"button" %> <%= tag(:input, :type => "hidden", diff --git a/config/routes.rb b/config/routes.rb index 5bd13296c..3a959c09f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - root to: "tasks#index" + root to: "people#index" get 'people/index', as: 'people-index' # @@ -7,9 +7,9 @@ # # get 'people/edit' # - # get 'people/create' - # - # get 'people/new' + post 'people/create' => 'people#create', as: "createperson" + + get 'people/new' => "people#new", as: "newperson" # # get 'people/update' # @@ -17,9 +17,9 @@ get 'tasks/:person_id/index' => "tasks#index", as: 'index' - get 'tasks/new'=> "tasks#new", as: "new" + get 'tasks/new/'=> "tasks#new", as: "new" - post 'tasks/create' => 'tasks#create', as: "create" + post 'tasks/create/' => 'tasks#create', as: "create" get 'tasks/update' put "tasks/:id/update" => "tasks#update", as: "update" From 89424d0503f074c52804ea294acae65241d18a2a Mon Sep 17 00:00:00 2001 From: Rachel Pavilanis Date: Mon, 3 Oct 2016 09:26:14 -0700 Subject: [PATCH 26/47] Update README.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 2b96daf9c..9731b2c7e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ +## What went well? +I really liked this assignment, because it aligns with some of my personal interests and capstone ideas. I am loving Ruby on Rails. Even though we are just beginning to learn about the functionality of Rails, it already feels so much more powerful and complete than anything we have done before. I love combining many of the concepts we have learned thus far into a single project. I think this project also made me feel more confident and secure in some of the previously covered concepts like CSS and Ruby. + +Since I finished my project early, I was really excited about adding User functionality. I decided to let my curiousity lead me down the path of trying to add some of those features, and I am really glad I did. I was able to get individualized task lists working for various users, and also created a different layout page for the user home screen and the task home screen. Normally I am too nervous to experiment because I don't want to break anything. Although I did end up breaking several things (I can no longer add a new task or mark a task as complete, because these features are not linked to a specific user), I also learned a lot. I'm excited to learn more about adding users and user relationships in lectures this week, and I am hoping to go back in to make everything work again. + +## What are you still working on understanding better? + +I am definitely looking forward to learning more about how to actually create different user views. + +I also feel like CSS is an area where I kind of stumble around blindly until I get something that looks good to me. I have used similar headers and navigation bars in my projects, because I found something that works and I am nervous to change that too much. In my next project, I want to push myself to do something totally different (maybe a side navigation) so that I can continue building my skills in this area. + +## What did your chair pair do differently? + +My chair pair had the details of each of here tasks displayed on the main page - I liked this because all of the detail is right there. In my project, it felt like an additional unneeded step for users to have to click on a task before seeing the description. + +## + + # Task List Rails ✅ We are going to build a Task List in Rails. This web application will enable us to keep track of list of tasks with the functionality to add, edit and remove tasks from a list. From f3232453bed64d1c41da5cd7262c3b3ba2ebbe84 Mon Sep 17 00:00:00 2001 From: Rachel Date: Tue, 4 Oct 2016 21:25:09 -0700 Subject: [PATCH 27/47] fixed some things and broke other things - my show method is working, as is my ability to mark things as complete. I am able to delete tasks, however, my redirect_to: index isn't working in my destroy controller method, or really anywhere. I am able to go into edit something, but then the edit form is blank and even if I change nothing and hit edit, the form then becomes blank. I really want to get this working with having the different layouts and people with their various tasks, so I will probably keep working on this. --- app/controllers/tasks_controller.rb | 46 ++++++++++++++++---------- app/views/layouts/application.html.erb | 4 +-- app/views/layouts/people.html.erb | 2 +- app/views/people/index.html.erb | 12 ++++--- app/views/tasks/_form.html.erb | 15 +++++++++ app/views/tasks/edit.html.erb | 19 +---------- app/views/tasks/index.html.erb | 6 ++-- app/views/tasks/new.html.erb | 18 +--------- app/views/tasks/show.html.erb | 8 ++--- config/routes.rb | 14 ++++---- 10 files changed, 71 insertions(+), 73 deletions(-) create mode 100644 app/views/tasks/_form.html.erb diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 9391bf814..897298472 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -6,31 +6,21 @@ def index end def new - @mytask = Task.new + @task = Task.new @people = Person.all end def create @params = params - @mytask = Task.new - @mytask.title = params[:task][:title] - @mytask.description = params[:task][:description] - @mytask.person_id = params[:task][:person_id] - @mytask.save - redirect_to action: "index" - # Task.create(title: params[:title], description: params[:description]) - end + @task = Task.new + @task.title = params[:task][:title] + @task.description = params[:task][:description] + @task.person_id = params[:person_id].to_i + @task.save - def update - @task = Task.find(params[:id]) + redirect_to index_path(@task.id, params[:person_id]) - if @task.update(title: params[:title], description: params[:description]) - redirect_to action: "show" - else - # another way to redirect - render 'edit' - end end def destroy @@ -43,8 +33,30 @@ def destroy def edit @task = Task.find(params[:id]) + + if @task == nil + render :file => 'public/404.html', + :status => :not_found + end + end + + def update + @task = Task.find(params[:id]) + + if @task == nil + render :file => 'public/404.html', + :status => :not_found + end + + if @task.update(title: params[:title], description: params[:description]) + redirect_to action: "show" + else + # another way to redirect + render 'edit' + end end + def show @task = Task.find(params[:id]) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1fc6966bc..64040a836 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,8 +13,8 @@ diff --git a/app/views/layouts/people.html.erb b/app/views/layouts/people.html.erb index 84d88e833..45a81449e 100644 --- a/app/views/layouts/people.html.erb +++ b/app/views/layouts/people.html.erb @@ -13,7 +13,7 @@ diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb index 005832e6c..90121a277 100644 --- a/app/views/people/index.html.erb +++ b/app/views/people/index.html.erb @@ -2,14 +2,18 @@ <% @people.each do |person| %> - <% @tasks.each do |task| %> + +
          -
        • <%= link_to(person.name, index_path(person.id)) %>: <%= @incomplete_tasks %>
        • +
        • <%= link_to(person.name, index_path(person.id)) %>
        • + +
        <% end %> diff --git a/app/views/tasks/_form.html.erb b/app/views/tasks/_form.html.erb new file mode 100644 index 000000000..ee86c41da --- /dev/null +++ b/app/views/tasks/_form.html.erb @@ -0,0 +1,15 @@ +<%= form_for @task, + url: action_name do |f| %> + <%= f.label :title %> + <%= f.text_field :title %> + + <%= f.label :description %> + <%= f.text_area :description %> + + <%= f.submit :class=>"button" %> + + <%= tag(:input, :type => "hidden", + :name => request_forgery_protection_token.to_s, + :value => form_authenticity_token) %> + + <% end %> diff --git a/app/views/tasks/edit.html.erb b/app/views/tasks/edit.html.erb index f4dc29ec0..333ff723e 100644 --- a/app/views/tasks/edit.html.erb +++ b/app/views/tasks/edit.html.erb @@ -1,20 +1,3 @@

        Edit Task

        -
        - - - - - - - - - <%= tag(:input, :type => "hidden", - :name => request_forgery_protection_token.to_s, - :value => form_authenticity_token) %> - - - -
        +<%= render partial: "form", locals: {action_name: "update", params: {id: @task.id, person_id: params[:person_id]}} %> diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 422fd263e..0735eae00 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -16,9 +16,9 @@

        • -
        • <%= button_to 'Complete', complete_path(task), :class => 'button', method: :patch %>
        • -
        • <%= button_to 'Edit', edit_path(task), :class => 'button' %>
        • -
        • <%= button_to 'Delete', delete_path(task), :class => 'button', +
        • <%= button_to 'Complete', complete_path(task, params[:person_id]), :class => 'button', method: :patch %>
        • +
        • <%= button_to 'Edit', edit_path(task, params[:person_id]), :class => 'button', method: :get %>
        • +
        • <%= button_to 'Delete', delete_path(task, params[:person_id]), :class => 'button', method: :delete, data: { confirm: 'Are you sure?' } %>
        diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index a53d48277..873bba31f 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,19 +1,3 @@

        Create a New Task

        -<%= form_for @mytask, - url: create_path do |f| %> - <%= f.label :title %> - <%= f.text_field :title %> - - <%= f.label :description %> - <%= f.text_area :description %> - - <%= select("person", "person_id", @people.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) %> - - <%= f.submit :class=>"button" %> - - <%= tag(:input, :type => "hidden", - :name => request_forgery_protection_token.to_s, - :value => form_authenticity_token) %> - - <% end %> +<%= render partial: "form", locals: {action_name: "create", params: {id: @task.id, person_id: params[:person_id]}}%> diff --git a/app/views/tasks/show.html.erb b/app/views/tasks/show.html.erb index 4c4d68104..0d9b7b59a 100644 --- a/app/views/tasks/show.html.erb +++ b/app/views/tasks/show.html.erb @@ -10,10 +10,10 @@

        Completed Time and Date: <%= @task.completed_at %>

          -
        • <%= button_to 'Edit', edit_path(@task), :class => 'button' %>
        • -
        • <%= button_to 'Delete', delete_path(@task), :class => 'button', - method: :delete, - data: { confirm: 'Are you sure?' } %>
        • +
        • <%= button_to 'Edit', edit_path(@task.id, params[:person_id]), :class => 'button', method: :get %>
        • +
        • <%= button_to 'Delete', delete_path(@task.id, params[:person_id]), :class => 'button', + method: :delete, + data: { confirm: 'Are you sure?' } %>
    diff --git a/config/routes.rb b/config/routes.rb index 3a959c09f..864b6d7b9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,22 +15,22 @@ # # get 'people/destroy' - get 'tasks/:person_id/index' => "tasks#index", as: 'index' + get 'tasks/:person_id/index' => "tasks#index", as: "index" get 'tasks/new/'=> "tasks#new", as: "new" - post 'tasks/create/' => 'tasks#create', as: "create" + post 'tasks/:id/create/:person_id' => 'tasks#create', as: "create" - get 'tasks/update' - put "tasks/:id/update" => "tasks#update", as: "update" + # get 'tasks/update' + get "tasks/:id/edit" => "tasks#edit", as: "edit" + + patch "tasks/:id/update/" => "tasks#update", as: "update" get 'tasks/show/:id/' => 'tasks#show', as: 'show' delete 'tasks/:id/destroy' => "tasks#destroy", as: "delete" - post "tasks/:id/edit" => "tasks#edit", as: "edit" - - patch 'tasks/:id/completion_status' => 'tasks#completion_status', as: "complete" + patch 'tasks/:id/completion_status/:person_id' => 'tasks#completion_status', as: "complete" # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From 2e70b41654c5dfb8fc3c357b9348286369f95618 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 5 Oct 2016 08:59:25 -0700 Subject: [PATCH 28/47] edit feature is working with users now --- app/controllers/tasks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 897298472..7056e08e1 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -48,7 +48,7 @@ def update :status => :not_found end - if @task.update(title: params[:title], description: params[:description]) + if @task.update(title: params[:task][:title], description: params[:task][:description]) redirect_to action: "show" else # another way to redirect From 04c58646836346ef8f4e379254d1f2e6f189c6d7 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 5 Oct 2016 21:48:52 -0700 Subject: [PATCH 29/47] tried a few things with new/create to get it working again - still not working for new task now that I have users. --- app/controllers/tasks_controller.rb | 7 +++---- app/views/tasks/new.html.erb | 2 +- config/routes.rb | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 7056e08e1..31f2351fc 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -16,10 +16,10 @@ def create @task = Task.new @task.title = params[:task][:title] @task.description = params[:task][:description] - @task.person_id = params[:person_id].to_i + # @task.person_id = params[:person_id].to_i @task.save - redirect_to index_path(@task.id, params[:person_id]) + redirect_to index_path( params[:person_id]) end @@ -27,8 +27,7 @@ def destroy @task = Task.find(params[:id]) @task.destroy - redirect_to action: "index" - + redirect_to root_path end def edit diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 873bba31f..e3def880d 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,3 +1,3 @@

    Create a New Task

    -<%= render partial: "form", locals: {action_name: "create", params: {id: @task.id, person_id: params[:person_id]}}%> +<%= render partial: "form", locals: {action_name: "create", params: {person_id: params[:person_id]}}%> diff --git a/config/routes.rb b/config/routes.rb index 864b6d7b9..cb13c6204 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,7 +19,7 @@ get 'tasks/new/'=> "tasks#new", as: "new" - post 'tasks/:id/create/:person_id' => 'tasks#create', as: "create" + post 'tasks/create/' => 'tasks#create', as: "create" # get 'tasks/update' get "tasks/:id/edit" => "tasks#edit", as: "edit" From 53dbfa55df6bdba675a5ab913ef9638a25199d34 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 5 Oct 2016 22:46:29 -0700 Subject: [PATCH 30/47] I'm seriously cheering right now - I FINALLY got the new/create features to work by adding a parameter in when I created a new task and adjusting my routes file to accept a person_id when creating a new task. Feeling SO proud of myself right now. LOL. --- app/controllers/tasks_controller.rb | 10 ++++++---- app/views/tasks/new.html.erb | 2 +- config/routes.rb | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 31f2351fc..59fea6ccf 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -6,8 +6,8 @@ def index end def new - @task = Task.new - @people = Person.all + @task = Task.new(:person_id => params[:person_id].to_i) + # @people = Person.all end def create @@ -16,10 +16,12 @@ def create @task = Task.new @task.title = params[:task][:title] @task.description = params[:task][:description] - # @task.person_id = params[:person_id].to_i + @task.person_id = params[:person_id].to_i @task.save - redirect_to index_path( params[:person_id]) + + + redirect_to index_path( @task.person_id) end diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index e3def880d..8ca0a6eab 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,3 +1,3 @@

    Create a New Task

    -<%= render partial: "form", locals: {action_name: "create", params: {person_id: params[:person_id]}}%> +<%= render partial: "form", locals: {action_name: "create", params: {person_id: @task.person_id }}%> diff --git a/config/routes.rb b/config/routes.rb index cb13c6204..55f0207f5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,9 +17,9 @@ get 'tasks/:person_id/index' => "tasks#index", as: "index" - get 'tasks/new/'=> "tasks#new", as: "new" + get 'tasks/:person_id/new/'=> "tasks#new", as: "new" - post 'tasks/create/' => 'tasks#create', as: "create" + post 'tasks/:person_id/create' => 'tasks#create', as: "create" # get 'tasks/update' get "tasks/:id/edit" => "tasks#edit", as: "edit" From 6e436093d701cf6ae8cc5aee07e056b8a8ca5d62 Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 5 Oct 2016 22:53:29 -0700 Subject: [PATCH 31/47] okay, there have seriously been some ups and downs in the last five minutes. But I got it working - a link just broke in my layout for tasks because I changed new to accept a parameter. It all seems to be working now, this will be my final submission for this, I think. --- app/views/layouts/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 64040a836..bb069c6e9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,7 +14,7 @@ From 4e9c315cd9910b7895f14d75478e40b8188fbcb7 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 7 Oct 2016 09:36:30 -0700 Subject: [PATCH 32/47] added gemfiles for deployment --- Gemfile | 4 +++- Gemfile.lock | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index b8edd684d..5b21eacb3 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gem 'awesome_print' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' # Use sqlite3 as the database for Active Record -gem 'sqlite3' +gem 'sqlite3', group: [:development, :test] # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets @@ -31,6 +31,8 @@ gem 'sdoc', '~> 0.4.0', group: :doc # Use Capistrano for deployment # gem 'capistrano-rails', group: :development +gem 'pg', group: :production +gem 'rails_12factor', group: :production group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index 86a8d23f6..8b3bbd2cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,6 +82,7 @@ GEM nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) + pg (0.19.0) pkg-config (1.1.7) rack (1.6.4) rack-test (0.6.3) @@ -105,6 +106,11 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) + rails_12factor (0.0.3) + rails_serve_static_assets + rails_stdout_logging + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) railties (4.2.7) actionpack (= 4.2.7) activesupport (= 4.2.7) @@ -159,7 +165,9 @@ DEPENDENCIES coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails + pg rails (= 4.2.7) + rails_12factor sass-rails (~> 5.0) sdoc (~> 0.4.0) spring From e2fb0c834667bf2f15a1d7d455f4f70ca186e4a2 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 7 Oct 2016 09:55:32 -0700 Subject: [PATCH 33/47] gemfile --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 5b21eacb3..928e96390 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gem 'awesome_print' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' # Use sqlite3 as the database for Active Record -gem 'sqlite3', group: [:development, :test] + # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets @@ -37,6 +37,7 @@ gem 'rails_12factor', group: :production group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' + gem 'sqlite3' end group :development do From d37dc0eac6fdf3d58e577a8ab4cd688daaf4bec1 Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 7 Oct 2016 10:10:30 -0700 Subject: [PATCH 34/47] tried again to update Gemfile for Heroku --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 928e96390..bb5fca1bf 100644 --- a/Gemfile +++ b/Gemfile @@ -3,8 +3,6 @@ source 'https://rubygems.org' gem 'awesome_print' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' -# Use sqlite3 as the database for Active Record - # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets @@ -37,7 +35,7 @@ gem 'rails_12factor', group: :production group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' - gem 'sqlite3' + end group :development do @@ -45,6 +43,8 @@ group :development do gem 'web-console', '~> 2.0' gem "better_errors" gem "binding_of_caller" + # Use sqlite3 as the database for Active Record + gem 'sqlite3' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' From 8ffa39a9bdf56a389230dea4b7f483a7974f4b0c Mon Sep 17 00:00:00 2001 From: Rachel Date: Tue, 18 Oct 2016 10:00:32 -0700 Subject: [PATCH 35/47] added session controller and user model, started to modify files for use with a user. --- .gitignore | 6 ++++ Gemfile | 5 +++ Gemfile.lock | 28 +++++++++++++++++ app/assets/javascripts/homepages.coffee | 3 ++ app/assets/javascripts/sessionscreate.coffee | 3 ++ app/assets/stylesheets/homepages.scss | 3 ++ app/assets/stylesheets/sessionscreate.scss | 3 ++ app/assets/stylesheets/style.css | 6 +++- app/controllers/homepages_controller.rb | 11 +++++++ app/controllers/sessions_controller.rb | 31 +++++++++++++++++++ app/helpers/homepages_helper.rb | 2 ++ app/helpers/sessionscreate_helper.rb | 2 ++ app/models/person.rb | 2 +- app/models/task.rb | 2 +- app/models/user.rb | 16 ++++++++++ app/views/homepages/index.html.erb | 9 ++++++ app/views/layouts/application.html.erb | 5 +-- app/views/sessions/create.html.erb | 0 app/views/sessions/destroy.html.erb | 2 ++ app/views/tasks/_form.html.erb | 1 + app/views/tasks/index.html.erb | 8 ++--- config/initializers/omniauth.rb | 3 ++ config/routes.rb | 14 ++++++--- db/migrate/20161017195142_create_users.rb | 13 ++++++++ .../20161017195704_add_provider_to_user.rb | 5 +++ db/schema.rb | 13 +++++++- test/controllers/homepages_controller_test.rb | 9 ++++++ .../sessionscreate_controller_test.rb | 9 ++++++ test/fixtures/users.yml | 15 +++++++++ test/models/user_test.rb | 7 +++++ 30 files changed, 222 insertions(+), 14 deletions(-) create mode 100644 app/assets/javascripts/homepages.coffee create mode 100644 app/assets/javascripts/sessionscreate.coffee create mode 100644 app/assets/stylesheets/homepages.scss create mode 100644 app/assets/stylesheets/sessionscreate.scss create mode 100644 app/controllers/homepages_controller.rb create mode 100644 app/controllers/sessions_controller.rb create mode 100644 app/helpers/homepages_helper.rb create mode 100644 app/helpers/sessionscreate_helper.rb create mode 100644 app/models/user.rb create mode 100644 app/views/homepages/index.html.erb create mode 100644 app/views/sessions/create.html.erb create mode 100644 app/views/sessions/destroy.html.erb create mode 100644 config/initializers/omniauth.rb create mode 100644 db/migrate/20161017195142_create_users.rb create mode 100644 db/migrate/20161017195704_add_provider_to_user.rb create mode 100644 test/controllers/homepages_controller_test.rb create mode 100644 test/controllers/sessionscreate_controller_test.rb create mode 100644 test/fixtures/users.yml create mode 100644 test/models/user_test.rb diff --git a/.gitignore b/.gitignore index 050c9d95c..73bd75532 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ # Ignore bundler config. /.bundle +# Ignore the .env file (it's full of secrets!) +/.env + # Ignore the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal @@ -15,3 +18,6 @@ /log/* !/log/.keep /tmp + +# ignore this annoying MACOS file +.DS_Store diff --git a/Gemfile b/Gemfile index bb5fca1bf..3efb14bcf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,9 @@ source 'https://rubygems.org' +# for oAuth github Authentication +gem "omniauth" +gem "omniauth-github" +# helps with console gem 'awesome_print' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' @@ -35,6 +39,7 @@ gem 'rails_12factor', group: :production group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' + gem 'dotenv-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index 8b3bbd2cc..76dd07d83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,10 +56,17 @@ GEM coffee-script-source (1.10.0) concurrent-ruby (1.0.2) debug_inspector (0.0.2) + dotenv (2.1.1) + dotenv-rails (2.1.1) + dotenv (= 2.1.1) + railties (>= 4.0, < 5.1) erubis (2.7.0) execjs (2.7.0) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) globalid (0.3.7) activesupport (>= 4.1.0) + hashie (3.4.6) i18n (0.7.0) jbuilder (2.6.0) activesupport (>= 3.0.0, < 5.1) @@ -69,6 +76,7 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.3) + jwt (1.5.6) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.4) @@ -79,9 +87,26 @@ GEM mini_portile2 (2.1.0) minitest (5.9.1) multi_json (1.12.1) + multi_xml (0.5.5) + multipart-post (2.0.0) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) + oauth2 (1.2.0) + faraday (>= 0.8, < 0.10) + jwt (~> 1.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) + omniauth (1.3.1) + hashie (>= 1.2, < 4) + rack (>= 1.0, < 3) + omniauth-github (1.1.2) + omniauth (~> 1.0) + omniauth-oauth2 (~> 1.1) + omniauth-oauth2 (1.4.0) + oauth2 (~> 1.0) + omniauth (~> 1.2) pg (0.19.0) pkg-config (1.1.7) rack (1.6.4) @@ -163,8 +188,11 @@ DEPENDENCIES binding_of_caller byebug coffee-rails (~> 4.1.0) + dotenv-rails jbuilder (~> 2.0) jquery-rails + omniauth + omniauth-github pg rails (= 4.2.7) rails_12factor diff --git a/app/assets/javascripts/homepages.coffee b/app/assets/javascripts/homepages.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/homepages.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/sessionscreate.coffee b/app/assets/javascripts/sessionscreate.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/sessionscreate.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/homepages.scss b/app/assets/stylesheets/homepages.scss new file mode 100644 index 000000000..e42583ae8 --- /dev/null +++ b/app/assets/stylesheets/homepages.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the homepages 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/sessionscreate.scss b/app/assets/stylesheets/sessionscreate.scss new file mode 100644 index 000000000..9bab607a9 --- /dev/null +++ b/app/assets/stylesheets/sessionscreate.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sessionscreate 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/style.css b/app/assets/stylesheets/style.css index e69783f57..7c9fe2ef8 100644 --- a/app/assets/stylesheets/style.css +++ b/app/assets/stylesheets/style.css @@ -56,7 +56,7 @@ font: normal normal 14px/1 "Josefin Sans"; ul li { list-style-type: none; - padding: 0 1% 0 1%; + padding: 0 1% 1% 1%; display: inline-block; } @@ -121,6 +121,10 @@ h3 { color: #4fb1cc;; } +.flash-notice { + color: red; +} + /************************************/ /* FOOTER */ /************************************/ diff --git a/app/controllers/homepages_controller.rb b/app/controllers/homepages_controller.rb new file mode 100644 index 000000000..2ef8d6bab --- /dev/null +++ b/app/controllers/homepages_controller.rb @@ -0,0 +1,11 @@ +class HomepagesController < ApplicationController + def index + get_current_user + + end + + private + def get_current_user + @user = User.find_by(id: session[:user_id]) + end +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 000000000..cbd88cc3a --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,31 @@ +class SessionsController < ApplicationController + def create + # gets auth hash from github (because we have logged into github) + auth_hash = request.env['omniauth.auth'] + # by default login failed - if tried to go to address without going to github first + flash[:notice] = "Login Failed!" + return redirect_to root_path unless auth_hash['uid'] + # try to find person in database - with same user_id and same provider. + @user = User.find_by(user_id: auth_hash[:uid], provider: 'github') + if @user.nil? + # User doesn't match anything in the DB. + # Attempt to create a new user. + #If couldn't find user - means they are new to website, and that means that they need to be built from github (method is in model) + @user = User.build_from_github(auth_hash) + # assuming unable to save, means could login but not save user + flash[:notice] = "Unable to Save the User" + return redirect_to root_path unless @user.save + end + + # Save the user ID in the session + # session is a type of cookie that lasts the current browser session + session[:user_id] = @user.id + # If they are this far, we know they successfully logged in + flash[:notice] = "Successfully Logged In!" + redirect_to root_path + end + + def destroy + session[:user_id] = nil + end +end diff --git a/app/helpers/homepages_helper.rb b/app/helpers/homepages_helper.rb new file mode 100644 index 000000000..4bd8098f3 --- /dev/null +++ b/app/helpers/homepages_helper.rb @@ -0,0 +1,2 @@ +module HomepagesHelper +end diff --git a/app/helpers/sessionscreate_helper.rb b/app/helpers/sessionscreate_helper.rb new file mode 100644 index 000000000..f3b92e103 --- /dev/null +++ b/app/helpers/sessionscreate_helper.rb @@ -0,0 +1,2 @@ +module SessionscreateHelper +end diff --git a/app/models/person.rb b/app/models/person.rb index 4ed22ba8b..c2e188db2 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,3 +1,3 @@ class Person < ActiveRecord::Base - has_many :tasks + end diff --git a/app/models/task.rb b/app/models/task.rb index c3c534741..5c58542c4 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,3 +1,3 @@ class Task < ActiveRecord::Base - belongs_to :person + belongs_to :user end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 000000000..aba5a407a --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,16 @@ +class User < ActiveRecord::Base + has_many :tasks + validates :email, :name, :user_id, :provider, presence: true + + def self.build_from_github(auth_hash) + user = User.new + user.user_id = auth_hash[:uid] + user.provider = 'github' + user.name = auth_hash['info']['name'] + user.email = auth_hash['info']['email'] + user.avatar = auth_hash["extra"]["raw_info"]['avatar_url'] + user.follower_count = auth_hash["extra"]["raw_info"]["followers"].to_i + + return user + end +end diff --git a/app/views/homepages/index.html.erb b/app/views/homepages/index.html.erb new file mode 100644 index 000000000..020cf31a9 --- /dev/null +++ b/app/views/homepages/index.html.erb @@ -0,0 +1,9 @@ +<% if @user %> +

    Welcome <%= @user.name %>

    +<%= image_tag(@user.avatar, alt:"image of user") %> +<% else %> +

    Please login.

    +<% end %> +<% if flash[:notice] %> +

    <%= flash[:notice] %>

    +<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index bb069c6e9..950aa1f53 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,8 +13,9 @@ diff --git a/app/views/sessions/create.html.erb b/app/views/sessions/create.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/sessions/destroy.html.erb b/app/views/sessions/destroy.html.erb new file mode 100644 index 000000000..333a7de14 --- /dev/null +++ b/app/views/sessions/destroy.html.erb @@ -0,0 +1,2 @@ +

    Sessionscreate#destroy

    +

    Find me in app/views/sessionscreate/destroy.html.erb

    diff --git a/app/views/tasks/_form.html.erb b/app/views/tasks/_form.html.erb index ee86c41da..3a1bbda73 100644 --- a/app/views/tasks/_form.html.erb +++ b/app/views/tasks/_form.html.erb @@ -6,6 +6,7 @@ <%= f.label :description %> <%= f.text_area :description %> + <%= f.submit :class=>"button" %> <%= tag(:input, :type => "hidden", diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 0735eae00..47a89bf28 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,4 +1,4 @@ -

    Hello, <%= @person.name %>!

    +

    Hello, <%= @user.name %>!

    Daily Task List

    <% @tasks.each do |task| %> @@ -16,9 +16,9 @@
      -
    • <%= button_to 'Complete', complete_path(task, params[:person_id]), :class => 'button', method: :patch %>
    • -
    • <%= button_to 'Edit', edit_path(task, params[:person_id]), :class => 'button', method: :get %>
    • -
    • <%= button_to 'Delete', delete_path(task, params[:person_id]), :class => 'button', +
    • <%= button_to 'Complete', complete_path(task, params[:user_id]), :class => 'button', method: :patch %>
    • +
    • <%= button_to 'Edit', edit_path(task, params[:user_id]), :class => 'button', method: :get %>
    • +
    • <%= button_to 'Delete', delete_path(task, params[:user_id]), :class => 'button', method: :delete, data: { confirm: 'Are you sure?' } %>
    diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb new file mode 100644 index 000000000..fd4416122 --- /dev/null +++ b/config/initializers/omniauth.rb @@ -0,0 +1,3 @@ +Rails.application.config.middleware.use OmniAuth::Builder do + provider :github, ENV["GITHUB_CLIENT_ID"], ENV["GITHUB_CLIENT_SECRET"], scope: "user:email" +end diff --git a/config/routes.rb b/config/routes.rb index 55f0207f5..70c60df03 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,15 +1,17 @@ Rails.application.routes.draw do - root to: "people#index" + root to: "homepages#index" - get 'people/index', as: 'people-index' + delete 'sessions/destroy', 'sessions#destroy', as: 'destroy-sessions' + + # get 'people/index', as: 'people-index' # # get 'people/show/:id', 'people#show', as: 'people-show' # # get 'people/edit' # - post 'people/create' => 'people#create', as: "createperson" + # post 'people/create' => 'people#create', as: "createperson" - get 'people/new' => "people#new", as: "newperson" + # get 'people/new' => "people#new", as: "newperson" # # get 'people/update' # @@ -32,6 +34,10 @@ patch 'tasks/:id/completion_status/:person_id' => 'tasks#completion_status', as: "complete" + get "/auth/:provider/callback" => "sessions#create" + + + get 'sessions/create' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/db/migrate/20161017195142_create_users.rb b/db/migrate/20161017195142_create_users.rb new file mode 100644 index 000000000..90af6efa6 --- /dev/null +++ b/db/migrate/20161017195142_create_users.rb @@ -0,0 +1,13 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :user_id + t.string :name + t.string :email + t.string :avatar + t.integer :follower_count + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161017195704_add_provider_to_user.rb b/db/migrate/20161017195704_add_provider_to_user.rb new file mode 100644 index 000000000..901d24422 --- /dev/null +++ b/db/migrate/20161017195704_add_provider_to_user.rb @@ -0,0 +1,5 @@ +class AddProviderToUser < ActiveRecord::Migration + def change + add_column :users, :provider, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 301fefd80..bb786e026 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160930171540) do +ActiveRecord::Schema.define(version: 20161017195704) do create_table "people", force: :cascade do |t| t.string "name" @@ -31,4 +31,15 @@ add_index "tasks", ["person_id"], name: "index_tasks_on_person_id" + create_table "users", force: :cascade do |t| + t.string "user_id" + t.string "name" + t.string "email" + t.string "avatar" + t.integer "follower_count" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "provider" + end + end diff --git a/test/controllers/homepages_controller_test.rb b/test/controllers/homepages_controller_test.rb new file mode 100644 index 000000000..46828ab12 --- /dev/null +++ b/test/controllers/homepages_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class HomepagesControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/controllers/sessionscreate_controller_test.rb b/test/controllers/sessionscreate_controller_test.rb new file mode 100644 index 000000000..4b1f4373e --- /dev/null +++ b/test/controllers/sessionscreate_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class SessionscreateControllerTest < ActionController::TestCase + test "should get destroy" do + get :destroy + assert_response :success + end + +end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 000000000..df6d87751 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + user_id: MyString + name: MyString + email: MyString + avatar: MyString + follower_count: 1 + +two: + user_id: MyString + name: MyString + email: MyString + avatar: MyString + follower_count: 1 diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 000000000..82f61e010 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 5863b110adea5df26ee3793ba7376bda63b640d6 Mon Sep 17 00:00:00 2001 From: Rachel Date: Tue, 18 Oct 2016 10:56:45 -0700 Subject: [PATCH 36/47] added basic testing through lecture with Chris. --- Gemfile | 1 + Gemfile.lock | 8 +++ app/views/layouts/application.html.erb | 5 ++ config/routes.rb | 1 - test/controllers/sessions_controller_test.rb | 31 +++++++++++ .../sessionscreate_controller_test.rb | 9 ---- test/controllers/tasks_controller_test.rb | 52 +++++++++++++------ test/fixtures/tasks.yml | 17 +++--- test/fixtures/users.yml | 25 ++++----- test/test_helper.rb | 6 +++ 10 files changed, 108 insertions(+), 47 deletions(-) create mode 100644 test/controllers/sessions_controller_test.rb delete mode 100644 test/controllers/sessionscreate_controller_test.rb diff --git a/Gemfile b/Gemfile index 3efb14bcf..ba63dc8ad 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,7 @@ group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' gem 'dotenv-rails' + gem 'minitest-reporters' end diff --git a/Gemfile.lock b/Gemfile.lock index 76dd07d83..4b8b2a396 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + ansi (1.5.0) arel (6.0.3) awesome_print (1.7.0) better_errors (2.1.1) @@ -86,6 +87,11 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.9.1) + minitest-reporters (1.1.11) + ansi + builder + minitest (>= 5.0) + ruby-progressbar multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) @@ -144,6 +150,7 @@ GEM rake (11.3.0) rdoc (4.2.2) json (~> 1.4) + ruby-progressbar (1.8.1) sass (3.4.22) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -191,6 +198,7 @@ DEPENDENCIES dotenv-rails jbuilder (~> 2.0) jquery-rails + minitest-reporters omniauth omniauth-github pg diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 950aa1f53..86c3ca1fc 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,6 +13,11 @@