Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haby's Media Ranker #25

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
735e7fb
Initial Rails setup Complete
habypsow Apr 11, 2017
5dd8b75
Set up works and index controller
habypsow Apr 11, 2017
d5e6741
Added work model
habypsow Apr 11, 2017
509c409
Trying out new works_setup branch
habypsow Apr 11, 2017
3db87f7
Editing seed file to bring in CSV
habypsow Apr 11, 2017
fdee004
Working on works show view
habypsow Apr 11, 2017
b1d9cae
Working on edit and update methods for works
habypsow Apr 11, 2017
6a11496
Working on new and create methods for works model
habypsow Apr 11, 2017
e043c82
Added destroy method for works
habypsow Apr 12, 2017
5f109ab
Trying to obtain view pages for works categories, with no luck so far
habypsow Apr 12, 2017
636d408
Adding fixtures and validations to begin testing model
habypsow Apr 12, 2017
1f941f7
First Testing in model
habypsow Apr 12, 2017
9caf010
Edited routes file to reflect views for categories
habypsow Apr 12, 2017
9c3b846
Adding category instances in category instance pages
habypsow Apr 12, 2017
271c1f8
Writing model tests for Works
habypsow Apr 13, 2017
bfd83e8
Writing controller tests
habypsow Apr 13, 2017
53fe963
Controller testing for show method
habypsow Apr 14, 2017
7a9fe4c
Adding models user and vote
habypsow Apr 14, 2017
5d7e90c
Adding votes table
habypsow Apr 14, 2017
b5214f1
Working on adding/editing links for adding/deleting works
habypsow Apr 14, 2017
401b611
Editing links to works pages
habypsow Apr 14, 2017
a8b4880
Removed erroneous albums controller
habypsow Apr 14, 2017
21e07ba
Adding sessions controller and sessions actions
habypsow Apr 14, 2017
37c2c44
Working on session login
habypsow Apr 14, 2017
42dc2dc
Working on user index and show page
habypsow Apr 14, 2017
31060d4
Now working on vote functionality
habypsow Apr 14, 2017
5316e31
Adding upvote method link
habypsow Apr 14, 2017
4605582
Added owl image
habypsow Apr 14, 2017
03dd27a
Adding vote functionality to show pages
habypsow Apr 14, 2017
cbccd90
Adding user votes on user show page
habypsow Apr 14, 2017
5b6a8ad
Working on having user name show when logged in
habypsow Apr 14, 2017
45c6447
Added foundation files
habypsow Apr 14, 2017
b4952f0
Working on top 10 functionality
habypsow Apr 15, 2017
7aefbd0
Adding functionality to upvote button on media show page
habypsow Apr 18, 2017
f596093
Added same functionality to all media pages
habypsow Apr 18, 2017
891c324
Working on controller testing
habypsow Apr 18, 2017
81e6481
Deleted non-working feature on index.html
habypsow Apr 18, 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
Next Next commit
Initial Rails setup Complete
habypsow committed Apr 11, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 735e7fbce93b0723f31f558d1d3a181cec45501b
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
64 changes: 64 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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

gem 'awesome_print'
group :test do
gem 'minitest-rails'
gem 'minitest-reporters'
end
202 changes: 202 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
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)
awesome_print (1.7.0)
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
awesome_print
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