Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9039204
Initial Rails setup
ricecakemonster Apr 10, 2017
8245bec
Created controllers(users, works)
ricecakemonster Apr 10, 2017
8d07239
Created controller(main)
ricecakemonster Apr 10, 2017
597341c
Created models(user, vote, work) and added table(belongs_to for vote …
ricecakemonster Apr 10, 2017
42e9d37
Added has_many and belong_to to .rb files
ricecakemonster Apr 10, 2017
af162ab
Imported csv file. rails db:seed
ricecakemonster Apr 10, 2017
6db37c3
Added user tests
ricecakemonster Apr 11, 2017
57f2adb
Added work tests and validations
ricecakemonster Apr 11, 2017
08efd77
Added tests for vote model
ricecakemonster Apr 12, 2017
7aafe40
Added main page with lists of works and spotlight
ricecakemonster Apr 12, 2017
bbc676a
Added each work's list page
ricecakemonster Apr 12, 2017
49948c8
Added create work and tested
ricecakemonster Apr 13, 2017
6ea5474
Added show page
ricecakemonster Apr 13, 2017
edadbe7
Created sessions.Login, Logout working
ricecakemonster Apr 13, 2017
f0efcb6
Done without Voting function
ricecakemonster Apr 13, 2017
6b4e815
Added Vote. can vote while logged in
ricecakemonster Apr 13, 2017
a5b31a0
Added the function : Cannot vote more than once for the same media mo…
ricecakemonster Apr 14, 2017
0773726
Sorted media by vote count
ricecakemonster Apr 14, 2017
93393bd
Added a list of voting users to the details page
ricecakemonster Apr 14, 2017
57e7130
Added a user summary page
ricecakemonster Apr 14, 2017
51796bf
Added List of Users page
ricecakemonster Apr 14, 2017
3464728
Added Delete meida
ricecakemonster Apr 14, 2017
f70805f
Finished CSS file
ricecakemonster Apr 15, 2017
58e0dd7
Fixed model test problem. Allows blank for creation year
ricecakemonster Apr 16, 2017
f61d0ee
Fixed Edit for work
ricecakemonster Apr 16, 2017
a771671
Fixed user show file, so it desplays the page when there's no voted w…
ricecakemonster Apr 16, 2017
510f56a
All the test files passed. Fixed corresponding controllers
ricecakemonster Apr 16, 2017
8b96d5e
Added a method, before save, and before validation to user.rb. User l…
ricecakemonster Apr 16, 2017
39fe516
Fixed a problem that occurred when a user is deleted under /users dir…
ricecakemonster Apr 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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 Byebug command history file.
.byebug_history
63 changes: 63 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.2'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
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'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development do
gem 'better_errors'
gem 'pry-rails'
end

group :test do
gem 'minitest-rails'
gem 'minitest-reporters'
end
200 changes: 200 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.2)
actionpack (= 5.0.2)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.2)
actionpack (= 5.0.2)
actionview (= 5.0.2)
activejob (= 5.0.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.2)
actionview (= 5.0.2)
activesupport (= 5.0.2)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.2)
activesupport (= 5.0.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.2)
activesupport (= 5.0.2)
globalid (>= 0.3.6)
activemodel (5.0.2)
activesupport (= 5.0.2)
activerecord (5.0.2)
activemodel (= 5.0.2)
activesupport (= 5.0.2)
arel (~> 7.0)
activesupport (5.0.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
ansi (1.5.0)
arel (7.1.4)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
bindex (0.5.0)
builder (3.2.3)
byebug (9.0.6)
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.12.2)
concurrent-ruby (1.0.5)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.18)
globalid (0.3.7)
activesupport (>= 4.1.0)
i18n (0.8.1)
jbuilder (2.6.3)
activesupport (>= 3.0.0, < 5.2)
multi_json (~> 1.2)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
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)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.1)
minitest-rails (3.0.0)
minitest (~> 5.8)
railties (~> 5.0)
minitest-reporters (1.1.14)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.12.1)
nio4r (2.0.0)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
pg (0.20.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.6)
pry (>= 0.10.4)
puma (3.8.2)
rack (2.0.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.2)
actioncable (= 5.0.2)
actionmailer (= 5.0.2)
actionpack (= 5.0.2)
actionview (= 5.0.2)
activejob (= 5.0.2)
activemodel (= 5.0.2)
activerecord (= 5.0.2)
activesupport (= 5.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.2)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.2)
actionpack (= 5.0.2)
activesupport (= 5.0.2)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
ruby-progressbar (1.8.1)
sass (3.4.23)
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)
slop (3.6.0)
spring (2.0.1)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.3)
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
web-console (3.5.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)

