diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..18b43c9cd2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
+# 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 all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore uploaded files in development
+/storage/*
+!/storage/.keep
+
+/node_modules
+/yarn-error.log
+
+/public/assets
+.byebug_history
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000000..25c81fe399
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+ruby-2.5.1
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000000..6219256bd8
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,81 @@
+source 'https://rubygems.org'
+git_source(:github) { |repo| "https://github.com/#{repo}.git" }
+
+ruby '2.5.1'
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '~> 5.2.1'
+# Use postgresql as the database for Active Record
+gem 'pg', '>= 0.18', '< 2.0'
+# Use Puma as the app server
+gem 'puma', '~> 3.11'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'mini_racer', platforms: :ruby
+
+# Use CoffeeScript for .coffee assets and views
+# gem 'coffee-rails', '~> 4.2'
+# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
+gem 'turbolinks', '~> 5'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.5'
+# Use Redis adapter to run Action Cable in production
+# gem 'redis', '~> 4.0'
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use ActiveStorage variant
+# gem 'mini_magick', '~> 4.8'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+# Reduces boot times through caching; required in config/boot.rb
+gem 'bootsnap', '>= 1.1.0', require: false
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
+end
+
+group :development do
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
+ gem 'web-console', '>= 3.3.0'
+ gem 'listen', '>= 3.0.5', '< 3.2'
+ # 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'
+end
+
+group :test do
+ # Adds support for Capybara system testing and selenium driver
+ gem 'capybara', '>= 2.15'
+ gem 'selenium-webdriver'
+ # Easy installation and use of chromedriver to run system tests with Chrome
+ gem 'chromedriver-helper'
+end
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+
+gem 'jquery-rails'
+gem 'jquery-turbolinks'
+gem 'bootstrap', '~> 4.1.3'
+group :development, :test do
+ gem 'pry-rails'
+end
+
+group :development do
+ gem 'better_errors'
+ gem 'binding_of_caller'
+ gem 'guard'
+ gem 'guard-minitest'
+end
+
+group :test do
+ gem 'minitest-rails'
+ gem 'minitest-reporters'
+end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000000..3e4d19fd03
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,277 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (5.2.1)
+ actionpack (= 5.2.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ actionmailer (5.2.1)
+ actionpack (= 5.2.1)
+ actionview (= 5.2.1)
+ activejob (= 5.2.1)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.2.1)
+ actionview (= 5.2.1)
+ activesupport (= 5.2.1)
+ rack (~> 2.0)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.2.1)
+ activesupport (= 5.2.1)
+ builder (~> 3.1)
+ erubi (~> 1.4)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
+ activejob (5.2.1)
+ activesupport (= 5.2.1)
+ globalid (>= 0.3.6)
+ activemodel (5.2.1)
+ activesupport (= 5.2.1)
+ activerecord (5.2.1)
+ activemodel (= 5.2.1)
+ activesupport (= 5.2.1)
+ arel (>= 9.0)
+ activestorage (5.2.1)
+ actionpack (= 5.2.1)
+ activerecord (= 5.2.1)
+ marcel (~> 0.3.1)
+ activesupport (5.2.1)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 0.7, < 2)
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ addressable (2.5.2)
+ public_suffix (>= 2.0.2, < 4.0)
+ ansi (1.5.0)
+ archive-zip (0.11.0)
+ io-like (~> 0.3.0)
+ arel (9.0.0)
+ autoprefixer-rails (9.1.4)
+ execjs
+ better_errors (2.5.0)
+ coderay (>= 1.0.0)
+ erubi (>= 1.0.0)
+ rack (>= 0.9.0)
+ bindex (0.5.0)
+ binding_of_caller (0.8.0)
+ debug_inspector (>= 0.0.1)
+ bootsnap (1.3.2)
+ msgpack (~> 1.0)
+ bootstrap (4.1.3)
+ autoprefixer-rails (>= 6.0.3)
+ popper_js (>= 1.12.9, < 2)
+ sass (>= 3.5.2)
+ builder (3.2.3)
+ byebug (10.0.2)
+ capybara (3.9.0)
+ addressable
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.8)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ xpath (~> 3.1)
+ childprocess (0.9.0)
+ ffi (~> 1.0, >= 1.0.11)
+ chromedriver-helper (2.1.0)
+ archive-zip (~> 0.10)
+ nokogiri (~> 1.8)
+ coderay (1.1.2)
+ concurrent-ruby (1.0.5)
+ crass (1.0.4)
+ debug_inspector (0.0.3)
+ erubi (1.7.1)
+ execjs (2.7.0)
+ ffi (1.9.25)
+ formatador (0.2.5)
+ globalid (0.4.1)
+ activesupport (>= 4.2.0)
+ guard (2.14.2)
+ formatador (>= 0.2.4)
+ listen (>= 2.7, < 4.0)
+ lumberjack (>= 1.0.12, < 2.0)
+ nenv (~> 0.1)
+ notiffany (~> 0.0)
+ pry (>= 0.9.12)
+ shellany (~> 0.0)
+ thor (>= 0.18.1)
+ guard-compat (1.2.1)
+ guard-minitest (2.4.6)
+ guard-compat (~> 1.2)
+ minitest (>= 3.0)
+ i18n (1.1.0)
+ concurrent-ruby (~> 1.0)
+ io-like (0.3.0)
+ jbuilder (2.7.0)
+ activesupport (>= 4.2.0)
+ multi_json (>= 1.2)
+ jquery-rails (4.3.3)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ jquery-turbolinks (2.1.0)
+ railties (>= 3.1.0)
+ turbolinks
+ listen (3.1.5)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ ruby_dep (~> 1.2)
+ loofah (2.2.2)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ lumberjack (1.0.13)
+ mail (2.7.0)
+ mini_mime (>= 0.1.1)
+ marcel (0.3.3)
+ mimemagic (~> 0.3.2)
+ method_source (0.9.0)
+ mimemagic (0.3.2)
+ mini_mime (1.0.1)
+ mini_portile2 (2.3.0)
+ minitest (5.11.3)
+ minitest-rails (3.0.0)
+ minitest (~> 5.8)
+ railties (~> 5.0)
+ minitest-reporters (1.3.5)
+ ansi
+ builder
+ minitest (>= 5.0)
+ ruby-progressbar
+ msgpack (1.2.4)
+ multi_json (1.13.1)
+ nenv (0.3.0)
+ nio4r (2.3.1)
+ nokogiri (1.8.5)
+ mini_portile2 (~> 2.3.0)
+ notiffany (0.1.1)
+ nenv (~> 0.1)
+ shellany (~> 0.0)
+ pg (1.1.3)
+ popper_js (1.14.3)
+ pry (0.11.3)
+ coderay (~> 1.1.0)
+ method_source (~> 0.9.0)
+ pry-rails (0.3.6)
+ pry (>= 0.10.4)
+ public_suffix (3.0.3)
+ puma (3.12.0)
+ rack (2.0.5)
+ rack-test (1.1.0)
+ rack (>= 1.0, < 3)
+ rails (5.2.1)
+ actioncable (= 5.2.1)
+ actionmailer (= 5.2.1)
+ actionpack (= 5.2.1)
+ actionview (= 5.2.1)
+ activejob (= 5.2.1)
+ activemodel (= 5.2.1)
+ activerecord (= 5.2.1)
+ activestorage (= 5.2.1)
+ activesupport (= 5.2.1)
+ bundler (>= 1.3.0)
+ railties (= 5.2.1)
+ sprockets-rails (>= 2.0.0)
+ rails-dom-testing (2.0.3)
+ activesupport (>= 4.2.0)
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.0.4)
+ loofah (~> 2.2, >= 2.2.2)
+ railties (5.2.1)
+ actionpack (= 5.2.1)
+ activesupport (= 5.2.1)
+ method_source
+ rake (>= 0.8.7)
+ thor (>= 0.19.0, < 2.0)
+ rake (12.3.1)
+ rb-fsevent (0.10.3)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ ruby-progressbar (1.10.0)
+ ruby_dep (1.5.0)
+ rubyzip (1.2.2)
+ sass (3.6.0)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sass-rails (5.0.7)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ selenium-webdriver (3.14.1)
+ childprocess (~> 0.5)
+ rubyzip (~> 1.2, >= 1.2.2)
+ shellany (0.0.1)
+ spring (2.0.2)
+ activesupport (>= 4.2)
+ spring-watcher-listen (2.0.1)
+ listen (>= 2.7, < 4.0)
+ spring (>= 1.2, < 3.0)
+ sprockets (3.7.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ thor (0.20.0)
+ thread_safe (0.3.6)
+ tilt (2.0.8)
+ turbolinks (5.2.0)
+ turbolinks-source (~> 5.2)
+ turbolinks-source (5.2.0)
+ tzinfo (1.2.5)
+ thread_safe (~> 0.1)
+ uglifier (4.1.19)
+ execjs (>= 0.3.0, < 3)
+ web-console (3.7.0)
+ actionview (>= 5.0)
+ activemodel (>= 5.0)
+ bindex (>= 0.4.0)
+ railties (>= 5.0)
+ websocket-driver (0.7.0)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.3)
+ xpath (3.1.0)
+ nokogiri (~> 1.8)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ better_errors
+ binding_of_caller
+ bootsnap (>= 1.1.0)
+ bootstrap (~> 4.1.3)
+ byebug
+ capybara (>= 2.15)
+ chromedriver-helper
+ guard
+ guard-minitest
+ jbuilder (~> 2.5)
+ jquery-rails
+ jquery-turbolinks
+ listen (>= 3.0.5, < 3.2)
+ minitest-rails
+ minitest-reporters
+ pg (>= 0.18, < 2.0)
+ pry-rails
+ puma (~> 3.11)
+ rails (~> 5.2.1)
+ sass-rails (~> 5.0)
+ selenium-webdriver
+ spring
+ spring-watcher-listen (~> 2.0.0)
+ turbolinks (~> 5)
+ tzinfo-data
+ uglifier (>= 1.3.0)
+ web-console (>= 3.3.0)
+
+RUBY VERSION
+ ruby 2.5.1p57
+
+BUNDLED WITH
+ 1.16.4
diff --git a/Guardfile b/Guardfile
new file mode 100644
index 0000000000..e34f706f4a
--- /dev/null
+++ b/Guardfile
@@ -0,0 +1,9 @@
+guard :minitest, autorun: false, spring: true do
+ watch(%r{^app/(.+).rb$}) { |m| "test/#{m[1]}_test.rb" }
+ watch(%r{^app/controllers/application_controller.rb$}) { 'test/controllers' }
+ watch(%r{^app/controllers/(.+)_controller.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
+ watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
+ watch(%r{^lib/(.+).rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
+ watch(%r{^test/.+_test.rb$})
+ watch(%r{^test/test_helper.rb$}) { 'test' }
+end
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000000..e85f913914
--- /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 0000000000..b16e53d6d5
--- /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 0000000000..e69de29bb2
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
new file mode 100644
index 0000000000..4f73c21a7d
--- /dev/null
+++ b/app/assets/javascripts/application.js
@@ -0,0 +1,20 @@
+// 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, 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 jquery3
+ //= require popper
+ //= require bootstrap-sprockets
+
+//
+//= require rails-ujs
+//= require activestorage
+//= require turbolinks
+//= require_tree .
diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
new file mode 100644
index 0000000000..739aa5f022
--- /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 0000000000..e69de29bb2
diff --git a/app/assets/javascripts/sessions.js b/app/assets/javascripts/sessions.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/sessions.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/users.js b/app/assets/javascripts/users.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/users.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/works.js b/app/assets/javascripts/works.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/works.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
new file mode 100644
index 0000000000..763a27a104
--- /dev/null
+++ b/app/assets/stylesheets/application.scss
@@ -0,0 +1,99 @@
+/*
+* 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, 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.
+*
+*/
+
+/* Custom bootstrap variables must be set or imported *before* bootstrap. */
+@import "bootstrap";
+/* Import scss content */
+@import "**/*";
+
+body {
+ font-family: "Gudea", sans-serif;
+ text-align: left;
+}
+
+main {
+ padding: 2rem;
+}
+.site_header {
+ max-width: 100%;
+ background-color: #b2dfdb;
+ margin-bottom: 0.5rem;
+ padding: 2rem 1rem 0.5rem 1rem;
+}
+small {
+ color: white;
+ border-left: 2px solid white;
+ padding-left: 10px;
+}
+h1 {
+ display: block;
+ font-weight: bold;
+ font-family: "Gudea", sans-serif;
+ font-size: 2.5rem;
+
+}
+.site_header h1{
+ text-align: center;
+ margin: 25px auto 40px auto;
+ font-size: bold;
+}
+.site_header a{
+ color: red;
+}
+
+.header-nav ul {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+}
+
+.header_nav a{
+ color: #00796B;
+}
+
+.nav {
+ display: flex;
+ flex-wrap: wrap;
+ padding-left: 0;
+ padding-top: 1rem;
+ margin-bottom: 0;
+ list-style: none;
+}
+
+.nav-items a{
+ color: #26A69A;
+}
+
+
+
+.nav-tems {
+ margin-right: 2rem;
+}
+.login-info a{
+ color: white;
+}
+
+ul {
+ list-style: none;
+}
+
+.row-title {
+ color: #26A69A;
+}
+
+.flash-messages {
+ background-color: #d4edda;
+ border-color: #c3e6cb;
+ color: #155724;
+}
diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss
new file mode 100644
index 0000000000..ccb1ed25b2
--- /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/users.scss b/app/assets/stylesheets/users.scss
new file mode 100644
index 0000000000..31a2eacb84
--- /dev/null
+++ b/app/assets/stylesheets/users.scss
@@ -0,0 +1,3 @@
+// 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/
diff --git a/app/assets/stylesheets/works.scss b/app/assets/stylesheets/works.scss
new file mode 100644
index 0000000000..db2345f1b7
--- /dev/null
+++ b/app/assets/stylesheets/works.scss
@@ -0,0 +1,57 @@
+// Place all the styles related to the Works controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+thead {
+ font-weight: bold;
+}
+
+.delete {
+ color: white;
+}
+.top_grid_container {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr;
+ grid-column-gap: 2em;
+}
+
+button a{
+ color: white;
+}
+
+section {
+ display: block;
+}
+
+.spotlight a{
+ color: #26A69A;
+}
+
+.top_list_container {
+
+}
+.top_header {
+ color: #26A69A;
+ border-bottom: 2px solid;
+ border-bottom-color: #B2DFDB;
+ font-weight: bold;
+}
+
+.top_list p{
+color: grey;
+}
+
+.top_list .votes {
+ color: black;
+}
+
+.top_titles a{
+ color: #26A69A;
+}
+
+.row-title a{
+ color: #26A69A;
+}
+table h3 {
+ color: #26A69A;
+}
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000000..d672697283
--- /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 0000000000..0ff5442f47
--- /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 0000000000..1bfe5d1b3b
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,10 @@
+class ApplicationController < ActionController::Base
+ before_action :find_logged_user
+
+ private
+
+ def find_logged_user
+ @logged_in_user = User.find_by(id:session[:user_id])
+
+ end
+end
diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
new file mode 100644
index 0000000000..785d5579ec
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,28 @@
+class SessionsController < ApplicationController
+
+ def new
+ end
+
+ def create
+ name = params[:username]
+ user = User.find_by(username: name)
+ if user == nil
+ user = User.new(username: name)
+ user.save
+ end
+
+ if user
+ session[:user_id] = user.id
+ flash[:success] = "Successfully logged in as #{name}"
+ redirect_to root_path
+ end
+
+ end
+
+
+ def logout
+ session[:user_id] = nil
+ flash[:success] = "Successfully logged out"
+ redirect_to root_path
+ end
+end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
new file mode 100644
index 0000000000..4eddd840f4
--- /dev/null
+++ b/app/controllers/users_controller.rb
@@ -0,0 +1,39 @@
+class UsersController < ApplicationController
+ def index
+ @users = User.all.order(:username)
+ end
+
+ def show
+ @user = User.find_by(id: params[:id])
+
+ if @user.nil?
+ head :not_found
+ end
+
+ end
+
+ def new
+ @user = User.new
+ end
+
+ def create
+ @user = User.new(user_params)
+
+ if @user.save
+ redirect_to users_path
+ else
+ render :new
+ end
+ end
+
+ def edit
+
+ end
+
+ private
+ def user_params
+ return params.require(:user).permit(
+ :username
+ )
+ end
+end
diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb
new file mode 100644
index 0000000000..ceb06befd3
--- /dev/null
+++ b/app/controllers/works_controller.rb
@@ -0,0 +1,110 @@
+class WorksController < ApplicationController
+
+ def index
+ @works = Work.featured
+ end
+
+ def show
+ @work = Work.find_by(id: params[:id])
+ if @work.nil?
+ head :not_found
+ end
+ end
+
+ def new
+ @work = Work.new
+ end
+
+ def create
+
+ @work = Work.new(work_params())
+
+ if @work.save
+ redirect_to work_path(@work.id)
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @work = Work.find_by(id: params[:id])
+ end
+
+ def update
+ work = Work.find_by(id: params[:id])
+
+ if @work.update(work_params)
+ redirect_to work_path(@work.id)
+ end
+ end
+
+ def destroy
+ @work = Work.find_by(id: params[:id])
+ @work.destroy
+
+ redirect_to works_path
+ end
+
+ def top
+
+ @works = Work.featured
+ #top media for spot light
+ @top = @works.first
+
+ # for top 10 movies
+ @movies = Work.where(category: "movie")
+ # sort by votes and take only 10 movies
+ @movies = (@movies.sort_by { |movie| -movie.votes_count}).take(10)
+
+ # for top 10 books
+ @books = Work.where(category: "book")
+ # sort by votes and take only 10 movies
+ @books = (@books.sort_by { |book| -book.votes_count}).take(10)
+
+ # for top 10 albums
+ @albums = Work.where(category: "album")
+ # sort by votes and take only 10 movies
+ @albums = (@albums.sort_by { |album| -album.votes_count}).take(10)
+
+ end
+
+ def upvote
+ @work = Work.find_by(id: params[:work_id])
+
+ if @work.nil?
+ head :not_found
+ end
+
+ @user = User.find_by(id: session[:user_id])
+
+ if @user.nil?
+ flash[:error] = "Must be logged in to vote"
+ redirect_back(fallback_location: root_path)
+ else
+ @vote = Vote.new(user: @user, work:
+ @work)
+
+ if @vote.save
+ flash[:success] = "Successfully voted for this work."
+ redirect_to work_path(@work)
+ else
+ flash[:error] = "You already voted for this work, can't vote for it again!"
+
+ end
+ end
+ end
+
+
+
+ private
+ def work_params
+ return params.require(:work).permit(
+ :title,
+ :category,
+ :creator,
+ :publication_year,
+ :description
+ )
+ end
+
+ end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
new file mode 100644
index 0000000000..de6be7945c
--- /dev/null
+++ b/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
new file mode 100644
index 0000000000..309f8b2eb3
--- /dev/null
+++ b/app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
new file mode 100644
index 0000000000..2310a240d7
--- /dev/null
+++ b/app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
diff --git a/app/helpers/works_helper.rb b/app/helpers/works_helper.rb
new file mode 100644
index 0000000000..ccb78c2b73
--- /dev/null
+++ b/app/helpers/works_helper.rb
@@ -0,0 +1,2 @@
+module WorksHelper
+end
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
new file mode 100644
index 0000000000..a009ace51c
--- /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 0000000000..286b2239d1
--- /dev/null
+++ b/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: 'from@example.com'
+ layout 'mailer'
+end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
new file mode 100644
index 0000000000..10a4cba84d
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+end
diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 0000000000..70a8205476
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,6 @@
+class User < ApplicationRecord
+ has_many :votes
+
+ validates :username, presence: true
+
+end
diff --git a/app/models/vote.rb b/app/models/vote.rb
new file mode 100644
index 0000000000..fcccfbc131
--- /dev/null
+++ b/app/models/vote.rb
@@ -0,0 +1,9 @@
+class Vote < ApplicationRecord
+ belongs_to :user
+ belongs_to :work, counter_cache: true
+
+ validates :user_id, presence: true
+ validates :work_id, presence: true
+
+ validates_uniqueness_of :work_id, scope: :user_id
+end
diff --git a/app/models/work.rb b/app/models/work.rb
new file mode 100644
index 0000000000..7ea65db290
--- /dev/null
+++ b/app/models/work.rb
@@ -0,0 +1,19 @@
+class Work < ApplicationRecord
+ has_many :votes, counter_cache: :counter_of_votes
+ has_many :votes, :dependent => :destroy
+
+ validates :title, :category, presence: true
+
+ validates_uniqueness_of :title, scope: :category
+ scope :featured, -> {order('votes_count DESC')}
+
+ # def top_media_find
+ # works = Work.all
+ # works.sort_by {|vote|}
+ # top = works.first
+ #
+ # return top
+ # end
+
+
+end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
new file mode 100644
index 0000000000..19bff31d9e
--- /dev/null
+++ b/app/views/layouts/application.html.erb
@@ -0,0 +1,52 @@
+
+
+
+ MediaRanker
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
+
+
+
+
+
+
+ <% flash.each do |key, message| %>
+
+ <%= message %>
+
+ <% end %>
+
+
+ <%= yield %>
+
+
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
new file mode 100644
index 0000000000..cbd34d2e9d
--- /dev/null
+++ b/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb
new file mode 100644
index 0000000000..37f0bddbd7
--- /dev/null
+++ b/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb
new file mode 100644
index 0000000000..087f73d625
--- /dev/null
+++ b/app/views/sessions/new.html.erb
@@ -0,0 +1,6 @@
+<%= form_with method: :post, url: sessions_path do |f| %>
+ <%= f.label :username %>
+ <%= f.text_field :username %>
+
+ <%= f.submit "Log In"%>
+<% end %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
new file mode 100644
index 0000000000..e0d319d3ac
--- /dev/null
+++ b/app/views/users/index.html.erb
@@ -0,0 +1,19 @@
+
+
+
+ List of Users
+
+
+
+
+
+ | Username |
+
+
+
+ <%@users.each do |user| %>
+ | <%=link_to user.username, user_path(user)%> |
+
+ <%end%>
+
+
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
new file mode 100644
index 0000000000..6e15062dd2
--- /dev/null
+++ b/app/views/users/show.html.erb
@@ -0,0 +1,31 @@
+
+
+ User Summary: <%=@user.username%>
+
+ Joined site <%=(@user.created_at).strftime("%b %e, %Y")%>
+
+
+ Votes
+
+
+
+
+ | Media Title |
+ Created By |
+ Published |
+ Category |
+ Voted On |
+
+
+
+ <%@user.votes.each do |vote|%>
+
+ | <%=link_to vote.work.title, work_path(vote.work)%> |
+ <%=vote.work.creator%> |
+ <%=vote.work.publication_year%> |
+ <%=vote.work.category%> |
+ <%=(vote.created_at).strftime("%b %e, %Y")%> |
+
+ <%end%>
+
+
diff --git a/app/views/works/_form.html.erb b/app/views/works/_form.html.erb
new file mode 100644
index 0000000000..498089fbb2
--- /dev/null
+++ b/app/views/works/_form.html.erb
@@ -0,0 +1,62 @@
+
+<%= form_with model: @work do |f| %>
+<% if @work.errors.any?%>
+Errors:
+
+
+ <% @work.errors.each do |column, message| %>
+ -
+ <%=column.capitalize%>: <%= message%>
+
+ <%end%>
+
+<% end %>
+
+