From 752e74c7007596a47f603b6f2f394b8287befded Mon Sep 17 00:00:00 2001 From: sophia Date: Tue, 19 Apr 2016 15:16:36 -0700 Subject: [PATCH 01/36] Setup project and beging Wave 1; --- .gitignore | 46 ++--- Gemfile | 47 +++++ Gemfile.lock | 160 ++++++++++++++++++ README.rdoc | 28 +++ Rakefile | 6 + app/assets/images/.keep | 0 app/assets/javascripts/application.js | 16 ++ app/assets/javascripts/tasks.coffee | 3 + app/assets/stylesheets/application.css | 15 ++ app/assets/stylesheets/tasks.scss | 3 + app/controllers/application_controller.rb | 5 + app/controllers/concerns/.keep | 0 app/controllers/tasks_controller.rb | 11 ++ app/helpers/application_helper.rb | 2 + app/helpers/tasks_helper.rb | 2 + app/mailers/.keep | 0 app/models/.keep | 0 app/models/concerns/.keep | 0 app/models/task.rb | 9 + app/views/layouts/application.html.erb | 20 +++ app/views/tasks/index.html.erb | 72 ++++++++ app/views/tasks/task.html.erb | 56 ++++++ 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 | 58 +++++++ config/secrets.yml | 22 +++ db/migrate/20160419203503_create_tasks.rb | 11 ++ db/schema.rb | 24 +++ db/seeds.rb | 42 +++++ 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/controllers/tasks_controller_test.rb | 7 + test/fixtures/.keep | 0 test/fixtures/tasks.yml | 13 ++ test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/models/task_test.rb | 7 + test/test_helper.rb | 10 ++ vendor/assets/javascripts/.keep | 0 vendor/assets/stylesheets/.keep | 0 69 files changed, 1243 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/javascripts/tasks.coffee create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/assets/stylesheets/tasks.scss create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/controllers/tasks_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/tasks_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/models/task.rb create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/tasks/index.html.erb create mode 100644 app/views/tasks/task.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/migrate/20160419203503_create_tasks.rb create mode 100644 db/schema.rb 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/controllers/tasks_controller_test.rb create mode 100644 test/fixtures/.keep create mode 100644 test/fixtures/tasks.yml 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/models/task_test.rb 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..d0ca1fdd6 --- /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.6' +# 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..c45949a77 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,160 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.6) + actionview (= 4.2.6) + activesupport (= 4.2.6) + 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.6) + activesupport (= 4.2.6) + 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.6) + activesupport (= 4.2.6) + globalid (>= 0.3.0) + activemodel (4.2.6) + activesupport (= 4.2.6) + builder (~> 3.1) + activerecord (4.2.6) + activemodel (= 4.2.6) + activesupport (= 4.2.6) + arel (~> 6.0) + activesupport (4.2.6) + 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 (8.2.4) + 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.1) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.6.0) + globalid (0.3.6) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.4.1) + activesupport (>= 3.0.0, < 5.1) + multi_json (~> 1.2) + jquery-rails (4.1.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.0) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0221) + mini_portile2 (2.0.0) + minitest (5.8.4) + multi_json (1.11.2) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.6) + actionmailer (= 4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + activemodel (= 4.2.6) + activerecord (= 4.2.6) + activesupport (= 4.2.6) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.6) + 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.6) + actionpack (= 4.2.6) + activesupport (= 4.2.6) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (11.1.2) + rdoc (4.2.2) + json (~> 1.4) + sass (3.4.22) + sass-rails (5.0.4) + railties (>= 4.0.0, < 5.0) + 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.1) + sprockets (3.6.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.4) + 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.2) + turbolinks (2.5.3) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (3.0.0) + 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.6) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.11.2 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/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/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/assets/stylesheets/tasks.scss b/app/assets/stylesheets/tasks.scss new file mode 100644 index 000000000..b57862ec7 --- /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/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/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb new file mode 100644 index 000000000..1391c5f7e --- /dev/null +++ b/app/controllers/tasks_controller.rb @@ -0,0 +1,11 @@ +class TasksController < ApplicationController + def index + @tasks = Task::all_tasks + end + + def show + @tasks = Task::find_task(params[:id]) + render :task + end + +end 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/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/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/models/task.rb b/app/models/task.rb new file mode 100644 index 000000000..449fcba19 --- /dev/null +++ b/app/models/task.rb @@ -0,0 +1,9 @@ +class Task < ActiveRecord::Base + def self.all_tasks + Task.all + end + + def self.find_task(id) + [Task.find(id)] + end +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 000000000..3cd801c0a --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,20 @@ + + + + TaskListRails + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + + + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + +
+

SUPER AWESOME TO-DO LIST

+
+ + +<%= yield %> + + + diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb new file mode 100644 index 000000000..4bd12f1f4 --- /dev/null +++ b/app/views/tasks/index.html.erb @@ -0,0 +1,72 @@ + +
+

New task

+
+
+
+

Tasks to do:

+
+
+ +<% @tasks.each do |task|%> + <% if task.completed_at == nil %> +
+
+ + <%= link_to "/tasks/#{task.id}" do %> +

<%=task.title%>

+ <% end %> + +

+ <%=task.description %> +

+
+ +
+
+ + <%#put checkbox here!%> + <%#
%> +
+ + <%#ADD NUMBER SPECIFICTY in iteration%> + <%#ADD NUMBER SPECIFICTY in iteration%> +
+
+ <%end%> +<%end%> +
+
+ +
+

Completed tasks:

+
+ +<% @tasks.each do |task|%> + <% if task.completed_at != nil %> +
+
+ + <%= link_to "/tasks/#{task.id}" do %> +

<%=task.title%>

+ <% end %> + +

+ <%= task.description %> +

+
+ +
+
+ + <%#put checkbox here!%> + <%#
%> +
+ + <%#ADD NUMBER SPECIFICTY in iteration%> + <%#ADD NUMBER SPECIFICTY in iteration%> +
+
+ <%end%> +<%end%> +
diff --git a/app/views/tasks/task.html.erb b/app/views/tasks/task.html.erb new file mode 100644 index 000000000..b5b67f49b --- /dev/null +++ b/app/views/tasks/task.html.erb @@ -0,0 +1,56 @@ +<% @tasks.each do |task|%> + <% if task.completed_at == nil %> +
+
+ + <%= link_to "/tasks/#{task.id}" do %> +

<%=task.title%>

+ <% end %> + +

+ <%=task.description %> +

+
+ +
+
+ + <%#put checkbox here!%> + <%#
%> +
+ + <%#ADD NUMBER SPECIFICTY in iteration%> + <%#ADD NUMBER SPECIFICTY in iteration%> +
+
+ <%end%> +<%end%> + +<% @tasks.each do |task|%> + <% if task.completed_at != nil %> +
+
+ + <%= link_to "/tasks/#{task.id}" do %> +

<%=task.title%>

+ <% end %> + +

+ <%= task.description %> +

