diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..f0318f016
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,25 @@
+# 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'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+/db/*.sqlite3-journal
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore Byebug command history file.
+.byebug_history
+
+
+# Ignore application configuration
+*application.yml
diff --git a/.rspec b/.rspec
new file mode 100644
index 000000000..83e16f804
--- /dev/null
+++ b/.rspec
@@ -0,0 +1,2 @@
+--color
+--require spec_helper
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 000000000..f65146e07
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,73 @@
+source 'https://rubygems.org'
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '~> 5.0.0'
+# Use sqlite3 as the database for Active Record
+gem 'pg'
+# Use Puma as the app server
+gem 'puma', '~> 3.0'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# Use CoffeeScript for .coffee assets and views
+gem 'coffee-rails', '~> 4.2'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'therubyracer', platforms: :ruby
+gem 'rails_12factor'
+gem 'simple_form'
+gem 'validates_timeliness', '~> 4.0'
+gem 'aws-sdk'
+gem 'paperclip'
+gem 'figaro'
+
+gem 'delayed_job_active_record'
+
+
+# Use jquery as the JavaScript library
+gem 'jquery-rails'
+# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.5'
+# Use Redis adapter to run Action Cable in production
+# gem 'redis', '~> 3.0'
+# Use ActiveModel has_secure_password
+gem 'bcrypt', '~> 3.1.7'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+group :test do
+ gem 'shoulda-matchers', '~> 3.1'
+ gem 'capybara'
+ gem 'launchy'
+ gem 'rails-controller-testing'
+ gem 'pry'
+end
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'byebug', platform: :mri
+ gem 'better_errors'
+ gem 'rspec-rails'
+ gem 'factory_girl_rails', '~> 4.0'
+ gem 'letter_opener'
+end
+
+gem 'faker'
+gem 'binding_of_caller'
+gem 'hirb'
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
+ gem 'web-console'
+ gem 'listen', '~> 3.0.5'
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+ gem 'spring-watcher-listen', '~> 2.0.0'
+ gem 'guard-rspec', require: false
+end
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 000000000..65480d935
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,312 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (5.0.0)
+ actionpack (= 5.0.0)
+ nio4r (~> 1.2)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.0.0)
+ actionpack (= 5.0.0)
+ actionview (= 5.0.0)
+ activejob (= 5.0.0)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.0.0)
+ actionview (= 5.0.0)
+ activesupport (= 5.0.0)
+ rack (~> 2.0)
+ rack-test (~> 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.0.0)
+ activesupport (= 5.0.0)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (5.0.0)
+ activesupport (= 5.0.0)
+ globalid (>= 0.3.6)
+ activemodel (5.0.0)
+ activesupport (= 5.0.0)
+ activerecord (5.0.0)
+ activemodel (= 5.0.0)
+ activesupport (= 5.0.0)
+ arel (~> 7.0)
+ activesupport (5.0.0)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (~> 0.7)
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ addressable (2.4.0)
+ arel (7.1.1)
+ aws-sdk (2.5.4)
+ aws-sdk-resources (= 2.5.4)
+ aws-sdk-core (2.5.4)
+ jmespath (~> 1.0)
+ aws-sdk-resources (2.5.4)
+ aws-sdk-core (= 2.5.4)
+ bcrypt (3.1.11)
+ better_errors (2.1.1)
+ coderay (>= 1.0.0)
+ erubis (>= 2.6.6)
+ rack (>= 0.9.0)
+ binding_of_caller (0.7.2)
+ debug_inspector (>= 0.0.1)
+ builder (3.2.2)
+ byebug (9.0.5)
+ capybara (2.7.1)
+ addressable
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
+ climate_control (0.0.3)
+ activesupport (>= 3.0)
+ cocaine (0.5.8)
+ climate_control (>= 0.0.3, < 1.0)
+ coderay (1.1.1)
+ coffee-rails (4.2.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.2.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.10.0)
+ concurrent-ruby (1.0.2)
+ debug_inspector (0.0.2)
+ delayed_job (4.1.2)
+ activesupport (>= 3.0, < 5.1)
+ delayed_job_active_record (4.1.1)
+ activerecord (>= 3.0, < 5.1)
+ delayed_job (>= 3.0, < 5)
+ diff-lcs (1.2.5)
+ erubis (2.7.0)
+ execjs (2.7.0)
+ factory_girl (4.7.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (4.7.0)
+ factory_girl (~> 4.7.0)
+ railties (>= 3.0.0)
+ faker (1.6.6)
+ i18n (~> 0.5)
+ ffi (1.9.14)
+ figaro (1.1.1)
+ thor (~> 0.14)
+ formatador (0.2.5)
+ globalid (0.3.7)
+ activesupport (>= 4.1.0)
+ guard (2.14.0)
+ formatador (>= 0.2.4)
+ listen (>= 2.7, < 4.0)
+ lumberjack (~> 1.0)
+ nenv (~> 0.1)
+ notiffany (~> 0.0)
+ pry (>= 0.9.12)
+ shellany (~> 0.0)
+ thor (>= 0.18.1)
+ guard-compat (1.2.1)
+ guard-rspec (4.7.3)
+ guard (~> 2.1)
+ guard-compat (~> 1.1)
+ rspec (>= 2.99.0, < 4.0)
+ hirb (0.7.3)
+ i18n (0.7.0)
+ jbuilder (2.6.0)
+ activesupport (>= 3.0.0, < 5.1)
+ multi_json (~> 1.2)
+ jmespath (1.3.1)
+ jquery-rails (4.1.1)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ launchy (2.4.3)
+ addressable (~> 2.3)
+ letter_opener (1.4.1)
+ launchy (~> 2.2)
+ listen (3.0.8)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
+ lumberjack (1.0.10)
+ mail (2.6.4)
+ mime-types (>= 1.16, < 4)
+ method_source (0.8.2)
+ mime-types (3.1)
+ mime-types-data (~> 3.2015)
+ mime-types-data (3.2016.0521)
+ mimemagic (0.3.2)
+ mini_portile2 (2.1.0)
+ minitest (5.9.0)
+ multi_json (1.12.1)
+ nenv (0.3.0)
+ nio4r (1.2.1)
+ nokogiri (1.6.8)
+ mini_portile2 (~> 2.1.0)
+ pkg-config (~> 1.1.7)
+ notiffany (0.1.1)
+ nenv (~> 0.1)
+ shellany (~> 0.0)
+ paperclip (5.0.0)
+ activemodel (>= 4.2.0)
+ activesupport (>= 4.2.0)
+ cocaine (~> 0.5.5)
+ mime-types
+ mimemagic (~> 0.3.0)
+ pg (0.18.4)
+ pkg-config (1.1.7)
+ pry (0.10.4)
+ coderay (~> 1.1.0)
+ method_source (~> 0.8.1)
+ slop (~> 3.4)
+ puma (3.6.0)
+ rack (2.0.1)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (5.0.0)
+ actioncable (= 5.0.0)
+ actionmailer (= 5.0.0)
+ actionpack (= 5.0.0)
+ actionview (= 5.0.0)
+ activejob (= 5.0.0)
+ activemodel (= 5.0.0)
+ activerecord (= 5.0.0)
+ activesupport (= 5.0.0)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 5.0.0)
+ sprockets-rails (>= 2.0.0)
+ rails-controller-testing (1.0.1)
+ actionpack (~> 5.x)
+ actionview (~> 5.x)
+ activesupport (~> 5.x)
+ rails-dom-testing (2.0.1)
+ activesupport (>= 4.2.0, < 6.0)
+ nokogiri (~> 1.6.0)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ 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 (5.0.0)
+ actionpack (= 5.0.0)
+ activesupport (= 5.0.0)
+ method_source
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (11.2.2)
+ rb-fsevent (0.9.7)
+ rb-inotify (0.9.7)
+ ffi (>= 0.5.0)
+ rspec (3.5.0)
+ rspec-core (~> 3.5.0)
+ rspec-expectations (~> 3.5.0)
+ rspec-mocks (~> 3.5.0)
+ rspec-core (3.5.2)
+ rspec-support (~> 3.5.0)
+ rspec-expectations (3.5.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.5.0)
+ rspec-mocks (3.5.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.5.0)
+ rspec-rails (3.5.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 3.5.0)
+ rspec-expectations (~> 3.5.0)
+ rspec-mocks (~> 3.5.0)
+ rspec-support (~> 3.5.0)
+ rspec-support (3.5.0)
+ sass (3.4.22)
+ sass-rails (5.0.6)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ shellany (0.0.1)
+ shoulda-matchers (3.1.1)
+ activesupport (>= 4.0.0)
+ simple_form (3.2.1)
+ actionpack (> 4, < 5.1)
+ activemodel (> 4, < 5.1)
+ slop (3.6.0)
+ spring (1.7.2)
+ spring-watcher-listen (2.0.0)
+ listen (>= 2.7, < 4.0)
+ spring (~> 1.2)
+ sprockets (3.7.0)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.1.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ thor (0.19.1)
+ thread_safe (0.3.5)
+ tilt (2.0.5)
+ timeliness (0.3.8)
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ uglifier (3.0.1)
+ execjs (>= 0.3.0, < 3)
+ validates_timeliness (4.0.2)
+ timeliness (~> 0.3.7)
+ web-console (3.3.1)
+ actionview (>= 5.0)
+ activemodel (>= 5.0)
+ debug_inspector
+ railties (>= 5.0)
+ websocket-driver (0.6.4)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.2)
+ xpath (2.0.0)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ aws-sdk
+ bcrypt (~> 3.1.7)
+ better_errors
+ binding_of_caller
+ byebug
+ capybara
+ coffee-rails (~> 4.2)
+ delayed_job_active_record
+ factory_girl_rails (~> 4.0)
+ faker
+ figaro
+ guard-rspec
+ hirb
+ jbuilder (~> 2.5)
+ jquery-rails
+ launchy
+ letter_opener
+ listen (~> 3.0.5)
+ paperclip
+ pg
+ pry
+ puma (~> 3.0)
+ rails (~> 5.0.0)
+ rails-controller-testing
+ rails_12factor
+ rspec-rails
+ sass-rails (~> 5.0)
+ shoulda-matchers (~> 3.1)
+ simple_form
+ spring
+ spring-watcher-listen (~> 2.0.0)
+ tzinfo-data
+ uglifier (>= 1.3.0)
+ validates_timeliness (~> 4.0)
+ web-console
+
+BUNDLED WITH
+ 1.12.5
diff --git a/Guardfile b/Guardfile
new file mode 100644
index 000000000..3215f0137
--- /dev/null
+++ b/Guardfile
@@ -0,0 +1,70 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+## Uncomment and set this to only include directories you want to watch
+# directories %w(app lib config test spec features) \
+# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
+
+## Note: if you are using the `directories` clause above and you are not
+## watching the project directory ('.'), then you will want to move
+## the Guardfile to a watched dir and symlink it back, e.g.
+#
+# $ mkdir config
+# $ mv Guardfile config/
+# $ ln -s config/Guardfile .
+#
+# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
+
+# Note: The cmd option is now required due to the increasing number of ways
+# rspec may be run, below are examples of the most common uses.
+# * bundler: 'bundle exec rspec'
+# * bundler binstubs: 'bin/rspec'
+# * spring: 'bin/rspec' (This will use spring if running and you have
+# installed the spring binstubs per the docs)
+# * zeus: 'zeus rspec' (requires the server to be started separately)
+# * 'just' rspec: 'rspec'
+
+guard :rspec, cmd: "bundle exec rspec" do
+ require "guard/rspec/dsl"
+ dsl = Guard::RSpec::Dsl.new(self)
+
+ # Feel free to open issues for suggestions and improvements
+
+ # RSpec files
+ rspec = dsl.rspec
+ watch(rspec.spec_helper) { rspec.spec_dir }
+ watch(rspec.spec_support) { rspec.spec_dir }
+ watch(rspec.spec_files)
+
+ # Ruby files
+ ruby = dsl.ruby
+ dsl.watch_spec_files_for(ruby.lib_files)
+
+ # Rails files
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
+ dsl.watch_spec_files_for(rails.app_files)
+ dsl.watch_spec_files_for(rails.views)
+
+ watch(rails.controllers) do |m|
+ [
+ rspec.spec.call("routing/#{m[1]}_routing"),
+ rspec.spec.call("controllers/#{m[1]}_controller"),
+ rspec.spec.call("acceptance/#{m[1]}")
+ ]
+ end
+
+ # Rails config changes
+ watch(rails.spec_helper) { rspec.spec_dir }
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
+
+ # Capybara features specs
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
+
+ # Turnip features and steps
+ watch(%r{^spec/acceptance/(.+)\.feature$})
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
+ end
+end
diff --git a/README.md b/README.md
index 24602872a..727921d7c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,13 @@
-danebook
-========
+##Alex Lach's Danebook
-This is the Real Dane Deal.
+"Danebook" is a Facebook-like social network site built during Viking Code School. The live application is available [here](https://lach-danebook.herokuapp.com/)!
+
+The app allows users to friend other users, write posts, upload photos, and comment and like on their own and others' content. The app was a chance to learn a number of different Rails functionalities, including:
+
+ - polymorphic relationships
+ - email notifications with Sendgrid
+ - nested forms
+ - Paperclip
+ - AWS
+
+To get started, you can make your own account or you can log in with email: alex@alex.com and password: password.
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 000000000..e85f91391
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative 'config/application'
+
+Rails.application.load_tasks
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
new file mode 100644
index 000000000..b16e53d6d
--- /dev/null
+++ b/app/assets/config/manifest.js
@@ -0,0 +1,3 @@
+//= link_tree ../images
+//= link_directory ../javascripts .js
+//= link_directory ../stylesheets .css
diff --git a/app/assets/images/.keep b/app/assets/images/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/assets/images/cover_photo.jpg b/app/assets/images/cover_photo.jpg
new file mode 100644
index 000000000..7db69ae78
Binary files /dev/null and b/app/assets/images/cover_photo.jpg differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
new file mode 100644
index 000000000..71a5afb74
--- /dev/null
+++ b/app/assets/javascripts/application.js
@@ -0,0 +1,16 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file. JavaScript code in this file should be added after the last require_* statement.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require jquery_ujs
+
+//= require_tree .
diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
new file mode 100644
index 000000000..71ee1e66d
--- /dev/null
+++ b/app/assets/javascripts/cable.js
@@ -0,0 +1,13 @@
+// Action Cable provides the framework to deal with WebSockets in Rails.
+// You can generate new channels where WebSocket features live using the rails generate channel command.
+//
+//= require action_cable
+//= require_self
+//= require_tree ./channels
+
+(function() {
+ this.App || (this.App = {});
+
+ App.cable = ActionCable.createConsumer();
+
+}).call(this);
diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/assets/javascripts/comments.coffee b/app/assets/javascripts/comments.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/comments.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/commentsScript.js b/app/assets/javascripts/commentsScript.js
new file mode 100644
index 000000000..44fbbcb08
--- /dev/null
+++ b/app/assets/javascripts/commentsScript.js
@@ -0,0 +1,5 @@
+var DANEBOOK = DANEBOOK || {}
+
+DANEBOOK.comments = {
+
+}
\ No newline at end of file
diff --git a/app/assets/javascripts/friendings.coffee b/app/assets/javascripts/friendings.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/friendings.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/friends.coffee b/app/assets/javascripts/friends.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/friends.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/likes.coffee b/app/assets/javascripts/likes.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/likes.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/newsfeed.coffee b/app/assets/javascripts/newsfeed.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/newsfeed.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/photos.coffee b/app/assets/javascripts/photos.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/photos.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/photosScript.js b/app/assets/javascripts/photosScript.js
new file mode 100644
index 000000000..9fdda5001
--- /dev/null
+++ b/app/assets/javascripts/photosScript.js
@@ -0,0 +1,20 @@
+var DANEBOOK = DANEBOOK || {}
+
+DANEBOOK.photos = {
+
+ init: function(){
+ DANEBOOK.photos.setCommentBoxListener();
+ },
+
+ setCommentBoxListener: function(){
+ $("#photo-header-bar").on("click",".comment-link", function(event) {
+ $(event.target).parents('#post-feedback').next().children(".write-comment").toggle(500);
+ });
+ }
+
+};
+
+
+$(document).ready(function() {
+ DANEBOOK.photos.init();
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/posts.coffee b/app/assets/javascripts/posts.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/posts.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/postsScript.js b/app/assets/javascripts/postsScript.js
new file mode 100644
index 000000000..2c9d7d67f
--- /dev/null
+++ b/app/assets/javascripts/postsScript.js
@@ -0,0 +1,28 @@
+var DANEBOOK = DANEBOOK || {}
+
+DANEBOOK.posts = {
+
+ init: function(){
+ DANEBOOK.posts.setCommentBoxListener();
+ },
+
+ setCommentBoxListener: function(){
+ $("#all-previous-posts").on("click",".comment-link", function(event) {
+ $(event.target).parents('#post-feedback').next().children(".write-comment").toggle(500);
+ });
+ },
+
+ setPostListener: function() {
+ $('#post-submit-button').click(function(event){
+ event.preventDefault();
+ var postText = $("#post_body").val();
+ DANEBOOK.ajax.sendPost(postText)
+ })
+ }
+
+};
+
+
+$(document).ready(function() {
+ DANEBOOK.posts.init();
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/sessions.coffee b/app/assets/javascripts/sessions.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/sessions.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/static_pages.coffee b/app/assets/javascripts/static_pages.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/static_pages.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/timelines.coffee b/app/assets/javascripts/timelines.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/timelines.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/users.coffee b/app/assets/javascripts/users.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/users.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..0ebd7fe82
--- /dev/null
+++ b/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/app/assets/stylesheets/comments.scss b/app/assets/stylesheets/comments.scss
new file mode 100644
index 000000000..3722c124e
--- /dev/null
+++ b/app/assets/stylesheets/comments.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the comments controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/edit_styles.css.scss b/app/assets/stylesheets/edit_styles.css.scss
new file mode 100644
index 000000000..3aed8458e
--- /dev/null
+++ b/app/assets/stylesheets/edit_styles.css.scss
@@ -0,0 +1,12 @@
+#single-profile-tab:last-of-type{
+ border-right: 2px solid black;
+}
+
+.form-control{
+ margin-bottom: 10px;
+}
+
+#save-changes{
+ margin-top: 20px;
+ margin-bottom: 20px;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/friendings.scss b/app/assets/stylesheets/friendings.scss
new file mode 100644
index 000000000..25e6461f0
--- /dev/null
+++ b/app/assets/stylesheets/friendings.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the friendings controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/friends.scss b/app/assets/stylesheets/friends.scss
new file mode 100644
index 000000000..8b8aa1c4d
--- /dev/null
+++ b/app/assets/stylesheets/friends.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the friends controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/friends_styles.css.scss b/app/assets/stylesheets/friends_styles.css.scss
new file mode 100644
index 000000000..618b7d2cb
--- /dev/null
+++ b/app/assets/stylesheets/friends_styles.css.scss
@@ -0,0 +1,30 @@
+
+
+
+
+#friend-profile{
+ border: 2px solid black;
+ margin-top: 10px;
+ margin-bottom: 10px;
+ h5{
+ display: inline-block;
+ position: absolute;
+ margin-left: 10px;
+ margin-top: 20px;
+ }
+ #friend-profile-picture{
+ height: 75px;
+ display: inline-block;
+ padding-top: 10px;
+ padding-bottom: 10px;
+ }
+ img{
+ height: 75px;
+ width: 75px;
+ object_fit: cover;
+ }
+ #unfriend-button{
+ float:right;
+ margin-top: 20px;
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/index.css.scss b/app/assets/stylesheets/index.css.scss
new file mode 100644
index 000000000..c44a1e9c7
--- /dev/null
+++ b/app/assets/stylesheets/index.css.scss
@@ -0,0 +1,81 @@
+body{
+ padding-bottom: 20px;
+}
+
+main{
+ transition: padding 500;
+}
+.navbar-default{
+ background-color: #2679E8;
+ border: 2px solid black;
+ .navbar-header {
+ background-color: #2679E8;
+ }
+
+ .form-group{
+ margin-bottom: -10px;
+ }
+ .navbar-brand{
+ color: white;
+ font-size: 35px;
+ line-height: 40px;
+ }
+ button {
+ background-color: #9FC5F8;
+ border: 2px solid black;
+
+ }
+
+ #log-in-button{
+ padding-top: 28px;
+ display: inline-block;
+ }
+
+ p{
+ color: white;
+ }
+
+ input{
+ margin-top: -10px;
+ border: 2px solid black;
+
+ }
+ .collapse {
+ background-color: #2679E8;
+ }
+}
+main {
+ #connect{
+ margin-top: 50px;
+ h5 {
+ color: #555;
+ line-height: 30px;
+ }
+ }
+ #sign-up{
+ input{
+ margin: 10px 0px;
+ }
+
+ .dropdown{
+ display: inline-block;
+ margin-right: 10px
+ }
+ label {
+ margin-top: 7px;
+ margin-right: 10px;
+ }
+ #sign-up-button{
+ background-color: #009E0F;
+ width: 100%;
+ border: 2px solid black;
+ }
+ }
+
+}
+@media only screen and (min-width: 768px) {
+ main {
+ margin-top: 64px; } }
+
+
+
diff --git a/app/assets/stylesheets/likes.scss b/app/assets/stylesheets/likes.scss
new file mode 100644
index 000000000..1f08d329f
--- /dev/null
+++ b/app/assets/stylesheets/likes.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the likes controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/newsfeed.scss b/app/assets/stylesheets/newsfeed.scss
new file mode 100644
index 000000000..a6665bf4b
--- /dev/null
+++ b/app/assets/stylesheets/newsfeed.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the newsfeed controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/photos.scss b/app/assets/stylesheets/photos.scss
new file mode 100644
index 000000000..dcd68e73d
--- /dev/null
+++ b/app/assets/stylesheets/photos.scss
@@ -0,0 +1,83 @@
+// Place all the styles related to the photos controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+#photo-holder{
+ height: 150px;
+ margin-top: 20px;
+ margin-bottom: 20px;
+ img{
+ height: 150px;
+ width: 150px;
+ margin: 0 auto;
+
+ }
+ p{
+ position: relative;
+ visibility: hidden;
+ height: 25%;
+ bottom: 55px;
+ left: 2px;
+ width: 146px;
+ margin: 0 auto;
+ text-align: center;
+ background-color: #333;
+ opacity: 0.8;
+ color: white;
+ line-height: 40px;
+ font-size: 12px;
+ }
+}
+
+#photo-holder:hover {
+ p{
+ visibility: visible;
+ }
+}
+
+#photo-show{
+ padding-top: 50px;
+ padding-bottom: 50px;
+}
+
+#photo-show img{
+ object-fit: contain;
+ width: 100%;
+ height: 400px;
+}
+
+#photo-feedback{
+ margin-left: 20px;
+}
+
+#photo-header-bar{
+ text-align: center;
+ margin-top: 10px;
+ border: 2px solid black;
+ background-color: #ccc;
+}
+
+#photo-comments-section{
+ background: #ccc;
+ border-top: 2px solid #999;
+ padding-top: 10px;
+ p, h6{
+ text-align: left;
+ margin-left: 10px;
+ }
+ a{
+ img{
+ height: 75px;
+ width: 75px;
+ }
+ }
+ textarea{
+ width: 100%;
+ border: 2px solid black;
+ margin-top: 25px;
+ margin-bottom: 5px;
+ padding-left: 10px;
+ }
+ padding-bottom: 10px;
+ }
+
diff --git a/app/assets/stylesheets/photos_styles.css.scss b/app/assets/stylesheets/photos_styles.css.scss
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/app/assets/stylesheets/photos_styles.css.scss
@@ -0,0 +1 @@
+
diff --git a/app/assets/stylesheets/posts.scss b/app/assets/stylesheets/posts.scss
new file mode 100644
index 000000000..66a9e6936
--- /dev/null
+++ b/app/assets/stylesheets/posts.scss
@@ -0,0 +1,7 @@
+// Place all the styles related to the posts controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.write-comment {
+ display: none;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss
new file mode 100644
index 000000000..7bef9cf82
--- /dev/null
+++ b/app/assets/stylesheets/sessions.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/static_pages.scss b/app/assets/stylesheets/static_pages.scss
new file mode 100644
index 000000000..91bfee2da
--- /dev/null
+++ b/app/assets/stylesheets/static_pages.scss
@@ -0,0 +1,28 @@
+// Place all the styles related to the static_pages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+
+nav{
+ background-color: #2D77E2
+}
+
+.navbar-brand{
+ background-color: #2D77E2
+}
+
+.navbar{
+ border: 2px solid black;
+ background-color: #2D77E2;
+ .navbar-brand{
+ color: white;
+ margin-right: -10px;
+ }
+ a{
+ color: white;
+
+ }
+
+
+
+}
diff --git a/app/assets/stylesheets/styles.css.scss b/app/assets/stylesheets/styles.css.scss
new file mode 100644
index 000000000..3cbad146f
--- /dev/null
+++ b/app/assets/stylesheets/styles.css.scss
@@ -0,0 +1,241 @@
+
+
+.form-control{
+}
+#cover-photo{
+ border: 2px solid black;
+ padding-right: 0;
+ padding-left: 0;
+ .img-responsive{
+ width: 100%;
+ height: 307px;
+ position: relative;
+ z-index: 0;
+ }
+
+}
+
+#remember-me{
+ display: inline-block
+}
+
+#profile-picture{
+ height: 150px;
+ position: relative;
+ overflow: hidden;
+ background-color: #ccc;
+ z-index: 4;
+ img{
+ position: absolute;
+ z-index: 0;
+ left: 50%;
+ top: 50%;
+ height: 100%;
+ width: auto;
+ -webkit-transform: translate(-50%,-50%);
+ -ms-transform: translate(-50%,-50%);
+ transform: translate(-50%,-50%);
+ }
+ margin-top: -135px;
+ margin-left: 5%;
+ margin-bottom: -5%;
+ border: solid black 2px;
+
+
+}
+
+
+.profile-name{
+ margin-top: -67px;
+ margin-left: 25%;
+ h2{
+ display: inline-block;
+ border-bottom: -2px;
+ color: white;
+
+ }
+
+}
+
+.edit-profile-name{
+ margin-top: -100px;
+ margin-left: 25%;
+ h2{
+ display: inline-block;
+ border-bottom: -2px;
+ color: white;
+
+ }
+
+}
+
+
+
+
+.navbar{
+ border: 2px solid black;
+ background-color: #2D77E2;
+ .navbar-brand{
+ color: white;
+ margin-right: -10px;
+ }
+ a{
+ color: white;
+
+ }
+
+
+}
+
+.btn-primary{
+ background-color: #2D77E2;
+}
+
+a{
+ color: #2D77E2;
+}
+
+
+
+#navbar-profile-link{
+ text-align: right;
+ padding-top: 8px;
+ padding-top: 8px;
+}
+
+#edit-profile-link{
+ text-align: right;
+}
+
+#profile-tabs{
+ border: 2px solid black;
+ border-top: 0px;
+}
+
+#single-profile-tab{
+ border-right: 2px solid black;
+ text-align: center;
+}
+
+#single-profile-tab-current{
+ background-color: #ccc;
+ border-right: 2px solid black;
+ text-align: center;
+}
+
+#single-profile-tab:first-of-type{
+ border-left: 2px solid black;
+}
+
+#edit-profile-tab{
+ border-right: 0px solid black;
+ h6{
+ text-align: center;
+ }
+}
+
+@media (max-width:768px){
+ #single-profile-tab{
+ border: 0px;
+ h6{
+ font-size: 16px;
+ }
+ }
+ #single-profile-tab:first-of-type{
+ border: 0px;
+ h6{
+ font-size: 16px;
+ }
+ }
+ #single-profile-tab-current{
+ border: 0px;
+ h6{
+ font-size: 16px;
+ line-height: 30px;
+ }
+
+ }
+ #edit-profile-tab{
+ h6{
+ font-size: 16px;
+ }
+ }
+ #profile-picture{
+ margin-top: -220px;
+ position: relative;
+ overflow: hidden;
+ border: 3px solid black;
+ margin-left: 8%;
+ img{
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ height: 100%;
+ width: auto;
+ -webkit-transform: translate(-50%,-50%);
+ -ms-transform: translate(-50%,-50%);
+ transform: translate(-50%,-50%);
+ }
+ h2{
+ padding-left: 20px;
+ display: block;
+ color: white;
+ text-align: center;
+ }
+ }
+
+}
+@media (min-width: 769px) and (max-width: 990px){
+ #profile-picture{
+ margin-top: -220px;
+ margin-left: 8%;
+ img{
+ display: block;
+ margin: auto;
+ }
+ h2{
+ display: block;
+ color: white;
+ text-align: center;
+
+ }
+ }
+}
+
+
+
+#header-bar{
+ text-align: center;
+ margin-top: 10px;
+ border: 2px solid black;
+ background-color: #ccc;
+ a{
+ float: right;
+ display: inline-block;
+ margin-top: -42px;
+ margin-bottom: 5px;
+ }
+ h2{
+ margin-top: 5px;
+ }
+}
+
+#basic{
+ border: 2px solid black;
+ border-top: 0px;
+}
+
+#profile-picture-form {
+ display: inline-block;
+}
+
+#profile-picture-image{
+ display: inline-block;
+}
+
+#profile-names{
+ display: inline-block;
+ margin-top: -250px;
+ margin-left: 25%;
+ z-index: 5;
+}
diff --git a/app/assets/stylesheets/timeline_styles.css.scss b/app/assets/stylesheets/timeline_styles.css.scss
new file mode 100644
index 000000000..a8a6a17dc
--- /dev/null
+++ b/app/assets/stylesheets/timeline_styles.css.scss
@@ -0,0 +1,153 @@
+#timeline-divider{
+ .timeline-content{
+ border: 2px solid black;
+ padding-top: 10px;
+ border-top: 0px;
+ h6{
+ text-align: center;
+ }
+ }
+ .timeline-title{
+ border: 2px solid black;
+ text-align: center;
+ background: #ccc;
+ }
+ .timeline-title:first-of-type{
+ margin-top: 10px;
+ }
+ img{
+ height: 100%;
+ width: 100%;
+ margin-bottom: 10px;
+ }
+
+ #photo-img-container{
+
+ width: 33.3333333%;
+ height: 75px;
+ overflow: hidden;
+ margin-bottom: 10px;
+ }
+
+ #photo-img{
+
+ object-fit: cover;
+ height: 75px;
+
+
+ }
+ p{
+ text-align: center;
+ }
+}
+
+#timeline-friends-photos{
+ margin-top: 10px;
+}
+
+#single-profile-tab-current{
+ border-left: 2px solid black;
+}
+
+@media (max-width: 768px){
+ #single-profile-tab-current{
+ border: 0px;
+ }
+}
+
+#post-container{
+ border: 2px solid black;
+ border-top: 0px;
+ textarea{
+ margin: 10px 0px;
+ width: 100%;
+ padding-left: 10px;
+ }
+}
+
+#post-button-container{
+ border: 2px solid black;
+ border-top: 0px;
+ background-color: #ccc;
+ a{
+ margin: 10px;
+ border: 2px solid black;
+ }
+}
+
+#previous-post-container{
+ border: 2px solid black;
+ margin-top: 20px;
+ #author-info{
+ img{
+ margin-top: 10px;
+ display: inline-block;
+ width: 75px;
+ height: 75px;
+ }
+ h6{
+ display: inline-block;
+ }
+ }
+ #post-content{
+ p{
+ text-align: left;
+ }
+ }
+ #post-feedback{
+ background: #ccc;
+ border-top: 2px solid black;
+ }
+ #comments-section{
+ background: #ccc;
+ border-top: 2px solid #999;
+ padding-top: 10px;
+ p{
+ text-align: left;
+ }
+ .comment-image{
+ height: 50px;
+ width: 75px;
+ }
+ textarea{
+ width: 100%;
+ border: 2px solid black;
+ margin-top: 25px;
+ margin-bottom: 5px;
+ padding-left: 10px;
+ }
+ padding-bottom: 10px;
+ }
+}
+
+
+
+
+#timeline-friend-img-container{
+
+ height: 75px;
+ overflow: hidden;
+ margin-bottom: 5px;
+ }
+
+ #timeline-friend-img{
+
+ object-fit: cover;
+ height: 75px;
+
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/assets/stylesheets/timelines.scss b/app/assets/stylesheets/timelines.scss
new file mode 100644
index 000000000..92f39ca74
--- /dev/null
+++ b/app/assets/stylesheets/timelines.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the timelines controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss
new file mode 100644
index 000000000..e379d61e3
--- /dev/null
+++ b/app/assets/stylesheets/users.scss
@@ -0,0 +1,18 @@
+// Place all the styles related to the users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+#error_explanation {
+ color: red
+}
+
+.search-bar{
+ margin-top: 30px;
+}
+
+.logout{
+ margin-top: 18px;
+ color: white;
+ font-size: 16px;
+}
+
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
new file mode 100644
index 000000000..d67269728
--- /dev/null
+++ b/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
new file mode 100644
index 000000000..0ff5442f4
--- /dev/null
+++ b/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
new file mode 100644
index 000000000..d66db5c80
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,74 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery with: :exception
+ before_action :require_login
+
+
+
+ private
+
+ def sign_in(user)
+ user.regenerate_auth_token
+ cookies[:auth_token] = user.auth_token
+ @current_user = user
+ end
+
+ def permanent_sign_in(user)
+ user.regenerate_auth_token
+ cookies.permanent[:auth_token] = user.auth_token
+ @current_user = user
+ end
+
+ def sign_out
+ @current_user = nil
+ cookies.delete(:auth_token)
+ end
+
+ def current_user
+ @current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]
+ end
+ helper_method :current_user
+
+ def signed_in_user?
+ !!current_user
+ end
+ helper_method :signed_in_user?
+
+ def require_login
+ unless signed_in_user?
+ flash[:danger] = "Not authorized, please sign in!"
+ redirect_to root_path
+ end
+ end
+
+ def real_user_id
+ params[:user_id] || params[:id] || current_user.id
+ end
+ helper_method :real_user_id
+
+ def real_user
+ User.find(real_user_id)
+ end
+ helper_method :real_user
+
+ def user_header_name(user_id)
+ "#{User.find(user_id).profile.first_name} #{User.find(user_id).profile.last_name}" if User.find(user_id).profile
+ end
+ helper_method :user_header_name
+
+ def require_current_user
+ unless params[:id] == current_user.id.to_s || params[:user_id] == current_user.id.to_s
+ flash[:danger] = "You're not authorized for that action!"
+ redirect_to root_path
+ end
+ end
+
+ def find_like_id(user_id, likeable_id, likeable_type)
+ like = Like.where("user_id = ? AND likeable_id = ? AND likeable_type = ?", user_id, likeable_id, likeable_type)
+ like.ids[0]
+ end
+ helper_method :find_like_id
+
+
+
+
+end
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
new file mode 100644
index 000000000..1b344b1cd
--- /dev/null
+++ b/app/controllers/comments_controller.rb
@@ -0,0 +1,45 @@
+class CommentsController < ApplicationController
+
+
+ def create
+ @new_comment = current_user.comments_written.new(comment_params)
+ if @new_comment.save
+ @content_id = comment_params[:commentable_id];
+ @content_type = comment_params[:commentable_type];
+ if comment_params[:commentable_type] == "Post"
+ @object_maker = Post.find(comment_params[:commentable_id]).author
+ else
+ @object_maker = Photo.find(comment_params[:commentable_id]).user
+ end
+ if @object_maker != current_user
+ User.comment_email(@object_maker.id, current_user.id, @new_comment.id, params[:commentable_id])
+ end
+ respond_to :js
+ else
+ flash[:danger] = "Your comment could not be posted"
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+
+ def destroy
+ @comment = Comment.find(params[:id])
+ if current_user.id == @comment.user_id && @comment.destroy!
+ flash[:success] = "Your comment has been deleted"
+ redirect_back(fallback_location: root_path)
+ else
+ flash[:danger] = "Your comment could not be deleted"
+ redirect_back(fallback_location: root_path)
+ end
+
+ end
+
+
+ private
+
+ def comment_params
+ params.require(:comment).permit(:body, :commentable_id, :commentable_type)
+ end
+
+
+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/friendings_controller.rb b/app/controllers/friendings_controller.rb
new file mode 100644
index 000000000..0755eceec
--- /dev/null
+++ b/app/controllers/friendings_controller.rb
@@ -0,0 +1,31 @@
+class FriendingsController < ApplicationController
+
+
+ def create
+ friending_recipient = User.find(params[:friended_id])
+
+ if current_user.friended_users << friending_recipient && current_user != friending_recipient
+ flash[:success] = "You've friended #{friending_recipient.profile.first_name}"
+ redirect_back(fallback_location: root_path)
+ else
+ flash[:danger] = "Could not friend #{friending_recipient.profile.first_name}"
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+
+ def destroy
+ friending_recipient = User.find(params[:id])
+ if current_user.friended_users.delete(friending_recipient)
+ flash[:success] = "You've unfriended #{friending_recipient.profile.first_name}"
+ redirect_back(fallback_location: root_path)
+ else
+ flash[:danger] = "Could not unfriend #{friending_recipient.profile.first_name}"
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ private
+
+
+end
diff --git a/app/controllers/friends_controller.rb b/app/controllers/friends_controller.rb
new file mode 100644
index 000000000..824bfa309
--- /dev/null
+++ b/app/controllers/friends_controller.rb
@@ -0,0 +1,7 @@
+class FriendsController < ApplicationController
+
+ def index
+ @user = User.find(params[:user_id])
+ @friends = @user.friends
+ end
+end
diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb
new file mode 100644
index 000000000..7b7e63039
--- /dev/null
+++ b/app/controllers/likes_controller.rb
@@ -0,0 +1,44 @@
+class LikesController < ApplicationController
+
+
+
+
+ def create
+ @like = Like.new(like_params)
+ @like.user_id = current_user.id
+ @content_id = like_params[:likeable_id]
+ @content_type = like_params[:likeable_type]
+ if @like.save!
+ @id = @like.id
+ respond_to :js
+ else
+ flash.now[:danger] = "Could not like that post"
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ def destroy
+ @like = Like.find(params[:id])
+ @content_id = @like.likeable_id
+ @content_type = @like.likeable_type
+ if current_user.id == @like.user_id && @like.destroy
+ respond_to :js
+ else
+ flash.now[:danger] = "Coult not unlike that post"
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ private
+
+ def like_params
+ params.permit(:likeable_type, :likeable_id)
+ end
+
+
+
+
+
+
+
+end
diff --git a/app/controllers/newsfeed_controller.rb b/app/controllers/newsfeed_controller.rb
new file mode 100644
index 000000000..0823dde32
--- /dev/null
+++ b/app/controllers/newsfeed_controller.rb
@@ -0,0 +1,8 @@
+class NewsfeedController < ApplicationController
+
+ def index
+ @posts = current_user.friends_posts
+ @comment = current_user.comments_written.new
+ end
+
+end
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
new file mode 100644
index 000000000..644de9b56
--- /dev/null
+++ b/app/controllers/photos_controller.rb
@@ -0,0 +1,54 @@
+class PhotosController < ApplicationController
+
+
+ def index
+ @user = User.find(params[:id])
+ @photos = @user.photos
+ end
+
+ def new
+ @photo = current_user.photos.build
+ end
+
+ def show
+ @photo = Photo.find(params[:id])
+ @photo_id = @photo.id.to_s
+ @user_id = @photo.user_id
+ @comment = Comment.new
+ end
+
+ def create
+ @photo = current_user.photos.build(photo_params)
+ if @photo.save
+ flash[:success] = "Your photo has been uploaded!"
+ redirect_to photos_path(id: current_user)
+ else
+ flash[:danger] = "Your photo could not be uploaded"
+ redirect_to photos_path(id: current_user)
+ end
+ end
+
+
+ def update
+
+ end
+
+ def destroy
+ @photo = Photo.find(params[:id])
+ if @photo.user == current_user && @photo.destroy
+ flash[:success] = "Photo deleted"
+ redirect_to user_path(current_user)
+ else
+ flash[:error] = "Could not delete photo"
+ redirect_back(fallback_location: root_path)
+ end
+
+ end
+
+ private
+
+ def photo_params
+ params.require(:photo).permit(:image)
+ end
+
+end
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
new file mode 100644
index 000000000..da9bf6d6a
--- /dev/null
+++ b/app/controllers/posts_controller.rb
@@ -0,0 +1,41 @@
+class PostsController < ApplicationController
+
+ def create
+ @new_post = current_user.posts_written.new(post_params)
+ @new_post.post_receiver_id = session[:receiver_id]
+ if @new_post.save
+ @post = current_user.posts_written.new
+ @comment = current_user.comments_written.new
+ respond_to :js
+ else
+ flash[:danger] = "Your message could not be posted :("
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ def edit
+
+ end
+
+ def update
+
+ end
+
+ def destroy
+ @post = Post.find(params[:id])
+ if current_user.id == @post.post_author_id && @post.destroy
+ flash[:success] = "Your post has been deleted"
+ redirect_back(fallback_location: root_path)
+ else
+ flash[:danger] = "Your post could not be deleted"
+ redirect_back(fallback_location: root_path)
+ end
+ end
+
+ private
+
+ def post_params
+ params.require(:post).permit(:post_author_id, :post_receiver_id, :body)
+ end
+
+end
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
new file mode 100644
index 000000000..6dbdacebf
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,25 @@
+class SessionsController < ApplicationController
+ skip_before_action :require_login, only: [:new, :create]
+
+ def create
+ @user = User.find_by_email(params[:email])
+ if @user && @user.authenticate(params[:password])
+ if params[:remember_me]
+ permanent_sign_in(@user)
+ else
+ sign_in(@user)
+ end
+ flash[:success] = "You have successfully signed in"
+ redirect_to newsfeed_index_path
+ else
+ flash[:danger] = "Incorrect log-in information. Please try again"
+ redirect_to new_user_path
+ end
+ end
+
+ def destroy
+ sign_out
+ flash[:success] = "You've successfully signed out"
+ redirect_to new_user_path
+ end
+end
diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb
new file mode 100644
index 000000000..19579d670
--- /dev/null
+++ b/app/controllers/static_pages_controller.rb
@@ -0,0 +1,29 @@
+class StaticPagesController < ApplicationController
+ skip_before_action :require_login, only: [:home]
+
+
+
+ def home
+ if signed_in_user?
+ redirect_to user_timeline_path(current_user)
+ end
+
+ end
+
+ def timeline
+
+ end
+
+ def photos
+
+ end
+
+ def about_edit
+
+ end
+
+ def about
+
+
+ end
+end
diff --git a/app/controllers/timelines_controller.rb b/app/controllers/timelines_controller.rb
new file mode 100644
index 000000000..f341d24f8
--- /dev/null
+++ b/app/controllers/timelines_controller.rb
@@ -0,0 +1,13 @@
+class TimelinesController < ApplicationController
+
+ def show
+ if User.find_by_id(real_user_id) == nil
+ flash[:danger] = "Sorry, that user does not exist. But if you sign up your friends, someday we'll get there!"
+ redirect_to user_timeline_path(current_user)
+ end
+ @post = current_user.posts_written.new
+ @comment = current_user.comments_written.new
+ @timeline_user = User.find(params[:user_id])
+ session[:receiver_id] = @timeline_user.id
+ end
+end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
new file mode 100644
index 000000000..881c95ce6
--- /dev/null
+++ b/app/controllers/users_controller.rb
@@ -0,0 +1,85 @@
+class UsersController < ApplicationController
+ skip_before_action :require_login, only: [:new, :create]
+ before_action :require_current_user, only: [:edit, :update, :destroy]
+
+ def index
+ if params[:search]
+ @users = User.search(params[:search], current_user.id)
+ @search_terms = params[:search]
+ else
+ @users = User.all
+ end
+ end
+
+ def new
+ @user = User.new
+ if signed_in_user?
+ redirect_to newsfeed_index_path
+ end
+ end
+
+ def create
+ @user = User.new(user_params)
+ if @user.save
+ User.welcome_email(@user.id)
+ sign_in(@user)
+ flash[:success] = "Your account has been created"
+ redirect_to user_timeline_path(@user)
+ else
+ flash.now[:danger] = "Account could not be created"
+ render :new
+ end
+ end
+
+ def show
+ if User.find_by_id(real_user_id) == nil
+ flash[:danger] = "Sorry, that user does not exist. But if you sign up your friends, someday we'll get there!"
+ redirect_to user_timeline_path(current_user)
+ end
+ @user = User.find(params[:id])
+ end
+
+ def edit
+ @user = current_user
+ end
+
+ def update
+ @user = current_user
+ if @user.update(user_params)
+ flash[:success] = "Your profile has been updated"
+ redirect_to user_path(current_user)
+ else
+ flash.now[:danger] = "Your profile could not be updated"
+ render :edit
+ end
+ end
+
+ def destroy
+
+ end
+
+
+ private
+
+ def user_params
+ params.require(:user).permit(:email,
+ :password,
+ :password_confirmation,
+ {:profile_attributes => [
+ :first_name,
+ :last_name,
+ :birthday,
+ :gender,
+ :college,
+ :hometown,
+ :currently_lives,
+ :telephone,
+ :words_to_live_by,
+ :about_me,
+ :profile_picture,
+ :cover_photo_id,
+ :prof_photo_id
+ ]})
+ 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/comments_helper.rb b/app/helpers/comments_helper.rb
new file mode 100644
index 000000000..0ec9ca5f2
--- /dev/null
+++ b/app/helpers/comments_helper.rb
@@ -0,0 +1,2 @@
+module CommentsHelper
+end
diff --git a/app/helpers/friendings_helper.rb b/app/helpers/friendings_helper.rb
new file mode 100644
index 000000000..fce356995
--- /dev/null
+++ b/app/helpers/friendings_helper.rb
@@ -0,0 +1,2 @@
+module FriendingsHelper
+end
diff --git a/app/helpers/friends_helper.rb b/app/helpers/friends_helper.rb
new file mode 100644
index 000000000..0b69e9bce
--- /dev/null
+++ b/app/helpers/friends_helper.rb
@@ -0,0 +1,2 @@
+module FriendsHelper
+end
diff --git a/app/helpers/likes_helper.rb b/app/helpers/likes_helper.rb
new file mode 100644
index 000000000..a78a75964
--- /dev/null
+++ b/app/helpers/likes_helper.rb
@@ -0,0 +1,2 @@
+module LikesHelper
+end
diff --git a/app/helpers/newsfeed_helper.rb b/app/helpers/newsfeed_helper.rb
new file mode 100644
index 000000000..bf0034e96
--- /dev/null
+++ b/app/helpers/newsfeed_helper.rb
@@ -0,0 +1,2 @@
+module NewsfeedHelper
+end
diff --git a/app/helpers/photos_helper.rb b/app/helpers/photos_helper.rb
new file mode 100644
index 000000000..0a10d472b
--- /dev/null
+++ b/app/helpers/photos_helper.rb
@@ -0,0 +1,2 @@
+module PhotosHelper
+end
diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb
new file mode 100644
index 000000000..a7b8cec89
--- /dev/null
+++ b/app/helpers/posts_helper.rb
@@ -0,0 +1,2 @@
+module PostsHelper
+end
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
new file mode 100644
index 000000000..309f8b2eb
--- /dev/null
+++ b/app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
diff --git a/app/helpers/static_pages_helper.rb b/app/helpers/static_pages_helper.rb
new file mode 100644
index 000000000..2d63e79e6
--- /dev/null
+++ b/app/helpers/static_pages_helper.rb
@@ -0,0 +1,2 @@
+module StaticPagesHelper
+end
diff --git a/app/helpers/timelines_helper.rb b/app/helpers/timelines_helper.rb
new file mode 100644
index 000000000..1f1a4f076
--- /dev/null
+++ b/app/helpers/timelines_helper.rb
@@ -0,0 +1,2 @@
+module TimelinesHelper
+end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
new file mode 100644
index 000000000..2310a240d
--- /dev/null
+++ b/app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
new file mode 100644
index 000000000..a009ace51
--- /dev/null
+++ b/app/jobs/application_job.rb
@@ -0,0 +1,2 @@
+class ApplicationJob < ActiveJob::Base
+end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
new file mode 100644
index 000000000..286b2239d
--- /dev/null
+++ b/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: 'from@example.com'
+ layout 'mailer'
+end
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
new file mode 100644
index 000000000..436316f1e
--- /dev/null
+++ b/app/mailers/user_mailer.rb
@@ -0,0 +1,15 @@
+class UserMailer < ApplicationMailer
+ default :from => "support@danebook.com"
+
+ def welcome(user)
+ @user = user
+ mail(to: @user.email, subject: "Welcome to Danebook!")
+ end
+
+ def comment(owner_user, comment_user, comment)
+ @comment = comment.body
+ @owner_user = owner_user
+ @comment_user = comment_user
+ mail(to: @owner_user.email, subject: "Someone commented on your post!")
+ end
+end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
new file mode 100644
index 000000000..cf91736c6
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,29 @@
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+
+
+ def real_likes
+ Like.where("likeable_id = ? AND likeable_type = ?", self.id, self.class.name)
+ end
+
+ def display_likes
+ likes = self.real_likes
+ like_total = likes.count
+ liker_array = []
+ likes[0..2].each do |like|
+ liker_array << like.user_id
+ like_total -= 1
+ end
+ if like_total == 1
+ return_string = "and 1 other person like this"
+ elsif like_total > 1
+ return_string = "and #{like_total} others like this"
+ elsif liker_array.length == 1
+ return_string = "likes this"
+ else
+ return_string = "like this"
+ end
+ [liker_array, return_string]
+ end
+
+end
diff --git a/app/models/comment.rb b/app/models/comment.rb
new file mode 100644
index 000000000..e27027de7
--- /dev/null
+++ b/app/models/comment.rb
@@ -0,0 +1,7 @@
+class Comment < ApplicationRecord
+ belongs_to :user, :foreign_key => :user_id
+ belongs_to :commentable, :polymorphic => true
+ has_many :comments, :as => :commentable
+ has_many :likes, :as => :likeable, :source => :likeable_id, source_type: "Comment"
+
+end
diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/models/friending.rb b/app/models/friending.rb
new file mode 100644
index 000000000..fe517a6b5
--- /dev/null
+++ b/app/models/friending.rb
@@ -0,0 +1,7 @@
+class Friending < ApplicationRecord
+
+ belongs_to :friend_initiator, :foreign_key => :friender_id, :class_name => "User"
+ belongs_to :friend_recipient, :foreign_key => :friended_id, :class_name => "User"
+
+ validates :friended_id, :uniqueness => { :scope => :friender_id }
+end
diff --git a/app/models/like.rb b/app/models/like.rb
new file mode 100644
index 000000000..b1747882e
--- /dev/null
+++ b/app/models/like.rb
@@ -0,0 +1,19 @@
+class Like < ApplicationRecord
+ belongs_to :user, :foreign_key => :user_id
+ belongs_to :likeable, :polymorphic => true
+
+
+
+ private
+
+ def self.find_likable_type(path)
+ array = path.split("/")
+ if array[1] == "comments"
+ return "Comment"
+ elsif array[1] == "posts"
+ return "Post"
+ end
+ end
+
+
+end
diff --git a/app/models/photo.rb b/app/models/photo.rb
new file mode 100644
index 000000000..6c2900921
--- /dev/null
+++ b/app/models/photo.rb
@@ -0,0 +1,11 @@
+class Photo < ApplicationRecord
+ has_one :post, :as => :postable
+ has_one :used_as_profile, class_name: "Profile", foreign_key: :prof_photo_id, dependent: :nullify
+ has_one :used_as_cover, class_name: "Profile", foreign_key: :cover_photo_id, dependent: :nullify
+ has_many :comments, :as => :commentable
+ has_many :likes, :as => :likeable, :source => :likeable_id, source_type: "Photo"
+ belongs_to :user
+
+ has_attached_file :image, :styles => { :index => "150x120", :timeline => "60x50", :profile => "150x150", :post => "75x75", :cover => "990x300" }, default_url: "https://s3.amazonaws.com/viking_education/web_development/web_app_eng/icon_photo_small.png"
+ validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
+end
diff --git a/app/models/post.rb b/app/models/post.rb
new file mode 100644
index 000000000..e52ac36c8
--- /dev/null
+++ b/app/models/post.rb
@@ -0,0 +1,12 @@
+class Post < ApplicationRecord
+ belongs_to :author, :foreign_key => :post_author_id, :class_name => "User"
+ belongs_to :receiver, :foreign_key => :post_receiver_id, :class_name => "User", optional: true
+ has_many :comments, :as => :commentable
+ has_many :likes, :as => :likeable, :source => :likeable_id, source_type: "Post"
+ validates :body, presence: true
+
+
+
+
+
+end
diff --git a/app/models/post_text.rb b/app/models/post_text.rb
new file mode 100644
index 000000000..2b258a091
--- /dev/null
+++ b/app/models/post_text.rb
@@ -0,0 +1,3 @@
+class PostText < ApplicationRecord
+ has_one :post, :as => :postable
+end
diff --git a/app/models/profile.rb b/app/models/profile.rb
new file mode 100644
index 000000000..902125675
--- /dev/null
+++ b/app/models/profile.rb
@@ -0,0 +1,43 @@
+class Profile < ApplicationRecord
+ belongs_to :user, optional: true
+ belongs_to :prof_photo, optional: true, class_name: "Photo"
+ belongs_to :cover_photo, optional: true, class_name: "Photo"
+ accepts_nested_attributes_for :cover_photo
+ accepts_nested_attributes_for :prof_photo
+ validates :first_name,
+ :length => {:maximum => 40}, allow_blank: true, allow_nil: true
+
+ validates :last_name,
+ :length => {:maximum => 40}, allow_blank: true, allow_nil: true
+
+ validates :college,
+ :length => {:maximum => 40}, allow_blank: true, allow_nil: true
+
+ validates :hometown,
+ :length => {:maximum => 40}, allow_blank: true, allow_nil: true
+
+ validates :currently_lives,
+ :length => {:maximum => 40}, allow_blank: true, allow_nil: true
+
+ validates :words_to_live_by,
+ :length => {:maximum => 300}, allow_blank: true, allow_nil: true
+
+ validates :about_me,
+ :length => {:maximum => 300}, allow_blank: true, allow_nil: true
+
+ validates_date :birthday,
+ :message => "Please enter a real date",
+ :before => lambda {Date.current},
+ :before_message => "Get real. You can't be born in the future!",
+ allow_nil: true,
+ allow_blank: true
+ validates :telephone,
+ :numericality => true,
+ :length => { :minimum => 10, :maximum => 15 },
+ :on => :update,
+ allow_nil: true,
+ allow_blank: true
+
+
+
+end
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 000000000..573ef1f2e
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,105 @@
+class User < ApplicationRecord
+ before_create :generate_token
+
+ has_secure_password
+ validates :email,
+ :presence => {:message => "Please enter an email"},
+ :format => { :with => /@/, :message => "Please enter a valid email address" },
+ :uniqueness => true
+ validates :password,
+ :length => {:minimum => 6},
+ :on => :create
+ has_one :profile, dependent: :destroy
+
+ has_many :photos, foreign_key: :user_id
+
+
+
+ accepts_nested_attributes_for :profile, :update_only => true
+ has_many :posts_written, :foreign_key => :post_author_id, :class_name => "Post"
+ has_many :posts_received, :foreign_key => :post_receiver_id, :class_name => "Post"
+ has_many :comments_written, :foreign_key => :user_id, :class_name => "Comment"
+ has_many :likes_given, :foreign_key => :user_id, :class_name => "Like"
+ has_many :initiated_friendings, :foreign_key => :friender_id, :class_name => "Friending"
+ has_many :friended_users, :through => :initiated_friendings, :source => :friend_recipient
+
+ has_many :received_friendings, :foreign_key => :friended_id, :class_name => "Friending"
+ has_many :users_friended_by, :through => :received_friendings, :source => :friend_initiator
+
+ def generate_token
+ begin
+ self[:auth_token] = SecureRandom.urlsafe_base64
+ end while User.exists?(:auth_token => self[:auth_token])
+ end
+
+ def regenerate_auth_token
+ self.auth_token = nil
+ generate_token
+ self.save!
+ end
+
+ def likes_post?(id, type)
+ self.likes_given.where("likeable_id = ? AND likeable_type = ?", id, type)
+ end
+
+ def friend_count
+ self.friends.size
+ end
+
+ def friends
+ (self.friended_users + self.users_friended_by).uniq
+ end
+
+ def self.search(search, id)
+ users = []
+ if search
+ all_terms = search.split
+ all_terms.each do |term|
+ term_users = User.joins(:profile).where('first_name ILIKE ? OR last_name ILIKE ?', "%#{term}%", "%#{term}%")
+ term_users.each do |term_user|
+ users << term_user
+ end
+ end
+ users.uniq
+ else
+ User.all
+ end
+ end
+
+ def friends_posts
+ friends = self.friends
+ Post.where(:post_author_id => friends).order(created_at: :desc)
+ end
+
+ def profile_picture
+ photo = self.profile.prof_photo
+ photo.image
+ end
+
+ def cover_photo
+ photo = self.profile.cover_photo
+ photo.image
+ end
+ private
+ class << self
+ def welcome_email(id)
+ user = User.find(id)
+ UserMailer.welcome(user).deliver
+ end
+
+ handle_asynchronously :welcome_email, run_at: Proc.new { 5.seconds.from_now }
+
+ def comment_email(owner_id, commenter_id, comment_id, post_id)
+ owner_user = User.find(owner_id)
+ comment_user = User.find(commenter_id)
+ comment = Comment.find(comment_id)
+ UserMailer.comment(owner_user, comment_user, comment).deliver!
+ end
+
+ handle_asynchronously :comment_email, run_at: Proc.new {5.seconds.from_now}
+
+ end
+
+
+
+end
diff --git a/app/models/video.rb b/app/models/video.rb
new file mode 100644
index 000000000..4ea6b2742
--- /dev/null
+++ b/app/models/video.rb
@@ -0,0 +1,3 @@
+class Video < ApplicationRecord
+ has_one :post, :as => :postable
+end
diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb
new file mode 100644
index 000000000..c867f6cb1
--- /dev/null
+++ b/app/views/comments/create.js.erb
@@ -0,0 +1,8 @@
+console.log("Hello!");
+var type = "<%= @content_type %>";
+var id = "<%= @content_id %>";
+var post = ($("[" + type +"-id = " + id + "]"));
+var newComment = "<%= escape_javascript(render partial: 'shared/comment_box', locals: {comment: @new_comment}) %>";
+post.children('#comments-section, #photo-comments-section').prepend(newComment);
+$('#comment_body').val("");
+console.log("Goodbye!");
diff --git a/app/views/friends/index.html.erb b/app/views/friends/index.html.erb
new file mode 100644
index 000000000..4409653b0
--- /dev/null
+++ b/app/views/friends/index.html.erb
@@ -0,0 +1,25 @@
+
+Friends
+
<%= comment.body %>
+Uploaded on <%= photo.created_at.to_date %>
+ <% end %> +<%= comment.body %>
+<%= post.body %>
+Birthday:
+July 31st, 1980
+College:
+Hogwarts College
+Hometown:
+Godrick's Hollow, England
+Currently Lives:
+Godrick's Hollow, England
+Email:
+harry_potter@hogwarts.edu
+Telephone:
+555-123-4567
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+Birthday:
+July 31st, 1980
+College:
+Hometown:
+Currently Lives:
+Email:
+harry_potter@hogwarts.edu
+Telephone:
+Born on: July 31st, 1980
+Went to school at: Hogwarts
+Hometown: Godrick's Hollow, England
+Currently Lives: Godrick's Hollow
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in
+ +Born on: <%= @timeline_user.profile.birthday.strftime("%m/%d/%Y") if @timeline_user.profile.birthday != nil %>
+Went to school at: <%= @timeline_user.profile.college %>
+Hometown: <%= @timeline_user.profile.hometown %>
+Currently Lives: <%= @timeline_user.profile.currently_lives %>
+A user with the mail <%= @comment_user.email %> commented on one of your posts or photos. They said: "<%= @comment %>".
+ +<%= link_to "Click here", user_timeline_url(@owner_user) %> to see more action on your timeline
+ diff --git a/app/views/user_mailer/comment.text.erb b/app/views/user_mailer/comment.text.erb new file mode 100644 index 000000000..9f9ec7875 --- /dev/null +++ b/app/views/user_mailer/comment.text.erb @@ -0,0 +1,5 @@ +Good news! + +A user with the mail <%= @comment_user.email %> commented on one of your posts. They said: <%= @comment %>. + +<%= link_to "Click here", user_timeline_url(@owner_user) %> to see more action on your timeline. \ No newline at end of file diff --git a/app/views/user_mailer/welcome.html.erb b/app/views/user_mailer/welcome.html.erb new file mode 100644 index 000000000..1c0ded67a --- /dev/null +++ b/app/views/user_mailer/welcome.html.erb @@ -0,0 +1,9 @@ ++ Hello <%= @user.email %>, welcome to Danebook! +
+ ++ To view your profile and start making changes, go to <%= link_to "#{user_url(@user.id)}", user_url(@user.id) %> +
\ No newline at end of file diff --git a/app/views/user_mailer/welcome.text.erb b/app/views/user_mailer/welcome.text.erb new file mode 100644 index 000000000..525bf122e --- /dev/null +++ b/app/views/user_mailer/welcome.text.erb @@ -0,0 +1,5 @@ +Welcome! + +Hi <%= @user.email %>, welcome to Danebook! + +To view your profile and start making changes, go to <%= link_to "#{user_url(@user.id)}", user_url(@user.id) %> \ No newline at end of file diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 000000000..981ca07e3 --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,120 @@ + +Birthday:
+College:
+Hometown:
+Currently Lives:
+Email:
+Telephone:
+Birthday:
+<%= @user.profile.birthday.strftime("%m/%d/%Y") if real_user.profile.birthday %>
+College:
+<%= @user.profile.college %>
+Hometown:
+<%= @user.profile.hometown %>
+Currently Lives:
+<%= @user.profile.currently_lives %>
+Email:
+<%= @user.email %>
+Telephone:
+<%= @user.profile.telephone %>
+<%= @user.profile.words_to_live_by %>
+<%= @user.profile.about_me %>
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in
+ +You may have mistyped the address or the page may have moved.
+ <%= link_to "Click here to return to your timeline" +If you are the application owner check the logs for more information.
+Maybe you tried to change something you didn't have access to.
+If you are the application owner check the logs for more information.
+If you are the application owner check the logs for more information.
+