From b551fef0b77af868ba1c6af933df551f54b5ec12 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 22 Jul 2010 00:20:31 +0100 Subject: [PATCH] Present "too many pending traces" message as a warning box --- app/controllers/trace_controller.rb | 4 ++++ app/views/trace/_trace_form.html.erb | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index d82308baa..0ec033ae7 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -143,6 +143,10 @@ class TraceController < ApplicationController logger.info("id is #{@trace.id}") flash[:notice] = t 'trace.create.trace_uploaded' + if @user.traces.count(:conditions => { :inserted => false }) > 4 + flash[:warning] = t 'trace.trace_header.traces_waiting', :count => @user.traces.count(:conditions => { :inserted => false }) + end + redirect_to :action => 'mine' end else diff --git a/app/views/trace/_trace_form.html.erb b/app/views/trace/_trace_form.html.erb index c6e755b1e..194b8b2bc 100644 --- a/app/views/trace/_trace_form.html.erb +++ b/app/views/trace/_trace_form.html.erb @@ -1,7 +1,3 @@ -<% if @target_user.traces.count(:conditions => ["inserted=?", false]) > 4 %> -

<%= t'trace.trace_header.traces_waiting', :count => @target_user.traces.count(:conditions => ["inserted=?", false]) %>

-<% end %> - <% form_for :trace, @trace, :url => { :action => "create" }, :html => { :multipart => true } do |f| %> -- 2.43.2
<%= t'trace.trace_form.upload_gpx' %><%= f.file_field :gpx_file, :size => 50, :maxlength => 255 %>