Revision 1297:0a574315af3e .svn/pristine/18

View differences:

.svn/pristine/18/185221be249cc95bc5a89f3a18cf5915be456783.svn-base
1
<h2><%= l(:label_repository) %></h2>
2

  
3
<%= labelled_form_for :repository, @repository, :url => repository_path(@repository), :html => {:method => :put, :id => 'repository-form'} do |f| %>
4
  <%= render :partial => 'form', :locals => {:f => f} %>
5
<% end %>
.svn/pristine/18/188bc41fa6930021aca0286641aecbae4edbbdb9.svn-base
1
<%= error_messages_for 'message' %>
2
<% replying ||= false %>
3

  
4
<div class="box">
5
<!--[form:message]-->
6
<p><label for="message_subject"><%= l(:field_subject) %></label><br />
7
<%= f.text_field :subject, :size => 120, :id => "message_subject" %>
8

  
9
<% unless replying %>
10
  <% if @message.safe_attribute? 'sticky' %>
11
    <%= f.check_box :sticky %> <%= label_tag 'message_sticky', l(:label_board_sticky) %>
12
  <% end %>
13
  <% if @message.safe_attribute? 'locked' %>
14
    <%= f.check_box :locked %> <%= label_tag 'message_locked', l(:label_board_locked) %>
15
  <% end %>
16
<% end %>
17
</p>
18

  
19
<% if !replying && !@message.new_record? && @message.safe_attribute?('board_id') %>
20
  <p><label><%= l(:label_board) %></label><br />
21
  <%= f.select :board_id, boards_options_for_select(@message.project.boards) %></p>
22
<% end %>
23

  
24
<p>
25
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
26
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'message_content' %></p>
27
<%= wikitoolbar_for 'message_content' %>
28
<!--[eoform:message]-->
29

  
30
<p><%= l(:label_attachment_plural) %><br />
31
<%= render :partial => 'attachments/form', :locals => {:container => @message} %></p>
32
</div>
.svn/pristine/18/18d4843fce40636d9559a1afe5d262720f5f6601.svn-base
1
Copyright (c) 2007-2011 Collective Idea
2

  
3
Permission is hereby granted, free of charge, to any person obtaining
4
a copy of this software and associated documentation files (the
5
"Software"), to deal in the Software without restriction, including
6
without limitation the rights to use, copy, modify, merge, publish,
7
distribute, sublicense, and/or sell copies of the Software, and to
8
permit persons to whom the Software is furnished to do so, subject to
9
the following conditions:
10

  
11
The above copyright notice and this permission notice shall be
12
included in all copies or substantial portions of the Software.
13

  
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.svn/pristine/18/18ef0fecd81e51c21a37f84582d5c50bacf3c380.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require File.expand_path('../../test_helper', __FILE__)
19

  
20
class WikiContentVersionTest < ActiveSupport::TestCase
21
  fixtures :projects, :users, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
22

  
23
  def setup
24
  end
25

  
26
  def test_destroy
27
    v = WikiContent::Version.find(2)
28

  
29
    assert_difference 'WikiContent::Version.count', -1 do
30
      v.destroy
31
    end
32
  end
33

  
34
  def test_destroy_last_version_should_revert_content
35
    v = WikiContent::Version.find(3)
36

  
37
    assert_no_difference 'WikiPage.count' do
38
      assert_no_difference 'WikiContent.count' do
39
        assert_difference 'WikiContent::Version.count', -1 do
40
          assert v.destroy
41
        end
42
      end
43
    end
44
    c = WikiContent.find(1)
45
    v = c.versions.last
46
    assert_equal 2, c.version
47
    assert_equal v.version, c.version
48
    assert_equal v.comments, c.comments
49
    assert_equal v.text, c.text
50
    assert_equal v.author, c.author
51
    assert_equal v.updated_on, c.updated_on
52
  end
53

  
54
  def test_destroy_all_versions_should_delete_page
55
    WikiContent::Version.find(1).destroy
56
    WikiContent::Version.find(2).destroy
57
    v = WikiContent::Version.find(3)
58

  
59
    assert_difference 'WikiPage.count', -1 do
60
      assert_difference 'WikiContent.count', -1 do
61
        assert_difference 'WikiContent::Version.count', -1 do
62
          assert v.destroy
63
        end
64
      end
65
    end
66
    assert_nil WikiPage.find_by_id(1)
67
  end
68
end

Also available in: Unified diff