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

Maya Wang's otter-muncher #75

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
99b8364
created new rails. add better_error gem to Gemfile
Oct 31, 2016
c5d4eb1
Merge pull request #1 from mayawang/mw_baseline
Oct 31, 2016
3b6d553
add awesome_print gem and api gems
Oct 31, 2016
d09523a
Merge pull request #2 from mayawang/mw_baseline
Oct 31, 2016
ebac1f1
create rs_api_wrapper.rb in lib and search method as helper
Oct 31, 2016
d9380f6
created homepages controller
Oct 31, 2016
1ecfa59
set up application.rb
Oct 31, 2016
5fd34e3
complete recipe search api
Nov 1, 2016
d95064d
create recipe model
Nov 1, 2016
55028d6
remove extra call to search api
Nov 1, 2016
79315b0
Merge remote-tracking branch 'origin/master' into mw_search
Nov 1, 2016
8a52dbb
completed search mvc logic, show recipe with label, image and link to…
Nov 1, 2016
f71c546
Merge pull request #3 from mayawang/mw_search
Nov 1, 2016
f77e1e2
add foundation for css
Nov 1, 2016
38898a5
add pagination on list show. show + 5 and -5 pages, handle empty page…
Nov 2, 2016
fef24c3
comment out puts in api homepage countroller
Nov 2, 2016
ee958ef
Merge pull request #4 from mayawang/mw_list_view
Nov 2, 2016
88a53c6
complete show individual recipe with label, image and link to origina…
Nov 2, 2016
4771122
show ingredients in table
Nov 2, 2016
a56ba22
show diet label
Nov 2, 2016
77f3338
add home page button
Nov 2, 2016
9eaac58
add attribution to API in footer
Nov 2, 2016
19f48cb
move home link to header
Nov 2, 2016
2bdbbc2
Merge pull request #5 from mayawang/mw_show_view
Nov 2, 2016
c07e6a3
working on limit search, add checkbox for label search, draft m(api)v…
Nov 3, 2016
e005ec7
add show health labels on show page
Nov 3, 2016
99734b1
add recipe image link to show page
Nov 3, 2016
771a8ee
handle case when no result found, hits=[]
Nov 3, 2016
619605f
complete limit search by label checkbox feature. handle case when no …
Nov 3, 2016
f2fcf87
Merge pull request #6 from mayawang/mw_limit_search
Nov 3, 2016
89ac335
Merge branch 'master' of https://github.com/mayawang/api-muncher into…
Nov 3, 2016
eb653ff
added vcr testing gem in Gemfile
Nov 3, 2016
68e10ae
add require in test_helper
Nov 3, 2016
d3353a7
change require position in test_helper
Nov 3, 2016
69f1eb6
add column styling to search result. add back to list button on show …
Nov 4, 2016
0a173c6
add foundation pagination styling
Nov 4, 2016
7734f3f
setup header and go to back button on show page
Nov 4, 2016
254a8ac
set up attribution link in footer
Nov 4, 2016
b471102
completed css design and styling on index, search result and show pages
Nov 7, 2016
a1328c0
fix bugs filter search feature, add more filters. improve styling on …
Nov 7, 2016
04d1497
changed indentation
Nov 7, 2016
c4a73ac
Merge pull request #7 from mayawang/mw_styling
Nov 7, 2016
2e9d261
Updated Gemfile for Heroku
Nov 7, 2016
c475b42
add APP_ID and APP_KEY into env
Nov 7, 2016
8f4f4c2
comment out squilte
Nov 7, 2016
850a613
set config.autoload_path in production
Nov 7, 2016
f04a627
add require in controller
Nov 7, 2016
716bfce
Update README.md
Nov 7, 2016
16e7d44
Update README.md
Nov 7, 2016
bd5da50
Update README.md
Nov 7, 2016
8661a11
Update README.md
Nov 7, 2016
bad512b
Update README.md
Nov 7, 2016
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.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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 ENV full of secrets
.env
61 changes: 61 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
source 'https://rubygems.org'

gem "binding_of_caller"
gem 'pg', group: :production
gem 'rails_12factor', group: :production

# API GEMS
gem 'httparty'
gem 'foundation-rails'
gem 'awesome_print'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'

