diff --git a/app/controllers/cuisines_controller.rb b/app/controllers/cuisines_controller.rb index ef26e20..619f6c4 100644 --- a/app/controllers/cuisines_controller.rb +++ b/app/controllers/cuisines_controller.rb @@ -2,7 +2,7 @@ class CuisinesController < ApplicationController def index @q = Cuisine.ransack(params[:q]) @cuisines = @q.result(:distinct => true).includes(:dishes).page(params[:page]).per(10) - + @bookmark = Bookmark.new render("cuisines/index.html.erb") end diff --git a/app/controllers/dishes_controller.rb b/app/controllers/dishes_controller.rb index 84facab..49747c8 100644 --- a/app/controllers/dishes_controller.rb +++ b/app/controllers/dishes_controller.rb @@ -2,7 +2,8 @@ class DishesController < ApplicationController def index @q = Dish.ransack(params[:q]) @dishes = @q.result(:distinct => true).includes(:cuisine, :bookmarks, :fans, :specialists).page(params[:page]).per(10) - + @bookmark = Bookmark.new + @cuisines = Cuisine.all render("dishes/index.html.erb") end diff --git a/app/views/dishes/index.html.erb b/app/views/dishes/index.html.erb index bc51992..0f16f4f 100644 --- a/app/views/dishes/index.html.erb +++ b/app/views/dishes/index.html.erb @@ -1,112 +1,104 @@
-
+
+
+ +
<%= search_form_for @q, :class => "collapse", :id => "dishes_filters" do |f| %> +

Narrow results:

-
- <%= f.label :name_cont, "Name contains" %> - <%= f.text_field :name_cont, :class => "form-control", :placeholder => "Name contains" %> -
- -
- <%= f.label :created_at, "Created at" %> -
-
-
- <%= f.text_field :created_at_gteq, :class => "form-control", :placeholder => "Created at greater than or equal to" %> - - - -
-
- -
-
- <%= f.text_field :created_at_lteq, :class => "form-control", :placeholder => "Created at less than or equal to" %> - - - -
-
-
-
- - -
- <%= f.label :cuisine_name_cont, "Cuisine name contains" %> - <%= f.text_field :cuisine_name_cont, :class => "form-control", :placeholder => "Cuisine name contains" %> -
- -
- <%= f.label :bookmarks_notes_cont, "Bookmark notes contains" %> - <%= f.text_field :bookmarks_notes_cont, :class => "form-control", :placeholder => "Bookmark notes contains" %> -
- -
- <%= f.label :fans_username_cont, "User username contains" %> - <%= f.text_field :fans_username_cont, :class => "form-control", :placeholder => "User username contains" %> +
+ <%= f.label :name_cont, "Name contains" %> + <%= f.text_field :name_cont, :class => "form-control", :placeholder => "Name contains" %>
+ +
-
- <%= f.label :specialists_name_cont, "Venue name contains" %> - <%= f.text_field :specialists_name_cont, :class => "form-control", :placeholder => "Venue name contains" %> + <%= f.label :cuisine_id_eq_any, "Cuisine" %> + <% @cuisines.each do |cuisine| %> +
+ +
+ <% end %>
- <%= f.submit :class => "btn btn-primary btn-block mb-1" %> - + <%= f.submit :class => "btn btn-primary btn-block mb-1" %> + Clear filters + <% end %> Show Filters +
+
- - - + + + <% @dishes.each do |dish| %> - + - + + <% end %>
NameCuisineActionsThe very best...is at...
<%= dish.name %> - <% if dish.cuisine.present? %> - - <%= dish.cuisine.name %> + <%= dish.name %> + + <% if dish.bookmarks.find_by(:user_id => current_user.id).present? %> + + <%= dish.bookmarks.find_by(:user_id => current_user.id).venue.name %> + + + <% else %> +
+ + + + + + + + + +
+ + <%= select_tag(:venue_id, options_from_collection_for_select(Venue.all, :id, :name, @bookmark.venue_id), prompt:"Choose a venue...", :class => "form-control input-sm") %> +
+ + + + +
<% end %>
- Show - Edit - Delete + + + <% if dish.cuisine.present? %> + + <%= dish.cuisine.name %> + + <% end %> +
diff --git a/app/views/dishes/show.html.erb b/app/views/dishes/show.html.erb index 36415db..9825abb 100644 --- a/app/views/dishes/show.html.erb +++ b/app/views/dishes/show.html.erb @@ -1,162 +1,81 @@ - - -
-
-
-
Name
-
<%= @dish.name %>
- -
Cuisine
-
- <% if @dish.cuisine.present? %> - - <%= @dish.cuisine.name %> - - <% end %> -
- -
- - -
-
- -
-
+
+
+
+
+

