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

API Muncher--Dianne #77

Open
wants to merge 36 commits into
base: b/dkl/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
33505ba
added api wrapper file
dlaguerta Nov 1, 2016
6b12214
added basic attribution note
dlaguerta Nov 1, 2016
af5fa32
added env file with token
dlaguerta Nov 1, 2016
d2c2208
verified working token
dlaguerta Nov 1, 2016
d1325ea
added VCR and minitest reporters gem to Gemfile
dlaguerta Nov 1, 2016
555140a
added api wrapper test file to test lib
dlaguerta Nov 1, 2016
7183501
added recipe.rb to lib and recipe test file
dlaguerta Nov 1, 2016
ddfa4a6
added vcr code to test helper file
dlaguerta Nov 1, 2016
7b0e203
added foundation stylesheet
dlaguerta Nov 1, 2016
303fec9
generated controller for homepages
dlaguerta Nov 2, 2016
5a09014
added first test for homepages controller, created first route
dlaguerta Nov 2, 2016
2597c08
working on search bar, added adjustment to test helper file
dlaguerta Nov 2, 2016
dd29656
building recipe object
dlaguerta Nov 2, 2016
d6cc910
added end to recipe
dlaguerta Nov 2, 2016
467a9a5
added simplecov
dlaguerta Nov 2, 2016
2f6b2a4
added search box, changed method name for searching
dlaguerta Nov 2, 2016
bc6dbd3
tried to test show view, not working out
dlaguerta Nov 2, 2016
9ecdbf1
added image to index page for each recipe, removed bullets
dlaguerta Nov 3, 2016
4c7acf1
made the show page work
dlaguerta Nov 3, 2016
35113a1
opens original recipe in new tab
dlaguerta Nov 3, 2016
410612c
edited show
dlaguerta Nov 3, 2016
d825724
added uri
dlaguerta Nov 3, 2016
9a137c2
added better styling using Foundation
dlaguerta Nov 3, 2016
a1a6b44
minor foundation addition, trying will_paginate
dlaguerta Nov 3, 2016
0865cb5
added will_paginate
dlaguerta Nov 3, 2016
e308aea
added will_paginate gem, works
dlaguerta Nov 3, 2016
4f77d06
increased COUNT
dlaguerta Nov 3, 2016
de25d09
added tests and changes to html
dlaguerta Nov 4, 2016
650e9d5
added color
dlaguerta Nov 4, 2016
2cca732
added css styling
dlaguerta Nov 4, 2016
42a059c
added one more assertion to controller test
dlaguerta Nov 4, 2016
f7331b7
added more assertions
dlaguerta Nov 4, 2016
f94e1bc
centered headings
dlaguerta Nov 4, 2016
2d84ad3
added more styling to footer
dlaguerta Nov 4, 2016
d58d729
added style to search bar
dlaguerta Nov 4, 2016
ab1743e
added link to Edamam
dlaguerta Nov 5, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
!/log/.keep
/tmp
.env
/coverage
16 changes: 14 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# API GEMS
gem 'httparty'

gem 'foundation-rails'
# gem 'foundation-rails'

gem 'will_paginate'

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry'
gem 'dotenv-rails'
gem 'better_errors'
gem 'binding_of_caller'
#Use VCR for mocking API requests
gem 'minitest-vcr'
gem 'webmock'
end

group :development do
Expand All @@ -51,4 +55,12 @@ group :development do

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'

gem 'pry'
end

group :test do
gem 'minitest-reporters'
gem 'simplecov'

end
58 changes: 58 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
ansi (1.5.0)
arel (6.0.3)
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.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
Expand All @@ -49,11 +56,21 @@ GEM
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)
docile (1.1.5)
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)
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)
Expand All @@ -67,14 +84,31 @@ GEM
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-reporters (1.1.12)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
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)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -105,6 +139,8 @@ GEM
rake (11.3.0)
rdoc (4.2.2)
json (~> 1.4)
ruby-progressbar (1.8.1)
safe_yaml (1.0.4)
sass (3.4.22)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
Expand All @@ -115,6 +151,12 @@ GEM
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
simplecov (0.12.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
spring (2.0.0)
activesupport (>= 4.2)
sprockets (3.7.0)
Expand All @@ -135,28 +177,44 @@ GEM
thread_safe (~> 0.1)
uglifier (3.0.3)
execjs (>= 0.3.0, < 3)
vcr (3.0.3)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (2.1.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
will_paginate (3.1.5)

PLATFORMS
ruby

DEPENDENCIES
better_errors
binding_of_caller
byebug
coffee-rails (~> 4.1.0)
dotenv-rails
httparty
jbuilder (~> 2.0)
jquery-rails
minitest-reporters
minitest-vcr
pry
rails (= 4.2.7)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simplecov
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)
webmock
will_paginate

BUNDLED WITH
1.13.5
Binary file added app/assets/images/frog_chef.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/
3 changes: 3 additions & 0 deletions app/assets/javascripts/recipes.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/
91 changes: 91 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,94 @@
@import url('foundation.min.css');

nav {
padding: 2%;
}
/*body {
background-color: #7c9bf1;
}*/

.pagination, a {
color: rgb(189, 109, 109);
}

.page-bar {
margin-top: 30px;
/*margin-left: 30px;*/
}
.page-bar a {

}
.page-bar em.current {
padding: 10px;
border-radius: 3px;
background-color: rgb(245, 233, 82);
}

#search-form {
padding: 2%;
width: 50%;
font-family: 'Nobile', arial;
}

