diff --git a/app/routes/areas_routes.rb b/app/routes/areas_routes.rb index e13370a..3522ecf 100644 --- a/app/routes/areas_routes.rb +++ b/app/routes/areas_routes.rb @@ -17,7 +17,7 @@ class Sinatra::Application area.name = params[:name] if area.save - redirect '/' + redirect request.referrer || '/' else @errors = 'There was a problem updating the area.' erb :some_template @@ -33,7 +33,7 @@ class Sinatra::Application if area area.destroy - redirect '/' + redirect request.referrer || '/' else status 404 @errors = 'Area not found or not owned by the current user.' diff --git a/app/routes/tasks_routes.rb b/app/routes/tasks_routes.rb index 933f0d6..b3dd358 100644 --- a/app/routes/tasks_routes.rb +++ b/app/routes/tasks_routes.rb @@ -72,7 +72,7 @@ class Sinatra::Application end if task.update(task_attributes) - redirect '/' + redirect request.referrer || '/' else halt 400, 'There was a problem updating the task.' end @@ -100,7 +100,7 @@ class Sinatra::Application halt 404, 'Task not found.' unless task if task.destroy - redirect '/' + redirect request.referrer || '/' else halt 400, 'There was a problem deleting the task.' end diff --git a/app/views/tasks/_task.erb b/app/views/tasks/_task.erb index 5727ff3..504634e 100644 --- a/app/views/tasks/_task.erb +++ b/app/views/tasks/_task.erb @@ -5,18 +5,18 @@ <%= task.name %> -
+
<% if task.due_date %> <% if task.due_date.to_date == Date.today %> - - TODAY + + TODAY <% elsif task.due_date && task.due_date.to_date < Date.today %> - - <%= task.due_date.strftime("%Y-%m-%d") %> + + <%= task.due_date.strftime("%Y-%m-%d") %> <% else %> - + <%= task.due_date.strftime("%Y-%m-%d") %> <% end %>