You loved the <%= @dish.name %> at... + + <%= @dish.cuisine.name %> +

+
+
    -
  • - Bookmarks -
  • - - <% @dish.bookmarks.each do |bookmark| %> -
  • - - <%= bookmark.notes %> - - -
  • - <% end %> -
  • - - - - - - - -
    - - - <%= select_tag(:venue_id, options_from_collection_for_select(Venue.all, :id, :name), :class => "form-control") %> -
    - - - - - -
    - - - -
    - - -
    -
  • -
-
-
- - - -
-
-
    -
  • - Fans -
  • - - <% @dish.fans.each do |user| %> -
  • - - <%= user.username %> - -
    - - - - - - - - - + + + + + + + +
    + + + + + + <%= select_tag(:venue_id, options_from_collection_for_select(Venue.all, :id, :name), :class => "form-control", :prompt => "Choose a venue...") %>
    -
  • - <% end %> -
-
-
- - - -
-
-
+ + +
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 881e961..b51f355 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -41,13 +41,8 @@ -
- <%= f.label :created_at, "Created at" %> -
-
-
- <%= f.text_field :created_at_gteq, :class => "form-control", :placeholder => "Created at greater than or equal to" %> - - - -
-
- -
-
- <%= f.text_field :created_at_lteq, :class => "form-control", :placeholder => "Created at less than or equal to" %> - - - -
-
-
-
- - -
- <%= f.label :bookmarks_notes_cont, "Bookmark notes contains" %> - <%= f.text_field :bookmarks_notes_cont, :class => "form-control", :placeholder => "Bookmark notes contains" %> -
<%= f.label :neighborhood_name_cont, "Neighborhood name contains" %> <%= f.text_field :neighborhood_name_cont, :class => "form-control", :placeholder => "Neighborhood name contains" %>
-
- <%= f.label :fans_username_cont, "User username contains" %> - <%= f.text_field :fans_username_cont, :class => "form-control", :placeholder => "User username contains" %> -
+
- <%= f.label :specialties_name_cont, "Dish name contains" %> - <%= f.text_field :specialties_name_cont, :class => "form-control", :placeholder => "Dish name contains" %> + <%= f.label :specialties_name_cont, "Bookmarked dish name contains" %> + <%= f.text_field :specialties_name_cont, :class => "form-control", :placeholder => "Bookmarked dish name contains" %>
<%= f.submit :class => "btn btn-primary btn-block mb-1" %> @@ -101,9 +54,10 @@ Neighborhood Actions - + <% @venues.each do |venue| %> - + <% if venue.bookmarks.find_by(:user_id => current_user.id).present? %> + <%= venue.name %> <%= venue.address %> @@ -119,6 +73,7 @@ Delete + <%end%> <% end %> <%= paginate @venues, theme: 'twitter-bootstrap-4' %> diff --git a/app/views/venues/show.html.erb b/app/views/venues/show.html.erb index 3fc6f2d..12cea5d 100644 --- a/app/views/venues/show.html.erb +++ b/app/views/venues/show.html.erb @@ -48,7 +48,7 @@
  • Bookmarks
  • - + <% @venue.bookmarks.each do |bookmark| %>
  • diff --git a/config/routes.rb b/config/routes.rb index 6f92ce5..4372e87 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - root :to => "venues#index" + root :to => "dishes#index" # Routes for the Bookmark resource: # CREATE diff --git a/grades.yml b/grades.yml index 2f40b8d..3558ded 100644 --- a/grades.yml +++ b/grades.yml @@ -1,4 +1,4 @@ --- submission_url: https://grades.firstdraft.com project_token: '' -personal_access_token: +personal_access_token: aENQx7CCKcpTVTKgBU1zXCPE diff --git a/whitelist.yml b/whitelist.yml index ab11e34..6f0f67f 100644 --- a/whitelist.yml +++ b/whitelist.yml @@ -2,3 +2,8 @@ - 127.0.0.1 - 10.240.0.0/16 - "::1" +- 50.232.11.130 +- 128.135.98.148 +- 96.47.146.150 +- 203.141.155.157 +- 108.75.174.66