PLATFORMS
ruby

DEPENDENCIES
better_errors
byebug
coffee-rails (~> 4.2)
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
minitest-rails
minitest-reporters
pg (~> 0.18)
pry-rails
puma (~> 3.0)
rails (~> 5.0.2)
sass-rails (~> 5.0)
spring
spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)

BUNDLED WITH
1.14.6
102 changes: 13 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,24 @@
# Media Ranker
# README

## Introduction
This README would normally document whatever steps are necessary to get the
application up and running.

In this project, you will build a webapp where users can vote for their favorite pieces of media.
Things you may want to cover:

In contrast to previous projects, instead of implementing a pre-defined spec you will be imitating an existing site: http://media-ranker-2-0.herokuapp.com. Your job is to match the functionality and styling of this site as closely as possible.
* Ruby version

This is an individual, [stage 2](https://github.com/Ada-Developers-Academy/pedagogy/blob/master/rule-of-three.md) project.
* System dependencies

## Learning Goals
* Configuration

The purpose of this assignment is to reinforce the following concepts:
* Database creation

- Previous Rails learning, including MVC, RESTful routing, and the request cycle
- Testing Rails applications
- Building complex model logic
- Using `session` and `flash` to track data between requests
- DRYing up Rails code
- Working with a CSS framework
- Styling a page based on an existing design
* Database initialization

## Before You Begin
* How to run the test suite

### Provided Files
* Services (job queues, cache servers, search engines, etc.)

- `db/media_seeds.csv`: Some starter media to work with
- `app/assets/images/owl.jpg`: The owl picture from the site
* Deployment instructions

### Regarding the Word "Media"

The Rails inflector considers "media" to be the plural of "medium", which is not really what we mean here. You may want to choose a different word to represent "a book, movie or album" internally. The instructor-proved example site uses the word "work".

## Project Requirements

### Core Requirements

Regardless of how you choose to implement this project or how much of it gets done, you should exhibit

- Squeaky-clean **git hygiene**, including
- A fresh branch for each new feature
- Regular commits
- Descriptive commit messages
- Fanatical devotion to **test-driven development**
- Pseudocode first, then write the tests, then write code to make them pass
- Steadfast adherence to **agile development practices**
- User stories should be listed and prioritized using a Trello board
- The finished application should be deployed to Heroku (deploy early, deploy often)
- Unrelenting use of **semantic HTML**

### Baseline

We will begin with some in-class work, exploring the site and pondering implementation details. Before you start writing _any_ code, you should:

- Explore the existing Media Ranker site to become familiar with the necessary functionality
- Create a Trello board to manage user stories
- Create an ERD for the models

Then, once you have a solid plan for how to structure your project:

- Fork and clone the repo
- Use `rails new .` to generate a new Rails project in the cloned directory
- Verify that the changes we've made to Rails' defaults (postgres as the DB, spec-style testing) have been applied
- `git init`, `git add .` and `git commit -m "Initial Rails setup"`

### Wave 1

Mimic the site's basic functionality around Media, without worrying (yet) about Users or Votes:
- Build a main page, with a list of the top 10 media of each category, as well as a spotlight section for the top media overall
- Build an index page for each media category
- Build a details page for each piece of media
- Make sure any models and controllers you've built so far are well-tested

### Wave 2

Mimic the site's functionality around Users and Voting:
- Allow users to "log in" to the site, and use the `session` to keep track of which user is currently logged in for a given browser
- Allow users to vote for media, and sort media by vote count whenever a list of media is displayed
- Add a list of voting users to the details page for each media
- Don't allow a user to vote for the same media more than once
- Add a page for each user, as well as a page showing a summary of all users
- Make sure any models and controllers you've built so far are well-tested

#### A note on logging in

Passwords and security are tricky! We'll talk about that sort of thing a little in the coming weeks, but for now you don't need to provide any sort of security. The user gives you a username, and your site should just trust them.

### Wave 3

Use Foundation to style the site to match the example. The layout as well as the look and feel should match as close as possible.

### Optional Enhancement Ideas

Once your test coverage is comprehensive, your HTML is semantic, your user stories have all been moved to the `Done` column and your application has been deployed to Heroku, you may consider the following enhancements.

1. DRY up your code as much as you can! Techniques worth investigating:
- Helper methods
- Controller filters
- Polymorphic routes
1. Add a [recommendation system](https://www.toptal.com/algorithms/predicting-likes-inside-a-simple-recommendation-engine) that suggests media to a user based on what they have previously voted for.
* ...
Loading