+
+ +
+
+ + <%#put checkbox here!%> + <%#
%> +
+ + <%#ADD NUMBER SPECIFICTY in iteration%> + <%#ADD NUMBER SPECIFICTY in iteration%> +
+
+ <%end%> +<%end%> + 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..07a36fe6b --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,58 @@ +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' + root 'tasks#index' + get '/tasks' => 'tasks#index' + get '/tasks/:id' => 'tasks#show' + # 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..ff11af076 --- /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: 123dde9c5d9bde33b17ac43dcef4bf1b4792328a15ffc9ed709ba967b8eda04db1fc72c879ef04e7232f54ff561a9ca7b5038ecbb67ccae7b11c248cfdacb26a + +test: + secret_key_base: 02d0bcd0258a58644a0c23d38b6d0812f99aa635ca7bd7ead2d3841e1f468d22f6890d4eb2879dd89bce8acebe752be02729695650f8ac7fa8ba8e176a381919 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/db/migrate/20160419203503_create_tasks.rb b/db/migrate/20160419203503_create_tasks.rb new file mode 100644 index 000000000..27862c249 --- /dev/null +++ b/db/migrate/20160419203503_create_tasks.rb @@ -0,0 +1,11 @@ +class CreateTasks < ActiveRecord::Migration + def change + create_table :tasks do |t| + t.string :title, null: false + t.string :description + t.string :completed_at + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 000000000..29af6b986 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,24 @@ +# 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: 20160419203503) do + + create_table "tasks", force: :cascade do |t| + t.string "title", null: false + t.string "description" + t.string "completed_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 000000000..13b51ed1b --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,42 @@ +# 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) + +# My Original Seed +# +# Task.all.each do |task| +# task.destroy +# end +# +# 5.times do +# i = 1 +# Task.create(title: "New Task #{i}", description: "This is a generic description about the current task.") +# i += 1 +# end + +def random_time + Time.at(rand * Time.now.to_i) +end + +tasks = [ + { title: "The First Task", description: "", completed_at: random_time }, + { title: "Go to Brunch", description: "" }, + { title: "Go to Lunch", description: "", completed_at: random_time }, + { title: "Go to Second Lunch", description: "" }, + { title: "Play Video Games", description: "", completed_at: random_time }, + { title: "High Five Somebody You Don't Know", description: "", completed_at: random_time }, + { title: "Plant Flowers", description: "", completed_at: random_time }, + { title: "Call Mom", description: "" }, + { title: "She worries, you know.", description: "" }, + { title: "Nap.", description: "", completed_at: random_time } +] + +tasks.each do |task| + Task.create task +end + +puts "There are now #{Task.count} tasks in the DB" 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/controllers/tasks_controller_test.rb b/test/controllers/tasks_controller_test.rb new file mode 100644 index 000000000..ab48b116d --- /dev/null +++ b/test/controllers/tasks_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TasksControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/tasks.yml b/test/fixtures/tasks.yml new file mode 100644 index 000000000..745bbafe0 --- /dev/null +++ b/test/fixtures/tasks.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + a: MyString + name: MyString + description: MyString + complete: MyString + +two: + a: MyString + name: MyString + description: MyString + complete: MyString 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/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 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 c5051c11ba0e39a55162f314d2aef7e0e82ecce4 Mon Sep 17 00:00:00 2001 From: sophia Date: Tue, 19 Apr 2016 17:40:58 -0700 Subject: [PATCH 02/36] Import styles from sinatra task list; --- app/assets/stylesheets/application.css | 190 +++++++++++++++++++++++++ 1 file changed, 190 insertions(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f9cd5b348..836244527 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,193 @@ *= require_tree . *= require_self */ + * { + box-sizing: border-box; + } + + html { + font-size: 16px; + font-family: 'Josefin Sans', Helvetica, Arial, sans-serif; + } + body { + background-color: #19334d; + color: #ecf2f9; + padding: 4rem; + } + + h1 { + font-size: 3.5rem; + } + + h2 { + margin: .25rem 0; + } + + a { + color: white; + text-decoration: none; + } + + header.title { + width: 100%; + text-align: center; + font-size: 1.25rem; + } + + /*INDEX*/ + .task-info { + display: inline-block; + width: 75%; + min-height: 4rem; + margin-left: .25rem; + padding: .5rem .3rem; + } + + .task-info p { + margin: 0; + padding-left: .6rem; + color: #CDD2D7; + } + + .task-box { + /*background-color: rgb(62, 98, 134);*/ + background-color: #54789B; + width: 45%; + border: .1rem solid #18314e; + border-radius: .3rem; + color: #ecf2f9; + margin: 2% 2.5%; + float: left; + } + + + .completed { + font-style: italic; + background-color: rgb(50, 77, 100); + background-color: rgba(50, 77, 100, .7); + float: left; + } + + .uncomplete:nth-child(2n+1) { + float: right; + } + + .checkbox { + height: 2.5rem; + width: 2.5rem; + margin: 2%; + background-color: #ABB8C4; + background-image: url('/images/check.png'); + opacity: 0.3; + background-size: contain; + border: .25rem solid #ABB8C4; + border-radius: .25rem; + vertical-align: middle; + float: left; + overflow: auto; + } + + .checkbox:hover { + background-color: #E9E9E9; + border: .25rem solid #E9E9E9; + background-image: url('/images/check.png'); + opacity: 0.6;} + + .completed .checkbox { + background-image: url('/images/creepysmile.png'); + z-index: 1; + opacity: .8; + background-repeat: no-repeat; + background-size: cover; + } + + .task-edits { + float: right; + /*display: block;*/ + width: 5%; + margin: 1% 0.5% 1% 1%; + font-size: 1rem; + } + + .task-edits i { + font-size: 1.5rem; + color: #9fbfdf; + padding: .2rem 0; + } + + .task-edits i:hover { + color: white; + } + + .new-task { + width: 25%; + height: 3.5rem; + margin: 3% auto; + padding: 1rem; + background: #E4C158; + border-radius: .25rem; + font-size: 1.5rem; + text-align: center; + cursor: pointer; + } + + .new-task:hover { + background: #E3B429; + } + + .new-task p { + margin: 0; + padding: 0; + } + + .float-left { + float: left; + } + + .float-right { + float: right; + } + + .column-title{ + clear: both; + width: 100%; + text-align: center; + } + + .completed:nth-child(2n+1) { + float: right; + } + + /** FORM **/ + + .create-task { + width: 50%; + text-align: center; + margin: auto; + } + + .create-task form * { + display: block; + margin: auto; + padding: .2rem; + } + + .create-task form label { + margin: 4%; + } + + .create-task form textarea, + .create-task form input[type=text] { + margin-top: 2%; + } + + + + + + + + + + + /** END **/ From bd9c2eee45fb29261f89da06ca50051593d519de Mon Sep 17 00:00:00 2001 From: sophia Date: Tue, 19 Apr 2016 17:43:34 -0700 Subject: [PATCH 03/36] Refactor how tasks are displayed, uses a partial for all tasks and renders based on completion status; --- app/controllers/tasks_controller.rb | 6 ++- app/models/task.rb | 7 +++ app/views/tasks/_task.html.erb | 25 +++++++++++ app/views/tasks/index.html.erb | 66 ++++------------------------- app/views/tasks/task.html.erb | 56 ------------------------ 5 files changed, 45 insertions(+), 115 deletions(-) create mode 100644 app/views/tasks/_task.html.erb delete mode 100644 app/views/tasks/task.html.erb diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 1391c5f7e..d72348757 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -1,11 +1,15 @@ class TasksController < ApplicationController + def index @tasks = Task::all_tasks + @completed_tasks = @tasks.where(completed_at: nil) + @uncompleted_tasks = @tasks.where.not(completed_at: nil) + end def show @tasks = Task::find_task(params[:id]) - render :task + render :_task end end diff --git a/app/models/task.rb b/app/models/task.rb index 449fcba19..3e6a3a780 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,4 +1,7 @@ class Task < ActiveRecord::Base + + STATUS = {is_complete: ["uncomplete", "completed"], not_complete: ["completed", "uncompleted"]} + def self.all_tasks Task.all end @@ -6,4 +9,8 @@ def self.all_tasks def self.find_task(id) [Task.find(id)] end + + def status + self.completed_at != nil ? STATUS[:is_complete] : STATUS[:not_complete] + end end diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb new file mode 100644 index 000000000..18147bd7f --- /dev/null +++ b/app/views/tasks/_task.html.erb @@ -0,0 +1,25 @@ +<% task ||= @tasks %> +<% task.each do |task|%> + <% @status = task.status %> + +
+
+ <%= link_to "/tasks/#{task.id}" do %> +

<%=task.title%>

+ <% end %> +

+ <%= task.description %> +

+
+ + +
+
+ +
+ <%#ADD NUMBER SPECIFICTY in iteration%> + <%#ADD NUMBER SPECIFICTY in iteration%> +
+
+ +<%end%> diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 4bd12f1f4..0787b4c5f 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -3,70 +3,20 @@

New task

-
-

Tasks to do:

-
+
+

Tasks to do:

+
-<% @tasks.each do |task|%> - <% if task.completed_at == nil %> -
-
- - <%= link_to "/tasks/#{task.id}" do %> -

<%=task.title%>

- <% end %> - -

- <%=task.description %> -

-
- -
-
- - <%#put checkbox here!%> - <%#
%> -
+ <%= render :partial => 'task', :object => @uncompleted_tasks %> - <%#ADD NUMBER SPECIFICTY in iteration%> - <%#ADD NUMBER SPECIFICTY in iteration%> -
-
- <%end%> -<%end%>
-
-

Completed tasks:

-
- -<% @tasks.each do |task|%> - <% if task.completed_at != nil %> -
-
- - <%= link_to "/tasks/#{task.id}" do %> -

<%=task.title%>

- <% end %> - -

- <%= task.description %> -

-
- -
-
+
+

Completed tasks:

+
- <%#put checkbox here!%> - <%#
%> -
+ <%= render :partial => 'task', :object => @completed_tasks %> - <%#ADD NUMBER SPECIFICTY in iteration%> - <%#ADD NUMBER SPECIFICTY in iteration%> -
-
- <%end%> -<%end%>
diff --git a/app/views/tasks/task.html.erb b/app/views/tasks/task.html.erb deleted file mode 100644 index b5b67f49b..000000000 --- a/app/views/tasks/task.html.erb +++ /dev/null @@ -1,56 +0,0 @@ -<% @tasks.each do |task|%> - <% if task.completed_at == nil %> -
-
- - <%= link_to "/tasks/#{task.id}" do %> -

<%=task.title%>

- <% end %> - -

- <%=task.description %> -

-
- -
-
- - <%#put checkbox here!%> - <%#
%> -
- - <%#ADD NUMBER SPECIFICTY in iteration%> - <%#ADD NUMBER SPECIFICTY in iteration%> -
-
- <%end%> -<%end%> - -<% @tasks.each do |task|%> - <% if task.completed_at != nil %> -
-
- - <%= link_to "/tasks/#{task.id}" do %> -

<%=task.title%>

- <% end %> - -

- <%= task.description %> -

