]> source.dussan.org Git - redmine.git/commitdiff
Show warning when exported issues exceed the limit (#13770).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Jan 2014 10:39:42 +0000 (10:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Jan 2014 10:39:42 +0000 (10:39 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12663 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/issues/index.html.erb
test/functional/issues_controller_test.rb

index 4c0528b7923454a8dd91ffe99d8f5b7cf694324a..41660f74178119232917a2df2e15730fb9fbe8a9 100644 (file)
 
 <% other_formats_links do |f| %>
   <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
-  <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
+  <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
   <%= f.link_to 'PDF', :url => params %>
 <% end %>
 
 <div id="csv-export-options" style="display:none;">
-  <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
+  <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>  
   <%= form_tag(params.merge({:format => 'csv',:page=>nil}), :method => :get, :id => 'csv-export-form') do %>
   <p>
     <label><%= radio_button_tag 'columns', '', true %> <%= l(:description_selected_columns) %></label><br />
   <p>
     <label><%= check_box_tag 'description', '1', @query.has_column?(:description) %> <%= l(:field_description) %></label>
   </p>
+  <% if @issue_count > Setting.issues_export_limit.to_i %>
+  <p class="icon icon-warning">
+    <%= l(:setting_issues_export_limit) %>: <%= Setting.issues_export_limit.to_i %>
+  </p>
+  <% end %>
   <p class="buttons">
     <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
     <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
index 89d47f45631e1cc7228948121250932f57908ba0..e42b85d40adba5b396bb3c0a8c859ab74d0357db 100644 (file)
@@ -373,6 +373,20 @@ class IssuesControllerTest < ActionController::TestCase
     assert_select 'form#csv-export-form[action=/issues.csv]'
   end
 
+  def test_index_should_not_warn_when_not_exceeding_export_limit
+    with_settings :issues_export_limit => 200 do
+      get :index
+      assert_select '#csv-export-options p.icon-warning', 0
+    end
+  end
+
+  def test_index_should_warn_when_exceeding_export_limit
+    with_settings :issues_export_limit => 2 do
+      get :index
+      assert_select '#csv-export-options p.icon-warning', :text => %r{limit: 2}
+    end
+  end
+
   def test_index_csv
     get :index, :format => 'csv'
     assert_response :success