Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cameamea committed Aug 23, 2019
1 parent 569843e commit 20a7f70
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 58 deletions.
8 changes: 6 additions & 2 deletions app/assets/stylesheets/components/_cartel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
box-shadow: 0 0 15px rgba(0,0,0,0.1);
display: flex;
align-items: center;
margin: 20px;
// margin: 20px;
}

.card-items img {
// height: 100%;
height: 100%;
width: 200px;
object-fit: cover;
}
Expand Down Expand Up @@ -67,3 +67,7 @@
color: white;
}

.card-item-infos p {
font-size: 20px;
color: black;
}
4 changes: 4 additions & 0 deletions app/assets/stylesheets/components/_mealcard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
display: flex;
}

.cards-row {
flex: 0 0 60%;
}

.meal-card {
width: 100%;
position: relative;
Expand Down
37 changes: 20 additions & 17 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<h2>Log in</h2>
<div class="container">

<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-inputs">
<%= f.input :email,
required: false,
autofocus: true,
input_html: { autocomplete: "email" } %>
<%= f.input :password,
required: false,
input_html: { autocomplete: "current-password" } %>
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
</div>
<h2>Log in</h2>

<div class="form-actions">
<%= f.button :submit, "Log in" %>
</div>
<% end %>
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-inputs">
<%= f.input :email,
required: false,
autofocus: true,
input_html: { autocomplete: "email" } %>
<%= f.input :password,
required: false,
input_html: { autocomplete: "current-password" } %>
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
</div>

<%= render "devise/shared/links" %>
<div class="form-actions">
<%= f.button :submit, "Log in", class: "button" %>
</div>
<% end %>

<%= render "devise/shared/links" %>
</div>
4 changes: 2 additions & 2 deletions app/views/meals/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<!-- mosaic of meals -->
<div class="cards_and_map_container">
<div class="row">
<div class="row cards-row">
<% @meals.each do |meal| %>
<div class="box col-6">
<%= link_to meal_path(meal) do %>
Expand Down Expand Up @@ -108,7 +108,7 @@
</div>
<% end %>
</div>
<div id="map" style="width: 100%; height: 600px;"
<div id="map" style="width: 40%; height: 600px;"
data-markers="<%= @markers.to_json %>"
data-mapbox-api-key="<%= ENV['MAPBOX_API_KEY'] %>">
</div>
Expand Down
82 changes: 45 additions & 37 deletions app/views/meals/view_my_meals.html.erb
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
<h2> To be cooked ! </h2>
<% @my_received_orders.each do |order| %>
<% if order.status == "accepted" %>
<div class="card-items">
<%= cl_image_tag order.meal.photo %>
<div class="card-item-infos">
<%= order.meal.name %> - <%= order.user.email %> - status <%= order.status %>
<div class="container">
<h2 class="mt-3">To be cooked</h2>
<% @my_received_orders.each do |order| %>
<% if order.status == "accepted" %>
<div class="card-items">
<%= cl_image_tag order.meal.photo %>
<div class="card-item-infos">
<p><%= order.meal.name %></p>
<p><%= order.user.username %></p>
<p>Status <%= order.status %></p>
</div>
</div>
</div>
<% end %>
<% end %>
<% end %>

<h2> my received orders </h2>
<% @my_received_orders.each do |order| %>
<% if order.status != "accepted" %>
<div class="card-items">
<%= cl_image_tag order.meal.photo %>
<div class="card-item-infos">
<%= order.meal.name %> - <%= order.user.email %> - status <%= order.status %>
<p><%= link_to "Accept", change_status_order_path(order, :status => "accept"), method: :POST, class:"btn btn-outline-dark" %></p>
<p><%= link_to "Decline", change_status_order_path(order, :status => "decline"), method: :POST, class:"btn btn-outline-dark" %> </p>
<h2 class="mt-3">My received orders </h2>
<% @my_received_orders.each do |order| %>
<% if order.status != "accepted" %>
<div class="card-items">
<%= cl_image_tag order.meal.photo %>
<div class="card-item-infos">
<p><%= order.meal.name %></p>
<p><%= order.user.username %></p>
<p>Status <%= order.status %></p>
<p><%= link_to "Accept", change_status_order_path(order, :status => "accept"), method: :POST, class:"btn btn-outline-dark" %></p>
<p><%= link_to "Decline", change_status_order_path(order, :status => "decline"), method: :POST, class:"btn btn-outline-dark" %> </p>
</div>
</div>
</div>
<% end %>
<% end %>
<% end %>


<h2>my meals</h2>
<% @my_meals.each do |meal| %>
<div class="card-items" >
<%= cl_image_tag meal.photo %>
<div class="card-item-infos">
<h2><%= meal.name %></h2>
<p><%= meal.description %><%= meal.quantity_max %></p>
<h2 class="mt-3">My meals</h2>
<% @my_meals.each do |meal| %>
<div class="card-items" >
<%= cl_image_tag meal.photo %>
<div class="card-item-infos">
<p><%= meal.name %></p>
<% meal.categories.each do |category| %>
<span><%= category.name %></span>
<% end %>
<p><%= meal.quantity_max %></p>

<% if meal.can_delete? %>
<% if meal.can_delete? %>

<p><%= link_to "Edit", edit_meal_path(meal.id), class:"btn btn-outline-dark" %></p>
<p><%= link_to "Delete", meal_path(meal.id), class:"btn btn-outline-dark",
method: :delete,
data: { confirm: "Are you sure?" } %>
</p>
<p><%= link_to "Edit", edit_meal_path(meal.id), class:"btn btn-outline-dark" %></p>
<p><%= link_to "Delete", meal_path(meal.id), class:"btn btn-outline-dark",
method: :delete,
data: { confirm: "Are you sure?" } %>
</p>

<% end %>
<% end %>
</div>
</div>
</div>
<% end %>

<% end %>

</div>


0 comments on commit 20a7f70

Please sign in to comment.