#search-form input, .form_submit{
border-radius: 100px;
background-color: white;
border: 2px solid rgb(30, 132, 215
);
}

#search-form .form_submit{
background-color: rgb(30, 132, 215
);
color: white;
border: 2px solid white;
padding: 10px;
}

li {
list-style-type: none;
}

h1, h2 {
font-family: 'Corben', Georgia, Arial, sans-serif;
padding-top: 15px;
}

p, ul, li, a{
font-family: 'Nobile', Arial, sans-serif;
}

h1, h2 {
text-align: center;
background-color: rgb(245, 233, 82);
border-radius: 5px 30px 5px;
width: 75%;

}

.intro {
padding: 5%;
}

.recipe-info {
padding: 20px;
}

.home-image {
margin-top: 20px;
}

footer {
margin-top: 8%;
margin-bottom: 2%;
border-top: 5px solid rgb(245, 233, 82);
padding: 2%;
}





/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
Expand Down
2 changes: 2 additions & 0 deletions app/assets/stylesheets/foundation.min.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions app/assets/stylesheets/homepages.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Homepages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/recipes.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the recipes controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
5 changes: 5 additions & 0 deletions app/controllers/homepages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class HomepagesController < ApplicationController

def index; end #dummy controller for homepage

end
18 changes: 18 additions & 0 deletions app/controllers/recipes_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'will_paginate/array'

class RecipesController < ApplicationController

def index
@recipes = Recipe.search(params[:search]).paginate(:page => params[:page], :per_page => 12)

end

def show
#old search uses name
@recipe = Recipe.search(params[:id]).first
end
end

# def index #will paginate?
# @posts = Post.all.paginate(:page => params[:page], :per_page => 4)
# end
2 changes: 2 additions & 0 deletions app/helpers/homepages_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module HomepagesHelper
end
2 changes: 2 additions & 0 deletions app/helpers/recipes_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module RecipesHelper
end
7 changes: 7 additions & 0 deletions app/views/homepages/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<article class = "row">
<h1 class="large-11 small-centered columns">Welcome to Munch on This: A Recipe Finder</h1>
<%=image_tag "frog_chef.jpg", class: "home-image small-9 columns large-7 columns"%>

<p class="intro small-3 columns large-5 columns"> Need an awesome recipe recommendation for a romantic dinner for two? Or do you just want to know what you can do with 5 bottles of ketchup? Try out Munch on This! Get started with the search bar above.</p>

</article>
23 changes: 21 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>ApiMuncher</title>
<title>MUNCH ON THIS: A RECIPE FINDER</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>

<!-- Web fonts from Google -->
<%=stylesheet_link_tag 'application', 'http://fonts.googleapis.com/css?family=Corben:bold' %>
<%=stylesheet_link_tag 'application', 'http://fonts.googleapis.com/css?family=Nobile' %>

</head>


<body>
<nav class="row">
<%= form_tag(recipes_path, :method => "get", id: "search-form") do %>
<%= text_field_tag :search, params[:search], placeholder: "Search for Munchables Here" %>
<%= submit_tag "Search", :name => nil, class: "form_submit" %>
<% end %>
</nav>


<%= yield %>

<%= yield %>
<footer class= "row">
<p class="small-3 columns large-6 columns">Website built by Dianne Laguerta.</p>
<p class="small-3 columns large-6 columns"> Recipes powered by <a href="https://www.edamam.com/">Edamam.</a></p>
</footer>

</body>
</html>
19 changes: 19 additions & 0 deletions app/views/recipes/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<% if @recipes.blank? %>
<h4>There are no recipes containing the term <%= params[:search] %>.</h4>
<% else %>
<h1 class="large-11 small-centered columns">Results for <%= "#{params[:search]}" %> </h1>
<div class = "row page-bar"><%= will_paginate @recipes, :container => false %></div>
<section class="row small-up-1 medium-up-2 large-up-4">
<% @recipes.each do |recipe| %>
<% uri_id = recipe.uri.split("_").last %>

<p class="column">
<br></br>
<%= link_to recipe_path(uri_id) do %>
<%= image_tag "#{ recipe.photo}" %>
<% end %>
<%= link_to "#{ recipe.name}", recipe_path(uri_id)%>
</p>
<% end %>
</section>
<% end %>
Loading