]> source.dussan.org Git - redmine.git/commitdiff
Hiding the View Differences button when a wiki page's history only has one version.
authorEric Davis <edavis@littlestreamsoftware.com>
Wed, 20 Aug 2008 05:09:13 +0000 (05:09 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Wed, 20 Aug 2008 05:09:13 +0000 (05:09 +0000)
Patch contributed by Chaoqun Zou (#1743)

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1749 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/wiki/history.rhtml
test/functional/wiki_controller_test.rb

index c78ae115ad618b14e0f2e164dcc11ab9f3ee2759..7ce78a0f2f0001a7c6efd9e20b0b396a2617599b 100644 (file)
@@ -30,6 +30,6 @@
 <% end %>
 </tbody>
 </table>
-<%= submit_tag l(:label_view_diff), :class => 'small' %>
+<%= submit_tag l(:label_view_diff), :class => 'small' if show_diff %>
 <span class="pagination"><%= pagination_links_full @version_pages, @version_count, :page_param => :p %></span>
 <% end %>
index bbfdc8e7f2431f17a94fae298056fb0a08811718..b5325357c649e99ecd8e83b3929d51030216d664 100644 (file)
@@ -109,8 +109,18 @@ class WikiControllerTest < Test::Unit::TestCase
     assert_template 'history'
     assert_not_nil assigns(:versions)
     assert_equal 3, assigns(:versions).size
+    assert_select "input[type=submit][name=commit]"
   end
-  
+
+  def test_history_with_one_version
+    get :history, :id => 1, :page => 'Another_page'
+    assert_response :success
+    assert_template 'history'
+    assert_not_nil assigns(:versions)
+    assert_equal 1, assigns(:versions).size
+    assert_select "input[type=submit][name=commit]", false
+  end
+
   def test_diff
     get :diff, :id => 1, :page => 'CookBook_documentation', :version => 2, :version_from => 1
     assert_response :success