-
- -
-
- - <%#put checkbox here!%> - <%#
%> -
- - <%#ADD NUMBER SPECIFICTY in iteration%> - <%#ADD NUMBER SPECIFICTY in iteration%> -
-
- <%end%> -<%end%> - From db7e59b4ea5c734bd3ed6cdeee46e8051d515d43 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 20 Apr 2016 09:37:42 -0700 Subject: [PATCH 04/36] Add checkbox images; --- app/assets/images/check.png | Bin 0 -> 19184 bytes app/assets/images/creepysmile.png | Bin 0 -> 29235 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/assets/images/check.png create mode 100644 app/assets/images/creepysmile.png diff --git a/app/assets/images/check.png b/app/assets/images/check.png new file mode 100644 index 0000000000000000000000000000000000000000..339779ecdb2602f2e1fecf19bc3a2032c43f7dcb GIT binary patch literal 19184 zcmeI4dpy(a|HnU@GZP6p6l*9FvoVJ`7G)}Dg$`^O?RMC*VI&(BL#0F!IVI($kh{`N z>|08Sx*aMVtwhmDqU5msK2vw??(Y8X`~5w>e{PQldw;I$^?qO1^?bjt%f;g{=^k#* z^0FGT0079l;GDbw00Np2Kw1)f+Y)^$6nvAR;QXloAh&@31p$s0ssVuIa*~f9&Chi` zHkce~Ob8(d5sm4Q6i^KSHuiK1Avl~!g9j1ANKv+kca1FwI4Q&y;frxKaiusCw~=rO z(M0bAH=p2y@L;PDguR`t4IK*xh$PYoaC&4!6ctOiMa;#;f;PVyiGa^ZXyLYqmHYwW zey$#HM{+a~jxjbj3N}HR!7Z$eQ5bUzD~lCyH291(u|%Rxj7+Ss7*nhX8vgZ#u#*KX zo9K{Gte4Z8ufu^)wuo&s8U>3)#>K@M$C(U;_EXB;OYH8`3?p^?Z@aDH4u5IKfsi$L%P`u6&|u1Lzafug8i*?|<1bOHs5GB!c} z%qb-Jn-3)>I$~~WA;Cyu1Tm5rMWcd#sGs^#wvlOM>NfH}4Ee459|s0=;_CWs?4Qmz zGV-TGQ)#PXK?Gls{?wD|6Hg%`y@*tDOmr}Dbu73Pou93qMhg9&oWDfk_x$7BiFDFG zxbb_wxXqQqmkil}YsET76A3hOv=5maVfUrVJpM!ocXXVqD!9HYA(#}!=W1Ys{L$%q z#=plSIuU3@JFp_njZDmpP-Z?T3>IyLMWKyMEU+df0ztkge~95q4k3lc|0ISP25W{A zj3J=>F$TDULI^a%e-uSfD-b6n7#m8CjwI0RNRfmvB9amnW`q3RD4_gSS6D}K1UVX< z7SYbs2KlpQ0k64Q!@5LKX@sa?qKlIq*kDW|g<#FCLI^=bw51UtglJ}D7Howvva-Th z8HHF9(VnFJD84{Fk8x-2WEZJ(>ibb%Y234S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R+&{uL|B80M9IfQ_r{- z>~Y)6Vix-|`bVL{rLW4vorBJPz)+TuD@vVK@-_EBk#|G;&AjP2)Gu6ZbEV87ezx+4 z>giAt=jPmUN2qUYzk1v3@p-s$hCoTR$ZjtTSvZDZyV-_R7Y4J9yXFwC+D4t>jzdX%8dM^ly{4ZtIss+% zRENAXg$AQpl7VHAY7PClwAnSW9A^k+%U|#zu;GSNvQB6D?PP4Vc{LWuq_}O9ojPba zx5h;wc5V}69)vxeM%z3~J5OytmX@NzF{?DNjcr9rCj9}LQ@LaDCEdg@na!|0q>Qlx z+^E$(3vLlw`nkq)nH?pZ{3&kb=zx~@_RAY=bR@&1tdiE*oct0vq4?bVD_F+pF!Tg? zsl0>r00p@{Q`!1ant6KrEWKLATpUVl$9-TNU?I`|fT?J4O0ox+m~Zx*$?c zVceR3IS5Lm00YR}y}RSaK+?qk z=kRS~VWA~Jv|OLfFe9Babd$Z*H#*jfssm_=mSMy4+$$MexUQ~PT@&0gCps-A66+*N zvnP65=^GcG{H9;vHI`rlV_%k{?9Tgz#0HoB`t{<Au~=t|Y@UL{j{9bw6%~;Xas~idSr?ok5!7UV{1tEUw1e#4Zoif# z+qZXN6y+&1{@sL{vhEpVPt%c;QIXucG=gPn}Hp(UUJDyERtjqQosJpzI^k#!^^W$kxV!^go z8B|Z?*SC1+UdzFFLs}Ikz38>zMIUv_m?QdV(Zpye_g7}GlG-xoy@)5iN)L;rwnrJ zA2SN7wq6yV7_7yx7^aqEBj;yZff3j;X*xRyNOtYrh)6b+D-RFWtaGYI%!J@iu* literal 0 HcmV?d00001 From 52c9aee3b9be19aac2c91df6c7145ad0e51a2966 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 20 Apr 2016 09:39:30 -0700 Subject: [PATCH 05/36] Styling fix; --- app/assets/stylesheets/application.css | 7 ++++--- app/views/tasks/index.html.erb | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 836244527..7f32e2f1b 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -89,7 +89,7 @@ width: 2.5rem; margin: 2%; background-color: #ABB8C4; - background-image: url('/images/check.png'); + background-image: url('/app/assets/images/check.png'); opacity: 0.3; background-size: contain; border: .25rem solid #ABB8C4; @@ -102,11 +102,11 @@ .checkbox:hover { background-color: #E9E9E9; border: .25rem solid #E9E9E9; - background-image: url('/images/check.png'); + background-image: url('/apps/assets/images/check.png'); opacity: 0.6;} .completed .checkbox { - background-image: url('/images/creepysmile.png'); + background-image: url('/apps/assets/images/creepysmile.png'); z-index: 1; opacity: .8; background-repeat: no-repeat; @@ -161,6 +161,7 @@ } .column-title{ + display: inline-block; clear: both; width: 100%; text-align: center; diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 0787b4c5f..7c8b9c769 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -4,18 +4,18 @@
-
+

Tasks to do:

-
+ <%= render :partial => 'task', :object => @uncompleted_tasks %>
-
+

Completed tasks:

-
+ <%= render :partial => 'task', :object => @completed_tasks %> From a31bfd12c6b3020755deefb74d83dc11568209aa Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 20 Apr 2016 09:40:03 -0700 Subject: [PATCH 06/36] Put complete and uncomplete responsibility methods in model; --- app/controllers/tasks_controller.rb | 4 ++-- app/models/task.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index d72348757..477b0b18a 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -2,8 +2,8 @@ class TasksController < ApplicationController def index @tasks = Task::all_tasks - @completed_tasks = @tasks.where(completed_at: nil) - @uncompleted_tasks = @tasks.where.not(completed_at: nil) + @completed_tasks = Task::completed_tasks + @uncompleted_tasks = Task::uncompleted_tasks end diff --git a/app/models/task.rb b/app/models/task.rb index 3e6a3a780..0ad8c2e88 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -13,4 +13,13 @@ def self.find_task(id) def status self.completed_at != nil ? STATUS[:is_complete] : STATUS[:not_complete] end + + def self.uncompleted_tasks + Task.where.not(completed_at: nil) + end + + def self.completed_tasks + Task.where(completed_at: nil) + end + end From 7cb3d6982a878e624abf8dea3b553ddf1985d891 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 20 Apr 2016 14:44:13 -0700 Subject: [PATCH 07/36] Opps fix completed and uncompleted methods, they were backwards; --- app/models/task.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 0ad8c2e88..112fd7fd1 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -15,11 +15,11 @@ def status end def self.uncompleted_tasks - Task.where.not(completed_at: nil) + Task.where(completed_at: nil) end def self.completed_tasks - Task.where(completed_at: nil) + Task.where.not(completed_at: nil) end end From e3b2b99080c1e5498754ac8895246e459ec08ee3 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 20 Apr 2016 14:44:33 -0700 Subject: [PATCH 08/36] Show completed_at time for tasks; --- app/views/tasks/_task.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 18147bd7f..88526a672 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -10,6 +10,7 @@

<%= task.description %>

+ <%= task.completed_at %> From 156bbc8ad912ddbc87116d85838bc3a0ea8efea7 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 14:39:05 -0700 Subject: [PATCH 09/36] Install better errors gem; --- Gemfile | 3 ++- Gemfile.lock | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d0ca1fdd6..9ef7bdf51 100644 --- a/Gemfile +++ b/Gemfile @@ -40,8 +40,9 @@ 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' end - diff --git a/Gemfile.lock b/Gemfile.lock index c45949a77..abfecdc5c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,10 +37,15 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + 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 (8.2.4) + coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) @@ -143,6 +148,8 @@ PLATFORMS ruby DEPENDENCIES + better_errors + binding_of_caller byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) From 67f8701b80a2be24bb8de4f81592a442747d2861 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 14:43:06 -0700 Subject: [PATCH 10/36] Add form to create new tasks; Add delete tasks feature; --- app/controllers/tasks_controller.rb | 29 ++++++++++++++++++++++++++++- app/models/task.rb | 4 ---- app/views/tasks/_task.html.erb | 9 +++++++-- app/views/tasks/index.html.erb | 4 ++-- config/routes.rb | 7 +++++-- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 477b0b18a..0543e2cf6 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -8,8 +8,35 @@ def index end def show - @tasks = Task::find_task(params[:id]) + @tasks = [Task.find(params[:id])] render :_task end + def new + @task = Task.new + end + + def create + @task = Task.new(create_task_params[:task]) + if @task.save + # redirect_to task_path(@task.id) + redirect_to root_path + else + render '#' + end + end + + def destroy + @task = Task.find(params[:id]) + @task.destroy + redirect_to root_path + end + + private + def create_task_params + # I don't get the syntax for the next line, it looks like an array as the value + # at the key :title, but in the params hash it's not an array + params.permit(task: [:title, :description]) + end + end diff --git a/app/models/task.rb b/app/models/task.rb index 112fd7fd1..88f61f0b0 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -6,10 +6,6 @@ def self.all_tasks Task.all end - def self.find_task(id) - [Task.find(id)] - end - def status self.completed_at != nil ? STATUS[:is_complete] : STATUS[:not_complete] end diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 88526a672..1c8ba15a2 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -1,3 +1,6 @@ + +<%= params %> + <% task ||= @tasks %> <% task.each do |task|%> <% @status = task.status %> @@ -18,8 +21,10 @@
- <%#ADD NUMBER SPECIFICTY in iteration%> - <%#ADD NUMBER SPECIFICTY in iteration%> + <%#ADD NUMBER SPECIFICTY in iteration%> + <%= button_to "/tasks/#{task.id}", class: "task-edits-buttons", method: :delete do %> + <%#ADD NUMBER SPECIFICTY in iteration%> + <% end %>
diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 7c8b9c769..49df51b1a 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,8 +1,8 @@ - +<%= link_to tasks_new_path do %>

New task

-
+<% end %>

Tasks to do:

diff --git a/config/routes.rb b/config/routes.rb index 07a36fe6b..73e00c54f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,8 +5,11 @@ # You can have the root of your site routed with "root" # root 'welcome#index' root 'tasks#index' - get '/tasks' => 'tasks#index' - get '/tasks/:id' => 'tasks#show' + get '/tasks' => 'tasks#index', as: 'tasks' + post '/tasks' => 'tasks#create' + get '/tasks/new' => 'tasks#new' + get '/tasks/:id' => 'tasks#show', as: 'task' + delete '/tasks/:id' => 'tasks#destroy' # Example of regular route: # get 'products/:id' => 'catalog#view' From c1d029b3b5d496f8c431e9923ead67887ac45033 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 14:44:22 -0700 Subject: [PATCH 11/36] Fix styling for delete button; --- app/assets/stylesheets/application.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 7f32e2f1b..1c8d39f5d 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -121,6 +121,13 @@ font-size: 1rem; } +.task-edits-buttons { + display: inline-block; + padding: 0; + background: none; + border: none; +} + .task-edits i { font-size: 1.5rem; color: #9fbfdf; @@ -128,6 +135,7 @@ } .task-edits i:hover { + cursor: pointer; color: white; } From 4709a20c90c6e430c2e9fbbaed2865a8bd9c7b57 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 14:45:02 -0700 Subject: [PATCH 12/36] Create view for new task form; --- app/views/tasks/new.html.erb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/views/tasks/new.html.erb diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb new file mode 100644 index 000000000..6326c5f28 --- /dev/null +++ b/app/views/tasks/new.html.erb @@ -0,0 +1,23 @@ +<%= params %> +
+

Create New Task

+
" method="post"> + + + +
+ + <%= form_for @task do |f| %> + <%= f.label :title do %> + <%= f.text_field :title, placeholder: "Buy a dozen puppies" %> + <% end %> + + <%= f.label :description do %> + <%= f.text_area :description, placeholder: "An optional description of the task", rows: "10", cols: "50" %> + <% end %> + + <%= f.submit %> + <% end %> + + +
From c3b9a2a2aa77a802f747b2a8ef0cc499a87bfca2 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 15:18:53 -0700 Subject: [PATCH 13/36] Added edit task feature; --- app/controllers/tasks_controller.rb | 15 +++++++++++++++ app/views/tasks/_task.html.erb | 6 ++++-- app/views/tasks/new.html.erb | 6 +----- config/routes.rb | 2 ++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 0543e2cf6..eb18f38bf 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -26,6 +26,21 @@ def create end end + def edit + @task = Task.find(params[:id]) + render :new + end + + def update + @task = Task.find(params[:id]) + @task.update(create_task_params[:task]) + if @task.save + redirect_to root_path + else + render :new + end + end + def destroy @task = Task.find(params[:id]) @task.destroy diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 1c8ba15a2..9b9dea688 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -21,9 +21,11 @@
- <%#ADD NUMBER SPECIFICTY in iteration%> + <%= link_to "/tasks/#{task.id}/edit" do %> + + <% end %> <%= button_to "/tasks/#{task.id}", class: "task-edits-buttons", method: :delete do %> - <%#ADD NUMBER SPECIFICTY in iteration%> + <% end %>
diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 6326c5f28..cf51f0614 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,11 +1,7 @@ <%= params %>

Create New Task

-
" method="post"> - - - -
+ <%= form_for @task do |f| %> <%= f.label :title do %> diff --git a/config/routes.rb b/config/routes.rb index 73e00c54f..df1bbf37b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,8 +8,10 @@ get '/tasks' => 'tasks#index', as: 'tasks' post '/tasks' => 'tasks#create' get '/tasks/new' => 'tasks#new' + get '/tasks/:id/edit' => 'tasks#edit' get '/tasks/:id' => 'tasks#show', as: 'task' delete '/tasks/:id' => 'tasks#destroy' + patch '/tasks/:id' => 'tasks#update' # Example of regular route: # get 'products/:id' => 'catalog#view' From 3b77218def49900e10d0277ba9652aed9a14b7f0 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 16:08:59 -0700 Subject: [PATCH 14/36] Added complete and uncomplete task feature; --- app/assets/stylesheets/application.css | 6 +++--- app/controllers/tasks_controller.rb | 13 +++++++++++++ app/models/task.rb | 2 +- app/views/tasks/_task.html.erb | 6 ++---- config/routes.rb | 2 ++ 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 1c8d39f5d..14f935f26 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -73,7 +73,7 @@ } - .completed { + .complete { font-style: italic; background-color: rgb(50, 77, 100); background-color: rgba(50, 77, 100, .7); @@ -105,7 +105,7 @@ background-image: url('/apps/assets/images/check.png'); opacity: 0.6;} - .completed .checkbox { + .complete .checkbox { background-image: url('/apps/assets/images/creepysmile.png'); z-index: 1; opacity: .8; @@ -175,7 +175,7 @@ text-align: center; } - .completed:nth-child(2n+1) { + .complete:nth-child(2n+1) { float: right; } diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index eb18f38bf..61fbd4c09 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -41,6 +41,18 @@ def update end end + def complete + @task = Task.find(params[:id]) + @task.update(completed_at: DateTime.now) + redirect_to root_path + end + + def uncomplete + @task = Task.find(params[:id]) + @task.update(completed_at: nil) + redirect_to root_path + end + def destroy @task = Task.find(params[:id]) @task.destroy @@ -54,4 +66,5 @@ def create_task_params params.permit(task: [:title, :description]) end + end diff --git a/app/models/task.rb b/app/models/task.rb index 88f61f0b0..393b835e3 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,6 +1,6 @@ class Task < ActiveRecord::Base - STATUS = {is_complete: ["uncomplete", "completed"], not_complete: ["completed", "uncompleted"]} + STATUS = {is_complete: ["uncomplete"], not_complete: ["complete"]} def self.all_tasks Task.all diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 9b9dea688..5a82e54d3 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -1,6 +1,4 @@ -<%= params %> - <% task ||= @tasks %> <% task.each do |task|%> <% @status = task.status %> @@ -16,9 +14,9 @@ <%= task.completed_at %> - + <%= link_to "tasks/#{task.id}/#{@status[0]}", method: :patch do %>
-
+ <% end %>
<%= link_to "/tasks/#{task.id}/edit" do %> diff --git a/config/routes.rb b/config/routes.rb index df1bbf37b..c7f03b149 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,8 @@ post '/tasks' => 'tasks#create' get '/tasks/new' => 'tasks#new' get '/tasks/:id/edit' => 'tasks#edit' + patch '/tasks/:id/complete' => 'tasks#complete', as: 'tasks_complete' + patch '/tasks/:id/uncomplete' => 'tasks#uncomplete' get '/tasks/:id' => 'tasks#show', as: 'task' delete '/tasks/:id' => 'tasks#destroy' patch '/tasks/:id' => 'tasks#update' From 4dd3deebe352a590bcbb89c13c0b40acbd3dd8c3 Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 16:10:58 -0700 Subject: [PATCH 15/36] Take out debugging params on new task page; --- app/views/tasks/new.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index cf51f0614..a87b47d9d 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,4 +1,3 @@ -<%= params %>

Create New Task

From fb271caa49de30c991ffefaf44983ca4a9f6436f Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 21 Apr 2016 16:58:36 -0700 Subject: [PATCH 16/36] Added JS popup confirmation on delete; --- app/views/tasks/_task.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 5a82e54d3..694eee05f 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -22,7 +22,7 @@ <%= link_to "/tasks/#{task.id}/edit" do %> <% end %> - <%= button_to "/tasks/#{task.id}", class: "task-edits-buttons", method: :delete do %> + <%= button_to "/tasks/#{task.id}", class: "task-edits-buttons", data: {confirm: "Are you sure you want to delete permanently?"}, method: :delete do %> <% end %>
From f08c186fe52224f96eb9e46f33cebb97fa6817dd Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 09:33:54 -0700 Subject: [PATCH 17/36] Use erb for css file, add pathing for checkbox background images; --- app/assets/stylesheets/application.css.erb | 214 +++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 app/assets/stylesheets/application.css.erb diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb new file mode 100644 index 000000000..7995ad1de --- /dev/null +++ b/app/assets/stylesheets/application.css.erb @@ -0,0 +1,214 @@ +/* + * 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 + */ + * { + box-sizing: border-box; + } + + html { + font-size: 16px; + font-family: 'Josefin Sans', Helvetica, Arial, sans-serif; + } + body { + background-color: #19334d; + color: #ecf2f9; + padding: 4rem; + } + + h1 { + font-size: 3.5rem; + } + + h2 { + margin: .25rem 0; + } + + a { + color: white; + text-decoration: none; + } + + header.title { + width: 100%; + text-align: center; + font-size: 1.25rem; + } + + /*INDEX*/ + .task-info { + display: inline-block; + width: 75%; + min-height: 4rem; + margin-left: .25rem; + padding: .5rem .3rem; + } + + .task-info p { + margin: 0; + padding-left: .6rem; + color: #CDD2D7; + } + + .task-box { + /*background-color: rgb(62, 98, 134);*/ + background-color: #54789B; + width: 45%; + border: .1rem solid #18314e; + border-radius: .3rem; + color: #ecf2f9; + margin: 2% 2.5%; + float: left; + } + + + .complete { + font-style: italic; + background-color: rgb(50, 77, 100); + background-color: rgba(50, 77, 100, .7); + float: left; + } + + .uncomplete:nth-child(2n+1) { + float: right; + } + + .checkbox { + height: 2.5rem; + width: 2.5rem; + margin: 2%; + background-color: #ABB8C4; + background-image: url(<%= asset_path 'check.png' %>); + opacity: 0.3; + background-size: contain; + border: .25rem solid #ABB8C4; + border-radius: .25rem; + vertical-align: middle; + float: left; + overflow: auto; + } + + .checkbox:hover { + background-color: #E9E9E9; + border: .25rem solid #E9E9E9; + background-image: url(<%= asset_path 'check.png' %>); + opacity: 0.6;} + + .complete .checkbox { + background-image: url(<%= asset_path 'creepysmile.png' %>); + z-index: 1; + opacity: .8; + background-repeat: no-repeat; + background-size: cover; + } + + .task-edits { + float: right; + /*display: block;*/ + width: 5%; + margin: 1% 0.5% 1% 1%; + font-size: 1rem; + } + +.task-edits-buttons { + display: inline-block; + padding: 0; + background: none; + border: none; +} + + .task-edits i { + font-size: 1.5rem; + color: #9fbfdf; + padding: .2rem 0; + } + + .task-edits i:hover { + cursor: pointer; + color: white; + } + + .new-task { + width: 25%; + height: 3.5rem; + margin: 3% auto; + padding: 1rem; + background: #E4C158; + border-radius: .25rem; + font-size: 1.5rem; + text-align: center; + cursor: pointer; + } + + .new-task:hover { + background: #E3B429; + } + + .new-task p { + margin: 0; + padding: 0; + } + + .float-left { + float: left; + } + + .float-right { + float: right; + } + + .column-title{ + display: inline-block; + clear: both; + width: 100%; + text-align: center; + } + + .complete:nth-child(2n+1) { + float: right; + } + + /** FORM **/ + + .create-task { + width: 50%; + text-align: center; + margin: auto; + } + + .create-task form * { + display: block; + margin: auto; + padding: .2rem; + } + + .create-task form label { + margin: 4%; + } + + .create-task form textarea, + .create-task form input[type=text] { + margin-top: 2%; + } + + + + + + + + + + + /** END **/ From b0ba44ba7f4cdcbd7f41753bc3400dafea8fa675 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 09:41:23 -0700 Subject: [PATCH 18/36] Fix completion status on task view; --- app/models/task.rb | 2 +- app/views/tasks/_task.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 393b835e3..3bceee4b9 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,6 +1,6 @@ class Task < ActiveRecord::Base - STATUS = {is_complete: ["uncomplete"], not_complete: ["complete"]} + STATUS = {is_complete: ["uncomplete", "complete"], not_complete: ["complete", "uncomplete"]} def self.all_tasks Task.all diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 694eee05f..a26c0ce14 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -3,7 +3,7 @@ <% task.each do |task|%> <% @status = task.status %> -
+
<%= link_to "/tasks/#{task.id}" do %>

<%=task.title%>

From 81b34b1f78c6105d7f64716db0c513d11262d521 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 09:43:38 -0700 Subject: [PATCH 19/36] Add erb preproccessing to stylesheet; Clean up routes; --- app/assets/stylesheets/application.css | 214 ------------------------- config/routes.rb | 16 +- 2 files changed, 8 insertions(+), 222 deletions(-) delete mode 100644 app/assets/stylesheets/application.css diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index 14f935f26..000000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,214 +0,0 @@ -/* - * 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 - */ - * { - box-sizing: border-box; - } - - html { - font-size: 16px; - font-family: 'Josefin Sans', Helvetica, Arial, sans-serif; - } - body { - background-color: #19334d; - color: #ecf2f9; - padding: 4rem; - } - - h1 { - font-size: 3.5rem; - } - - h2 { - margin: .25rem 0; - } - - a { - color: white; - text-decoration: none; - } - - header.title { - width: 100%; - text-align: center; - font-size: 1.25rem; - } - - /*INDEX*/ - .task-info { - display: inline-block; - width: 75%; - min-height: 4rem; - margin-left: .25rem; - padding: .5rem .3rem; - } - - .task-info p { - margin: 0; - padding-left: .6rem; - color: #CDD2D7; - } - - .task-box { - /*background-color: rgb(62, 98, 134);*/ - background-color: #54789B; - width: 45%; - border: .1rem solid #18314e; - border-radius: .3rem; - color: #ecf2f9; - margin: 2% 2.5%; - float: left; - } - - - .complete { - font-style: italic; - background-color: rgb(50, 77, 100); - background-color: rgba(50, 77, 100, .7); - float: left; - } - - .uncomplete:nth-child(2n+1) { - float: right; - } - - .checkbox { - height: 2.5rem; - width: 2.5rem; - margin: 2%; - background-color: #ABB8C4; - background-image: url('/app/assets/images/check.png'); - opacity: 0.3; - background-size: contain; - border: .25rem solid #ABB8C4; - border-radius: .25rem; - vertical-align: middle; - float: left; - overflow: auto; - } - - .checkbox:hover { - background-color: #E9E9E9; - border: .25rem solid #E9E9E9; - background-image: url('/apps/assets/images/check.png'); - opacity: 0.6;} - - .complete .checkbox { - background-image: url('/apps/assets/images/creepysmile.png'); - z-index: 1; - opacity: .8; - background-repeat: no-repeat; - background-size: cover; - } - - .task-edits { - float: right; - /*display: block;*/ - width: 5%; - margin: 1% 0.5% 1% 1%; - font-size: 1rem; - } - -.task-edits-buttons { - display: inline-block; - padding: 0; - background: none; - border: none; -} - - .task-edits i { - font-size: 1.5rem; - color: #9fbfdf; - padding: .2rem 0; - } - - .task-edits i:hover { - cursor: pointer; - color: white; - } - - .new-task { - width: 25%; - height: 3.5rem; - margin: 3% auto; - padding: 1rem; - background: #E4C158; - border-radius: .25rem; - font-size: 1.5rem; - text-align: center; - cursor: pointer; - } - - .new-task:hover { - background: #E3B429; - } - - .new-task p { - margin: 0; - padding: 0; - } - - .float-left { - float: left; - } - - .float-right { - float: right; - } - - .column-title{ - display: inline-block; - clear: both; - width: 100%; - text-align: center; - } - - .complete:nth-child(2n+1) { - float: right; - } - - /** FORM **/ - - .create-task { - width: 50%; - text-align: center; - margin: auto; - } - - .create-task form * { - display: block; - margin: auto; - padding: .2rem; - } - - .create-task form label { - margin: 4%; - } - - .create-task form textarea, - .create-task form input[type=text] { - margin-top: 2%; - } - - - - - - - - - - - /** END **/ diff --git a/config/routes.rb b/config/routes.rb index c7f03b149..063f9d26b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,15 +5,15 @@ # You can have the root of your site routed with "root" # root 'welcome#index' root 'tasks#index' - get '/tasks' => 'tasks#index', as: 'tasks' - post '/tasks' => 'tasks#create' - get '/tasks/new' => 'tasks#new' - get '/tasks/:id/edit' => 'tasks#edit' - patch '/tasks/:id/complete' => 'tasks#complete', as: 'tasks_complete' + get '/tasks' => 'tasks#index', as: 'tasks' + post '/tasks' => 'tasks#create' + get '/tasks/new' => 'tasks#new' + get '/tasks/:id' => 'tasks#show', as: 'task' + delete '/tasks/:id' => 'tasks#destroy' + patch '/tasks/:id' => 'tasks#update' + get '/tasks/:id/edit' => 'tasks#edit', as: 'task_edit' + patch '/tasks/:id/complete' => 'tasks#complete', as: 'task_complete' patch '/tasks/:id/uncomplete' => 'tasks#uncomplete' - get '/tasks/:id' => 'tasks#show', as: 'task' - delete '/tasks/:id' => 'tasks#destroy' - patch '/tasks/:id' => 'tasks#update' # Example of regular route: # get 'products/:id' => 'catalog#view' From 5afc84f07701bb4aec28a2bee59b7f59e161f95e Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 09:46:15 -0700 Subject: [PATCH 20/36] Revert "Fix completion status on task view;" This reverts commit b0ba44ba7f4cdcbd7f41753bc3400dafea8fa675. --- app/models/task.rb | 2 +- app/views/tasks/_task.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 3bceee4b9..393b835e3 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,6 +1,6 @@ class Task < ActiveRecord::Base - STATUS = {is_complete: ["uncomplete", "complete"], not_complete: ["complete", "uncomplete"]} + STATUS = {is_complete: ["uncomplete"], not_complete: ["complete"]} def self.all_tasks Task.all diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index a26c0ce14..694eee05f 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -3,7 +3,7 @@ <% task.each do |task|%> <% @status = task.status %> -
+
<%= link_to "/tasks/#{task.id}" do %>

<%=task.title%>

From 91fa0eda518f62c0251293900b0d7942eb215aa7 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 09:48:57 -0700 Subject: [PATCH 21/36] Editing routes; --- config/routes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 063f9d26b..ed869c665 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,9 +11,9 @@ get '/tasks/:id' => 'tasks#show', as: 'task' delete '/tasks/:id' => 'tasks#destroy' patch '/tasks/:id' => 'tasks#update' - get '/tasks/:id/edit' => 'tasks#edit', as: 'task_edit' - patch '/tasks/:id/complete' => 'tasks#complete', as: 'task_complete' - patch '/tasks/:id/uncomplete' => 'tasks#uncomplete' + get '/tasks/:id/edit' => 'tasks#edit', as: 'edit_task' + patch '/tasks/:id/complete' => 'tasks#complete', as: 'complete_task' + patch '/tasks/:id/uncomplete' => 'tasks#uncomplete', as: 'uncomplete_task' # Example of regular route: # get 'products/:id' => 'catalog#view' From 623678202f81237b1f5541513553afcd0aa72211 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 12:57:53 -0700 Subject: [PATCH 22/36] Create new Person model and associate it with Task model; Update seed file, migrate; --- app/models/person.rb | 3 +++ app/models/task.rb | 2 ++ db/migrate/20160422182020_create_people.rb | 9 +++++++++ .../20160422182113_associate_task_and_person.rb | 5 +++++ db/schema.rb | 9 ++++++++- db/seeds.rb | 17 ++++++++++++++--- test/fixtures/people.yml | 7 +++++++ test/models/person_test.rb | 7 +++++++ 8 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 app/models/person.rb create mode 100644 db/migrate/20160422182020_create_people.rb create mode 100644 db/migrate/20160422182113_associate_task_and_person.rb create mode 100644 test/fixtures/people.yml create mode 100644 test/models/person_test.rb diff --git a/app/models/person.rb b/app/models/person.rb new file mode 100644 index 000000000..4ed22ba8b --- /dev/null +++ b/app/models/person.rb @@ -0,0 +1,3 @@ +class Person < ActiveRecord::Base + has_many :tasks +end diff --git a/app/models/task.rb b/app/models/task.rb index 393b835e3..566036630 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,5 +1,7 @@ class Task < ActiveRecord::Base + belongs_to :person + STATUS = {is_complete: ["uncomplete"], not_complete: ["complete"]} def self.all_tasks diff --git a/db/migrate/20160422182020_create_people.rb b/db/migrate/20160422182020_create_people.rb new file mode 100644 index 000000000..727e50381 --- /dev/null +++ b/db/migrate/20160422182020_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/migrate/20160422182113_associate_task_and_person.rb b/db/migrate/20160422182113_associate_task_and_person.rb new file mode 100644 index 000000000..db9c43918 --- /dev/null +++ b/db/migrate/20160422182113_associate_task_and_person.rb @@ -0,0 +1,5 @@ +class AssociateTaskAndPerson < ActiveRecord::Migration + def change + add_column :tasks, :person_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 29af6b986..38faf68ab 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: 20160419203503) do +ActiveRecord::Schema.define(version: 20160422182113) 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", null: false @@ -19,6 +25,7 @@ t.string "completed_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.integer "person_id" end end diff --git a/db/seeds.rb b/db/seeds.rb index 13b51ed1b..fef2f19db 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -24,13 +24,13 @@ def random_time tasks = [ { title: "The First Task", description: "", completed_at: random_time }, - { title: "Go to Brunch", description: "" }, + { title: "Go to Brunch", description: "", person_id: 1 }, { title: "Go to Lunch", description: "", completed_at: random_time }, { title: "Go to Second Lunch", description: "" }, - { title: "Play Video Games", description: "", completed_at: random_time }, + { title: "Play Video Games", description: "", completed_at: random_time, person_id: 1 }, { title: "High Five Somebody You Don't Know", description: "", completed_at: random_time }, { title: "Plant Flowers", description: "", completed_at: random_time }, - { title: "Call Mom", description: "" }, + { title: "Call Mom", description: "", person_id: 2 }, { title: "She worries, you know.", description: "" }, { title: "Nap.", description: "", completed_at: random_time } ] @@ -39,4 +39,15 @@ def random_time Task.create task end +people = [ + { name: "Yokes" }, + { name: "Marla" }, + { name: "Apes" } +] + +people.each do |person| + Person.create person +end + puts "There are now #{Task.count} tasks in the DB" +puts "There are now #{Person.count} people in the DB" diff --git a/test/fixtures/people.yml b/test/fixtures/people.yml new file mode 100644 index 000000000..56066c68a --- /dev/null +++ b/test/fixtures/people.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/models/person_test.rb b/test/models/person_test.rb new file mode 100644 index 000000000..ad04ed813 --- /dev/null +++ b/test/models/person_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PersonTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 80fb582cc45fdaa1949d35782bf31679c24a951e Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 13:10:21 -0700 Subject: [PATCH 23/36] Tasks display their Person; --- app/views/tasks/_task.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 694eee05f..482cb4573 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -8,6 +8,7 @@ <%= link_to "/tasks/#{task.id}" do %>

<%=task.title%>

<% end %> +

<%= task.person.name if task.person %>

<%= task.description %>

From 0da540a7228a1db57c7e1650f13e352334825aae Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 13:49:57 -0700 Subject: [PATCH 24/36] Added dropdown to the form in new view to assign a task to a Person and update tasks db; --- app/controllers/tasks_controller.rb | 9 +++++++-- app/views/tasks/index.html.erb | 3 +++ app/views/tasks/new.html.erb | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 61fbd4c09..6185966fa 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -18,8 +18,8 @@ def new def create @task = Task.new(create_task_params[:task]) + assign_person if @task.save - # redirect_to task_path(@task.id) redirect_to root_path else render '#' @@ -33,6 +33,7 @@ def edit def update @task = Task.find(params[:id]) + assign_person @task.update(create_task_params[:task]) if @task.save redirect_to root_path @@ -63,7 +64,11 @@ def destroy def create_task_params # I don't get the syntax for the next line, it looks like an array as the value # at the key :title, but in the params hash it's not an array - params.permit(task: [:title, :description]) + params.permit(task: [:title, :description], person: [:person_id]) + end + + def assign_person + @task.person= Person.find(create_task_params[:person][:person_id]) if @task.person end diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 49df51b1a..56989ecaa 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -3,6 +3,9 @@

New task

<% end %> + +
<%= params %>
+

Tasks to do:

diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index a87b47d9d..37ae1d613 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -11,6 +11,10 @@ <%= f.text_area :description, placeholder: "An optional description of the task", rows: "10", cols: "50" %> <% end %> + <%= f.label :person do %> + <%= collection_select(:person, :person_id, Person.all, :id, :name, {include_blank: "Assign Task"}) %> + <% end %> + <%= f.submit %> <% end %> From a5cd91cdb06d2f20236e0475b4bf314f5e783863 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 13:51:05 -0700 Subject: [PATCH 25/36] Fix completion status styling on index; --- app/models/task.rb | 2 +- app/views/tasks/_task.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 566036630..cc6e6c2fd 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -2,7 +2,7 @@ class Task < ActiveRecord::Base belongs_to :person - STATUS = {is_complete: ["uncomplete"], not_complete: ["complete"]} + STATUS = {is_complete: ["uncomplete", "complete"], not_complete: ["complete", "uncomplete"]} def self.all_tasks Task.all diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 482cb4573..8a49c9a2b 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -3,7 +3,7 @@ <% task.each do |task|%> <% @status = task.status %> -
+
<%= link_to "/tasks/#{task.id}" do %>

<%=task.title%>

From 6254916f88137249681f94540d94af4be16a03bd Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 14:32:03 -0700 Subject: [PATCH 26/36] Fix issue where empty person attribute would error; --- app/controllers/tasks_controller.rb | 13 +++++++++---- app/views/tasks/index.html.erb | 3 --- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 6185966fa..f40afaede 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -18,7 +18,7 @@ def new def create @task = Task.new(create_task_params[:task]) - assign_person + assign_person(@task) if @task.save redirect_to root_path else @@ -33,8 +33,9 @@ def edit def update @task = Task.find(params[:id]) - assign_person @task.update(create_task_params[:task]) + assign_person(@task) + # raise if @task.save redirect_to root_path else @@ -67,8 +68,12 @@ def create_task_params params.permit(task: [:title, :description], person: [:person_id]) end - def assign_person - @task.person= Person.find(create_task_params[:person][:person_id]) if @task.person + def assign_person(task) + unless create_task_params[:person][:person_id].empty? + task.person= Person.find(create_task_params[:person][:person_id]) + else + task.person= nil + end end diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 56989ecaa..49df51b1a 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -3,9 +3,6 @@

New task

<% end %> - -
<%= params %>
-

Tasks to do:

From b9a11a08ba87c9dc2896e33b198b5c35e772800a Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 14:33:06 -0700 Subject: [PATCH 27/36] Add People controller with index view to list all people and their uncompleted tasks count; --- app/assets/javascripts/people.coffee | 3 +++ app/assets/stylesheets/people.scss | 3 +++ app/controllers/people_controller.rb | 11 +++++++++++ app/helpers/people_helper.rb | 2 ++ app/models/person.rb | 4 ++++ app/views/people/_person.html.erb | 7 +++++++ app/views/people/index.html.erb | 4 ++++ config/routes.rb | 5 +++++ test/controllers/people_controller_test.rb | 7 +++++++ 9 files changed, 46 insertions(+) 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/views/people/_person.html.erb create mode 100644 app/views/people/index.html.erb create mode 100644 test/controllers/people_controller_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/controllers/people_controller.rb b/app/controllers/people_controller.rb new file mode 100644 index 000000000..d16a9ad42 --- /dev/null +++ b/app/controllers/people_controller.rb @@ -0,0 +1,11 @@ +class PeopleController < ApplicationController + def index + @people = Person.all + render :index + end + + def show + render :_person + 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 index 4ed22ba8b..0a8b13687 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,3 +1,7 @@ class Person < ActiveRecord::Base has_many :tasks + + def uncompleted_tasks + self.tasks.where(completed_at: nil).count + end end diff --git a/app/views/people/_person.html.erb b/app/views/people/_person.html.erb new file mode 100644 index 000000000..5aca13477 --- /dev/null +++ b/app/views/people/_person.html.erb @@ -0,0 +1,7 @@ +
+ <%= link_to person_path do %> +

<%= person.name %>

+ <% end %> +

<%= person.uncompleted_tasks %> + +

diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb new file mode 100644 index 000000000..eb4c71937 --- /dev/null +++ b/app/views/people/index.html.erb @@ -0,0 +1,4 @@ + +<% @people.each do |person| %> + <%= render partial: 'person', object: person %> +<% end %> diff --git a/config/routes.rb b/config/routes.rb index ed869c665..c34fd02ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,11 @@ get '/tasks/:id/edit' => 'tasks#edit', as: 'edit_task' patch '/tasks/:id/complete' => 'tasks#complete', as: 'complete_task' patch '/tasks/:id/uncomplete' => 'tasks#uncomplete', as: 'uncomplete_task' + + get '/people' => 'people#index' + get '/people/:id' => 'people#show', as: 'person' + + # Example of regular route: # get 'products/:id' => 'catalog#view' diff --git a/test/controllers/people_controller_test.rb b/test/controllers/people_controller_test.rb new file mode 100644 index 000000000..e75205679 --- /dev/null +++ b/test/controllers/people_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PeopleControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From edcd7c288ff64a5f8d4eedc5d7f28a82329fc645 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 14:54:04 -0700 Subject: [PATCH 28/36] Add people show pages and link to view with all of their tasks; --- app/controllers/people_controller.rb | 6 +++++- app/views/people/_person.html.erb | 3 ++- app/views/people/show.html.erb | 2 ++ app/views/people/tasks.html.erb | 2 ++ config/routes.rb | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 app/views/people/show.html.erb create mode 100644 app/views/people/tasks.html.erb diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index d16a9ad42..14a89c0b4 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -5,7 +5,11 @@ def index end def show - render :_person + @person = Person.find(params[:id]) + end + + def tasks + @person = Person.find(params[:id]) end end diff --git a/app/views/people/_person.html.erb b/app/views/people/_person.html.erb index 5aca13477..32c7eecce 100644 --- a/app/views/people/_person.html.erb +++ b/app/views/people/_person.html.erb @@ -1,5 +1,6 @@ +<% person ||= @person %>
- <%= link_to person_path do %> + <%= link_to "/people/#{person.id}" do %>

<%= person.name %>

<% end %>

<%= person.uncompleted_tasks %> diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb new file mode 100644 index 000000000..abc92855c --- /dev/null +++ b/app/views/people/show.html.erb @@ -0,0 +1,2 @@ +<%= render partial: 'person', object: @person %> +<%= link_to "See All Tasks For #{@person.name}", "/people/#{@person.id}/tasks" %> diff --git a/app/views/people/tasks.html.erb b/app/views/people/tasks.html.erb new file mode 100644 index 000000000..36bd3fedf --- /dev/null +++ b/app/views/people/tasks.html.erb @@ -0,0 +1,2 @@ +

<%= @person.name %>'s Tasks

+<%= render partial: '/tasks/task', object: @person.tasks %> diff --git a/config/routes.rb b/config/routes.rb index c34fd02ae..6b2d433fa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,7 @@ get '/people' => 'people#index' get '/people/:id' => 'people#show', as: 'person' + get '/people/:id/tasks' => 'people#tasks' # Example of regular route: From 7387326538782003ee641dff7c8eb23a23aef970 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 18:03:14 -0700 Subject: [PATCH 29/36] Use path helpers omgzzz yess plzz; --- app/views/people/_person.html.erb | 2 +- app/views/people/show.html.erb | 2 +- app/views/tasks/_task.html.erb | 9 +++++---- config/routes.rb | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/people/_person.html.erb b/app/views/people/_person.html.erb index 32c7eecce..08aff2e46 100644 --- a/app/views/people/_person.html.erb +++ b/app/views/people/_person.html.erb @@ -1,6 +1,6 @@ <% person ||= @person %>
- <%= link_to "/people/#{person.id}" do %> + <%= link_to person_path(person.id) do %>

<%= person.name %>

<% end %>

<%= person.uncompleted_tasks %> diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb index abc92855c..c4c91d5e6 100644 --- a/app/views/people/show.html.erb +++ b/app/views/people/show.html.erb @@ -1,2 +1,2 @@ <%= render partial: 'person', object: @person %> -<%= link_to "See All Tasks For #{@person.name}", "/people/#{@person.id}/tasks" %> +<%= link_to "See All Tasks For #{@person.name}", person_tasks(@person.id) %> diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 8a49c9a2b..e37db0e7d 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -5,7 +5,7 @@

- <%= link_to "/tasks/#{task.id}" do %> + <%= link_to task_path(task.id) do %>

<%=task.title%>

<% end %>

<%= task.person.name if task.person %>

@@ -15,15 +15,16 @@ <%= task.completed_at %>
- <%= link_to "tasks/#{task.id}/#{@status[0]}", method: :patch do %> + <% path = @status[0] == "complete" ? complete_task_path(task.id) : uncomplete_task_path(task.id) %> + <%= link_to path, method: :patch do %>
<% end %>
- <%= link_to "/tasks/#{task.id}/edit" do %> + <%= link_to edit_task_path(task.id) do %> <% end %> - <%= button_to "/tasks/#{task.id}", class: "task-edits-buttons", data: {confirm: "Are you sure you want to delete permanently?"}, method: :delete do %> + <%= button_to task_path(task.id), class: "task-edits-buttons", data: {confirm: "Are you sure you want to delete permanently?"}, method: :delete do %> <% end %>
diff --git a/config/routes.rb b/config/routes.rb index 6b2d433fa..256a689cd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,7 +17,7 @@ get '/people' => 'people#index' get '/people/:id' => 'people#show', as: 'person' - get '/people/:id/tasks' => 'people#tasks' + get '/people/:id/tasks' => 'people#tasks', as: 'person_tasks' # Example of regular route: From c7843c560daf52cdcd6b4968592bcb901e1775c0 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 19:41:21 -0700 Subject: [PATCH 30/36] Tasks link to their person; Fix some link paths; --- app/views/layouts/application.html.erb | 5 +++-- app/views/layouts/home.html.erb | 0 app/views/people/show.html.erb | 2 +- app/views/tasks/_task.html.erb | 6 +++++- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 app/views/layouts/home.html.erb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3cd801c0a..5a7cd18c2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,10 +10,11 @@
-

SUPER AWESOME TO-DO LIST

+ <%= link_to root_path do %> +

SUPER AWESOME TO-DO LIST

+ <% end %>
- <%= yield %> diff --git a/app/views/layouts/home.html.erb b/app/views/layouts/home.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb index c4c91d5e6..28e9f0078 100644 --- a/app/views/people/show.html.erb +++ b/app/views/people/show.html.erb @@ -1,2 +1,2 @@ <%= render partial: 'person', object: @person %> -<%= link_to "See All Tasks For #{@person.name}", person_tasks(@person.id) %> +<%= link_to "See All Tasks For #{@person.name}", person_tasks_path(@person.id) %> diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index e37db0e7d..0b7dab3a1 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -8,7 +8,11 @@ <%= link_to task_path(task.id) do %>

<%=task.title%>

<% end %> -

<%= task.person.name if task.person %>

+ <% if task.person %> + <%= link_to person_path(task.person_id) do %> + <%= task.person.name %> + <% end %> + <% end %>

<%= task.description %>

From bbc2ce9d3117ec20daaee7fe5720158110f2ee45 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 22 Apr 2016 20:26:10 -0700 Subject: [PATCH 31/36] Styled task form; --- app/assets/stylesheets/application.css.erb | 106 ++++++++++++--------- app/views/tasks/_task.html.erb | 1 - app/views/tasks/index.html.erb | 2 +- app/views/tasks/new.html.erb | 4 +- 4 files changed, 65 insertions(+), 48 deletions(-) diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index 7995ad1de..3b4b1a6c7 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -21,6 +21,7 @@ font-size: 16px; font-family: 'Josefin Sans', Helvetica, Arial, sans-serif; } + body { background-color: #19334d; color: #ecf2f9; @@ -46,7 +47,47 @@ font-size: 1.25rem; } - /*INDEX*/ + /** Index **/ + + .button { + width: 17rem; + height: 3.5rem; + margin: 3% auto; + padding: 1rem; + background: #E4C158; + border: none; + border-radius: .25rem; + font-size: 1.45rem; + text-align: center; + color: white; + cursor: pointer; + } + + .button:hover { + background: #E3B429; + } + + .button p { + margin: 0; + padding: 0; + } + + .float-left { + float: left; + } + + .float-right { + float: right; + } + + .column-title{ + display: inline-block; + clear: both; + width: 100%; + text-align: center; + } + + /** Task **/ .task-info { display: inline-block; width: 75%; @@ -56,13 +97,12 @@ } .task-info p { - margin: 0; + margin: .2rem 0 0 0; padding-left: .6rem; color: #CDD2D7; } .task-box { - /*background-color: rgb(62, 98, 134);*/ background-color: #54789B; width: 45%; border: .1rem solid #18314e; @@ -72,7 +112,6 @@ float: left; } - .complete { font-style: italic; background-color: rgb(50, 77, 100); @@ -106,16 +145,15 @@ opacity: 0.6;} .complete .checkbox { - background-image: url(<%= asset_path 'creepysmile.png' %>); + background-image: url(<%= asset_path 'check.png' %>); z-index: 1; - opacity: .8; + opacity: 1; background-repeat: no-repeat; background-size: cover; } .task-edits { float: right; - /*display: block;*/ width: 5%; margin: 1% 0.5% 1% 1%; font-size: 1rem; @@ -139,42 +177,6 @@ color: white; } - .new-task { - width: 25%; - height: 3.5rem; - margin: 3% auto; - padding: 1rem; - background: #E4C158; - border-radius: .25rem; - font-size: 1.5rem; - text-align: center; - cursor: pointer; - } - - .new-task:hover { - background: #E3B429; - } - - .new-task p { - margin: 0; - padding: 0; - } - - .float-left { - float: left; - } - - .float-right { - float: right; - } - - .column-title{ - display: inline-block; - clear: both; - width: 100%; - text-align: center; - } - .complete:nth-child(2n+1) { float: right; } @@ -187,7 +189,7 @@ margin: auto; } - .create-task form * { + .create-task form > * { display: block; margin: auto; padding: .2rem; @@ -199,9 +201,25 @@ .create-task form textarea, .create-task form input[type=text] { + width: 100%; margin-top: 2%; + padding: .5rem; + background-color: #EDEDED; + border-radius: .25rem; + font-size: 1.3rem; } + .create-task form textarea:focus, + .create-task form input[type=text]:focus { + background-color: white; +} + +.create-task select { + width: 17rem; + height: 3rem; + background-color: white; + font-size: 1.3rem; +} diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 0b7dab3a1..9451ed650 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -1,4 +1,3 @@ - <% task ||= @tasks %> <% task.each do |task|%> <% @status = task.status %> diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index 49df51b1a..1cdf0cfb7 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -1,5 +1,5 @@ <%= link_to tasks_new_path do %> -
+

New task

<% end %> diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 37ae1d613..12134e354 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -8,14 +8,14 @@ <% end %> <%= f.label :description do %> - <%= f.text_area :description, placeholder: "An optional description of the task", rows: "10", cols: "50" %> + <%= f.text_area :description, placeholder: "An optional description of the task", rows: "12" %> <% end %> <%= f.label :person do %> <%= collection_select(:person, :person_id, Person.all, :id, :name, {include_blank: "Assign Task"}) %> <% end %> - <%= f.submit %> + <%= f.submit class: "button" %> <% end %> From a2c6f1fe497680cc7149914acd037ebac6100b60 Mon Sep 17 00:00:00 2001 From: sophia Date: Sat, 23 Apr 2016 00:15:40 -0700 Subject: [PATCH 32/36] Form styling; --- app/assets/stylesheets/application.css.erb | 5 +++-- app/views/tasks/new.html.erb | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index 3b4b1a6c7..37006dea1 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -210,14 +210,15 @@ } .create-task form textarea:focus, - .create-task form input[type=text]:focus { + .create-task form input[type=text]:focus, + .create-task select:focus { background-color: white; } .create-task select { width: 17rem; height: 3rem; - background-color: white; + background-color: #EDEDED; font-size: 1.3rem; } diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 12134e354..9211540df 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -1,10 +1,11 @@
-

Create New Task

+ <% task_type = @task.title.nil? ? "Create New" : "Update" %> +

<%= task_type %> Task

<%= form_for @task do |f| %> <%= f.label :title do %> - <%= f.text_field :title, placeholder: "Buy a dozen puppies" %> + <%= f.text_field :title, placeholder: "Buy a dozen puppies", required: true %> <% end %> <%= f.label :description do %> From 8230f6adbd541b071fb6aa2ed436b5b5d6847ae1 Mon Sep 17 00:00:00 2001 From: sophia Date: Sun, 24 Apr 2016 17:03:57 -0700 Subject: [PATCH 33/36] Render :new view instead of rendering an octothorp which im pretty sure wouldn't work; --- 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 f40afaede..43a955f29 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -22,7 +22,7 @@ def create if @task.save redirect_to root_path else - render '#' + render :new end end From 08d134fe49f4d6406a3593b7b6c6ba6dab6783e7 Mon Sep 17 00:00:00 2001 From: sophia Date: Mon, 25 Apr 2016 11:22:32 -0700 Subject: [PATCH 34/36] Gemfile changes --- Gemfile | 9 +++++++-- Gemfile.lock | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9ef7bdf51..1c7f50591 100644 --- a/Gemfile +++ b/Gemfile @@ -3,8 +3,6 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.6' -# 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 @@ -35,6 +33,8 @@ gem 'sdoc', '~> 0.4.0', group: :doc group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' + # Use sqlite3 as the database for Active Record + gem 'sqlite3' end group :development do @@ -46,3 +46,8 @@ 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 + +group :production do + gem 'pg' + gem 'rails_12factor' +end diff --git a/Gemfile.lock b/Gemfile.lock index abfecdc5c..8c1f700d1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,6 +80,7 @@ GEM multi_json (1.11.2) nokogiri (1.6.7.2) mini_portile2 (~> 2.0.0.rc2) + pg (0.18.4) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -102,6 +103,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.6) actionpack (= 4.2.6) activesupport (= 4.2.6) @@ -154,7 +160,9 @@ DEPENDENCIES coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails + pg rails (= 4.2.6) + rails_12factor sass-rails (~> 5.0) sdoc (~> 0.4.0) spring From 445a7efe22bb2934be962cca1607a4f888ff93d5 Mon Sep 17 00:00:00 2001 From: sophia Date: Mon, 25 Apr 2016 19:32:16 -0700 Subject: [PATCH 35/36] Style people pages, and a lot of other stuff, done; --- app/assets/stylesheets/application.css.erb | 24 ++++++++++++++++--- app/controllers/application_controller.rb | 3 +++ app/controllers/tasks_controller.rb | 10 ++++---- app/views/layouts/application.html.erb | 6 ++--- app/views/layouts/home.html.erb | 0 app/views/people/_person.html.erb | 24 +++++++++++++------ app/views/people/index.html.erb | 3 +-- app/views/people/show.html.erb | 1 - app/views/tasks/home.html.erb | 10 ++++++++ config/routes.rb | 2 +- .../20160426015450_add_email_to_people.rb | 5 ++++ db/schema.rb | 3 ++- db/seeds.rb | 8 +++---- 13 files changed, 72 insertions(+), 27 deletions(-) delete mode 100644 app/views/layouts/home.html.erb create mode 100644 app/views/tasks/home.html.erb create mode 100644 db/migrate/20160426015450_add_email_to_people.rb diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index 37006dea1..8005edf8e 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -47,7 +47,12 @@ font-size: 1.25rem; } - /** Index **/ + /** Home Page LOL **/ + article { + padding: 3rem 0; + } + + /** Task Index **/ .button { width: 17rem; @@ -112,6 +117,11 @@ float: left; } + .center-task-box { + float: none; + margin: 2% auto; + } + .complete { font-style: italic; background-color: rgb(50, 77, 100); @@ -222,9 +232,17 @@ font-size: 1.3rem; } +/** People **/ +.person-icon { + float: left; + padding: 1rem 0 0 1rem; + font-size: 3rem; +} - - +.all-tasks { + display: block; + margin: 1rem; +} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e1b..0fcb16687 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,7 @@ 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 + def home + end + end diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 43a955f29..dfc5b9fd2 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -20,7 +20,7 @@ def create @task = Task.new(create_task_params[:task]) assign_person(@task) if @task.save - redirect_to root_path + redirect_to tasks_path else render :new end @@ -37,7 +37,7 @@ def update assign_person(@task) # raise if @task.save - redirect_to root_path + redirect_to tasks_path else render :new end @@ -46,19 +46,19 @@ def update def complete @task = Task.find(params[:id]) @task.update(completed_at: DateTime.now) - redirect_to root_path + redirect_to tasks_path end def uncomplete @task = Task.find(params[:id]) @task.update(completed_at: nil) - redirect_to root_path + redirect_to tasks_path end def destroy @task = Task.find(params[:id]) @task.destroy - redirect_to root_path + redirect_to tasks_path end private diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 5a7cd18c2..d1f77c381 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,8 +14,8 @@

SUPER AWESOME TO-DO LIST

<% end %> - -<%= yield %> - +
+ <%= yield %> +
diff --git a/app/views/layouts/home.html.erb b/app/views/layouts/home.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/people/_person.html.erb b/app/views/people/_person.html.erb index 08aff2e46..47709c835 100644 --- a/app/views/people/_person.html.erb +++ b/app/views/people/_person.html.erb @@ -1,8 +1,18 @@ <% person ||= @person %> -
- <%= link_to person_path(person.id) do %> -

<%= person.name %>

- <% end %> -

<%= person.uncompleted_tasks %> - -

+
" > +
+ +
+
+ <%= link_to person_path(person.id), class: "title" do %> +

<%= person.name %>

+ <% end %> +

Tasks To Do: <%= person.uncompleted_tasks %> + <% if request.env['PATH_INFO'] != people_path %> +

<%= person.email %>

+
+ <%= link_to "See All Tasks For #{person.name}", person_tasks_path(person.id), class: "all-tasks" %> + <% else %> +
+ <% end %> +
diff --git a/app/views/people/index.html.erb b/app/views/people/index.html.erb index eb4c71937..e8c2620d7 100644 --- a/app/views/people/index.html.erb +++ b/app/views/people/index.html.erb @@ -1,4 +1,3 @@ - <% @people.each do |person| %> - <%= render partial: 'person', object: person %> + <%= render partial: 'person', object: person %> <% end %> diff --git a/app/views/people/show.html.erb b/app/views/people/show.html.erb index 28e9f0078..930bda649 100644 --- a/app/views/people/show.html.erb +++ b/app/views/people/show.html.erb @@ -1,2 +1 @@ <%= render partial: 'person', object: @person %> -<%= link_to "See All Tasks For #{@person.name}", person_tasks_path(@person.id) %> diff --git a/app/views/tasks/home.html.erb b/app/views/tasks/home.html.erb new file mode 100644 index 000000000..22c5c69ae --- /dev/null +++ b/app/views/tasks/home.html.erb @@ -0,0 +1,10 @@ + <%= link_to tasks_path do %> +
+

Tasks

+
+ <% end %> + <%= link_to people_path do %> +
+

Users

+
+ <% end %> diff --git a/config/routes.rb b/config/routes.rb index 256a689cd..bfbc0acf8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ # You can have the root of your site routed with "root" # root 'welcome#index' - root 'tasks#index' + root 'tasks#home' get '/tasks' => 'tasks#index', as: 'tasks' post '/tasks' => 'tasks#create' get '/tasks/new' => 'tasks#new' diff --git a/db/migrate/20160426015450_add_email_to_people.rb b/db/migrate/20160426015450_add_email_to_people.rb new file mode 100644 index 000000000..36715f008 --- /dev/null +++ b/db/migrate/20160426015450_add_email_to_people.rb @@ -0,0 +1,5 @@ +class AddEmailToPeople < ActiveRecord::Migration + def change + add_column :people, :email, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 38faf68ab..cf40f9a50 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,12 +11,13 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160422182113) do +ActiveRecord::Schema.define(version: 20160426015450) do create_table "people", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "email" end create_table "tasks", force: :cascade do |t| diff --git a/db/seeds.rb b/db/seeds.rb index fef2f19db..7f702ca5b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -31,7 +31,7 @@ def random_time { title: "High Five Somebody You Don't Know", description: "", completed_at: random_time }, { title: "Plant Flowers", description: "", completed_at: random_time }, { title: "Call Mom", description: "", person_id: 2 }, - { title: "She worries, you know.", description: "" }, + { title: "Be the Best Teacher", description: "EVAAARRRRR", person_id: 3 }, { title: "Nap.", description: "", completed_at: random_time } ] @@ -40,9 +40,9 @@ def random_time end people = [ - { name: "Yokes" }, - { name: "Marla" }, - { name: "Apes" } + { name: "Yokes", email: "yokes@eggzactly.com" }, + { name: "Marla", email: "marmar@vollyballlyfe.com" }, + { name: "Apes", email: "dancing_dart@milkshakes.com" } ] people.each do |person| From 5ff12a584eb7a1a34ab8f13c671941a740ef8071 Mon Sep 17 00:00:00 2001 From: sophia Date: Mon, 25 Apr 2016 19:53:06 -0700 Subject: [PATCH 36/36] Dropdown selects current person if there is one instead of always selecting blank option; --- app/views/tasks/new.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/tasks/new.html.erb b/app/views/tasks/new.html.erb index 9211540df..bccbd1031 100644 --- a/app/views/tasks/new.html.erb +++ b/app/views/tasks/new.html.erb @@ -13,7 +13,11 @@ <% end %> <%= f.label :person do %> - <%= collection_select(:person, :person_id, Person.all, :id, :name, {include_blank: "Assign Task"}) %> + <% if @task.person_id %> + <%= collection_select(:person, :person_id, Person.all, :id, :name, {include_blank: "Assign Task", selected: @task.person.id }) %> + <% else %> + <%= collection_select(:person, :person_id, Person.all, :id, :name, {include_blank: "Assign Task"}) %> + <% end %> <% end %> <%= f.submit class: "button" %>