# 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
gem 'dotenv-rails'
gem 'better_errors'
gem 'minitest-vcr'
gem 'webmock'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
end

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'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
231 changes: 231 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.0.1)
actionpack (= 5.0.0.1)
nio4r (~> 1.2)
websocket-driver (~> 0.6.1)
actionmailer (5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.0.1)
actionview (= 5.0.0.1)
activesupport (= 5.0.0.1)
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.1)
activesupport (= 5.0.0.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (5.0.0.1)
activesupport (= 5.0.0.1)
globalid (>= 0.3.6)
activemodel (5.0.0.1)
activesupport (= 5.0.0.1)
activerecord (5.0.0.1)
activemodel (= 5.0.0.1)
activesupport (= 5.0.0.1)
arel (~> 7.0)
activesupport (5.0.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.4.0)
arel (7.1.4)
awesome_print (1.7.0)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
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.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.10.0)
concurrent-ruby (1.0.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
debug_inspector (0.0.2)
dotenv (2.1.1)
dotenv-rails (2.1.1)
dotenv (= 2.1.1)
railties (>= 4.0, < 5.1)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.14)
foundation-rails (6.2.4.0)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
sprockets-es6 (>= 0.9.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
hashdiff (0.3.0)
httparty (0.14.0)
multi_xml (>= 0.5.2)
i18n (0.7.0)
jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.2.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)
minispec-metadata (2.0.0)
minitest
minitest (5.9.1)
minitest-vcr (1.4.0)
minispec-metadata (~> 2.0)
minitest (>= 4.7.5)
vcr (>= 2.9)
multi_json (1.12.1)
multi_xml (0.5.5)
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pg (0.19.0)
puma (3.6.0)
rack (2.0.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.0.1)
actioncable (= 5.0.0.1)
actionmailer (= 5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
activemodel (= 5.0.0.1)
activerecord (= 5.0.0.1)
activesupport (= 5.0.0.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0.1)
sprockets-rails (>= 2.0.0)
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.1)
actionpack (= 5.0.0.1)
activesupport (= 5.0.0.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.3.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
safe_yaml (1.0.4)
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)
spring (2.0.0)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.3)
execjs (>= 0.3.0, < 3)
vcr (3.0.3)
web-console (3.4.0)
actionview (>= 5.0)
activemodel (>= 5.0)
debug_inspector
railties (>= 5.0)
webmock (2.1.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)

PLATFORMS
ruby

DEPENDENCIES
awesome_print
better_errors
binding_of_caller
byebug
coffee-rails (~> 4.2)
dotenv-rails
foundation-rails
httparty
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
minitest-vcr
pg
puma (~> 3.0)
rails (~> 5.0.0, >= 5.0.0.1)
rails_12factor
sass-rails (~> 5.0)
spring
spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console
webmock

BUNDLED WITH
1.13.6
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
Heroku Live: https://otter-muncher.herokuapp.com/

# Reflection

- What do you understand better after doing this project?
- I learnt more about applying API to website, especially understanding on query parameters, and how this connects to our previous learning of model and database:
- completed all search, search result and show features using API
- filter search feature by health label and diet label using checkbox
- manually coded pagination feature without use gem
- Can show a 'sliding' pagination bar for previous 5 and next 5 pages to handle 1000+ results if needed. Knowing our developer account can only return a limited number of 100 recipes, I commented out this part for better user experience.
- When implement the +5 and -5 pagination bar, it is hard to stop pagination without reaching the last page because the API does not return a finite number for search result(1000 and more).
- I will try to implement pagination gem next time as it seems to handle better on the above described last page pagination situation
- change return recipe result to 9 per page for better display(which can be easily changed to any number in PAGE_SIZE in api wrapper).
- added API attribution in footer
- foundation framework: responsive, pagination, label, table, checkbox, go back button, sea otter theme design.


- What do you want more practice with?
- I need to practice more on: API and controller tesing, try more complex foundation grid(e.g. 5 recipes in a row), try pagination gem, and try Google Auth next time:
- I did not attempt Google OAuth and save favorite feature this time due to time constrain. I did briefly think about how to implement these features.
- Google OAuth: will be similar to Github OAuth. will be nice to go through it if has the opportunity.
- Save favorites: create user and favorites model. model relation: User has many favorites. I can save and access user & favorites by sessions[user_id].

- under construction: testing on API and controller. I will update and merge my testing branch later.


- What is something you saw done differently?
My deskmate Jessica did great job on making the search bar available across pages, which definitely increases user experience. She also implemented api pigination gem for pages which I did not try this time. Her website also has very nice details like hover on recipe will change the recipe background color, etc.


# Recipe API Consumer

## Learning Goals:
Expand Down
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/assets/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
Empty file added app/assets/images/.keep
Empty file.
16 changes: 16 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -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 turbolinks
//= require_tree .
13 changes: 13 additions & 0 deletions app/assets/javascripts/cable.js
Original file line number Diff line number Diff line change
@@ -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);
Empty file.
3 changes: 3 additions & 0 deletions app/assets/javascripts/homepages.coffee
Original file line number Diff line number Diff line change
@@ -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/
Loading