Present "too many pending traces" message as a warning box
authorTom Hughes <tom@compton.nu>
Wed, 21 Jul 2010 23:20:31 +0000 (00:20 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 22 Jul 2010 19:47:34 +0000 (20:47 +0100)
app/controllers/trace_controller.rb
app/views/trace/_trace_form.html.erb

index d82308baa1163734a34218efe613bbfa7b7141b3..0ec033ae794f8549388b9ce71cdd3cc9625c082b 100644 (file)
@@ -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
index c6e755b1e5c45362242501fa026dadfd0fdc70e8..194b8b2bc920135d9e30a12065ead1a9d48b07ee 100644 (file)
@@ -1,7 +1,3 @@
-<% if @target_user.traces.count(:conditions => ["inserted=?", false]) > 4 %>
-  <p><%= t'trace.trace_header.traces_waiting', :count => @target_user.traces.count(:conditions => ["inserted=?", false]) %></p>
-<% end %>
-
 <% form_for :trace, @trace, :url => { :action => "create" }, :html => { :multipart => true } do |f| %>
 <table>
   <tr><td align="right"><%= t'trace.trace_form.upload_gpx' %></td><td><%= f.file_field :gpx_file, :size => 50, :maxlength => 255 %></td></tr>