Skip to content

Commit

Permalink
layout
Browse files Browse the repository at this point in the history
	modified:   meals_controller.rb
	modified:   ../views/meals/_current_meals.html.erb
	modified:   ../views/meals/own_dated_meal.html.erb
	modified:   ../views/users/_provided_meals.html.erb
  • Loading branch information
Babsi committed Sep 21, 2012
1 parent e6fbf2d commit 348968a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion app/controllers/meals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def index
t = Time.now
dateToday = Date.new(t.year, t.month, t.day).to_s
@user_meals = Meal.find(:all, :conditions => ["user_id = ? AND time >=" << dateToday, current_user.id]) if current_user
@meals = Meal.find(:all)
@meals = Meal.find(:all, :order => "time DESC")


@storred_search_location = cookies[:storred_search_location]
Expand All @@ -39,6 +39,7 @@ def show
@meal = Meal.find(params[:id])
@meal_arrangement = MealArrangement.where(:meal_id => params[:id], :user_id => current_user.id).first if current_user
@user = User.find( @meal.user_id )
#@rating = Rating.where(:meal_id => params[:id], :user_id => current_user.id).first if current_user
end

def create
Expand Down
6 changes: 4 additions & 2 deletions app/views/meals/_current_meals.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<% if meal.city == @storred_search_location || meal.time.to_s == params[:date]%>
<div class ="each_meal_index" >
<div class="meal_title"><%= link_to meal.title, meal_path(meal.id) %></div>
<%= meal.zip_code %> <%= meal.city %>
<%= meal.zip_code %> <%= meal.city %> at
<%= link_to meal.user.first_name << 's', user_path(meal.id) %>
<div class="meal_icon">
<% if meal.vegetarien %>
<%= image_tag 'icon_veggie.png', :alt => "veggie", :title => "veggie" %>
Expand Down Expand Up @@ -43,7 +44,8 @@
<% else %>
<div class ="each_meal_index" >
<div class="meal_title"><%= link_to meal.title, meal_path(meal.id) %></div>
<%= meal.zip_code %> <%=meal.city %>
<%= meal.zip_code %> <%=meal.city %> at
<%= link_to meal.user.first_name, user_path(meal.id) %>
<div class="meal_icon">
<% if meal.vegetarien %>
<%= image_tag 'icon_veggie.png', :alt => "veggie", :title => "veggie" %>
Expand Down
8 changes: 3 additions & 5 deletions app/views/meals/own_dated_meal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<div class ="meal_info" >
<div class="meal_title"><%= link_to meal.title, meal_path(meal.id) %></div>
<%= meal.zip_code %> <%= meal.city %> at
<% @user.each do |user| %>
<%= link_to user.first_name << 's', user_path(user.id) %>
<% end %>
<%# @user.meal_id do |user| %>
<%= link_to meal.user.first_name << 's', user_path(meal.id) %>
<%# end %>
<div class="meal_icon">
<% if meal.vegetarien %>
<%= image_tag 'icon_veggie.png', :alt => "veggie", :title => "veggie" %>
Expand Down Expand Up @@ -43,8 +43,6 @@
<%= l meal.time, :format => :short %> - <%= meal.times.strftime('%H:%M') %><br />

</div>
<% else %>
<h2>No current dates</h2>
<% end %>
<% end %>
<% else %>
Expand Down
12 changes: 8 additions & 4 deletions app/views/users/_provided_meals.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="provided_meals">
<h4>Current Invitations</h4>
<% meals.each do |meal|%>
<%# if meal.time & meal.times %>
<% if meal.present? %>
<% time_to_check = meal.time + (meal.times.strftime("%H").to_i).hours - 3.hours + (meal.times.strftime("%M").to_i).minutes%>
<% if time_to_check > Time.now %>
<div class="display_meal">
Expand Down Expand Up @@ -93,15 +93,17 @@
<%end%>
</div>
<%end%>
<%# end %>
<% else %>
<h2> No current invitations! </h2>
<% end %>
<%end%>
</div>

<div id="provided_meals">
<h4>formerly cooked</h4>
<% meals.each do |meal|%>
<%# if meal.time.present? %>
<% if meal.present? %>
<% time_to_check = meal.time + (meal.times.strftime("%H").to_i).hours - 3.hours + (meal.times.strftime("%M").to_i).minutes%>
<% if time_to_check < Time.now %>
Expand Down Expand Up @@ -189,6 +191,8 @@
<%end%>
</div>
<%end%>
<%#end%>
<% else %>
<h2> No formerly Meals </h2>
<%end%>
<%end%>
</div>

0 comments on commit 348968a

Please sign in to comment.