Revision 1297:0a574315af3e .svn/pristine/41

View differences:

.svn/pristine/41/41040292634caf486eab580143d2c52c3598e8c6.svn-base
1
<% if User.current.allowed_to?(:add_issue_watchers, @project) %>
2
<div class="contextual">
3
<%= link_to l(:button_add),
4
      {:controller => 'watchers', :action => 'new', :object_type => watched.class.name.underscore, :object_id => watched},
5
      :remote => true,
6
      :method => 'get' %>
7
</div>
8
<% end %>
9

  
10
<h3><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</h3>
11

  
12
<%= watchers_list(watched) %>
.svn/pristine/41/4159ae2540b71521a40b7a57fa4731829b5f161b.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 RepositoryDarcsTest < ActiveSupport::TestCase
21
  fixtures :projects
22

  
23
  include Redmine::I18n
24

  
25
  REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s
26
  NUM_REV = 6
27

  
28
  def setup
29
    @project = Project.find(3)
30
    @repository = Repository::Darcs.create(
31
                      :project      => @project,
32
                      :url          => REPOSITORY_PATH,
33
                      :log_encoding => 'UTF-8'
34
                      )
35
    assert @repository
36
  end
37

  
38
  def test_blank_path_to_repository_error_message
39
    set_language_if_valid 'en'
40
    repo = Repository::Darcs.new(
41
                          :project      => @project,
42
                          :identifier   => 'test',
43
                          :log_encoding => 'UTF-8'
44
                        )
45
    assert !repo.save
46
    assert_include "Path to repository can't be blank",
47
                   repo.errors.full_messages
48
  end
49

  
50
  def test_blank_path_to_repository_error_message_fr
51
    set_language_if_valid 'fr'
52
    str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)"
53
    str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
54
    repo = Repository::Darcs.new(
55
                          :project      => @project,
56
                          :url          => "",
57
                          :identifier   => 'test',
58
                          :log_encoding => 'UTF-8'
59
                        )
60
    assert !repo.save
61
    assert_include str, repo.errors.full_messages
62
  end
63

  
64
  if File.directory?(REPOSITORY_PATH)
65
    def test_fetch_changesets_from_scratch
66
      assert_equal 0, @repository.changesets.count
67
      @repository.fetch_changesets
68
      @project.reload
69

  
70
      assert_equal NUM_REV, @repository.changesets.count
71
      assert_equal 13, @repository.filechanges.count
72
      assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
73
    end
74

  
75
    def test_fetch_changesets_incremental
76
      assert_equal 0, @repository.changesets.count
77
      @repository.fetch_changesets
78
      @project.reload
79
      assert_equal NUM_REV, @repository.changesets.count
80

  
81
      # Remove changesets with revision > 3
82
      @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3}
83
      @project.reload
84
      assert_equal 3, @repository.changesets.count
85

  
86
      @repository.fetch_changesets
87
      @project.reload
88
      assert_equal NUM_REV, @repository.changesets.count
89
    end
90

  
91
    def test_entries
92
      entries = @repository.entries
93
      assert_kind_of Redmine::Scm::Adapters::Entries, entries
94
    end
95

  
96
    def test_entries_invalid_revision
97
      assert_equal 0, @repository.changesets.count
98
      @repository.fetch_changesets
99
      @project.reload
100
      assert_equal NUM_REV, @repository.changesets.count
101
      assert_nil @repository.entries('', '123')
102
    end
103

  
104
    def test_deleted_files_should_not_be_listed
105
      assert_equal 0, @repository.changesets.count
106
      @repository.fetch_changesets
107
      @project.reload
108
      assert_equal NUM_REV, @repository.changesets.count
109
      entries = @repository.entries('sources')
110
      assert entries.detect {|e| e.name == 'watchers_controller.rb'}
111
      assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
112
    end
113

  
114
    def test_cat
115
      if @repository.scm.supports_cat?
116
        assert_equal 0, @repository.changesets.count
117
        @repository.fetch_changesets
118
        @project.reload
119
        assert_equal NUM_REV, @repository.changesets.count
120
        cat = @repository.cat("sources/welcome_controller.rb", 2)
121
        assert_not_nil cat
122
        assert cat.include?('class WelcomeController < ApplicationController')
123
      end
124
    end
125
  else
126
    puts "Darcs test repository NOT FOUND. Skipping unit tests !!!"
127
    def test_fake; assert true end
128
  end
129
end
.svn/pristine/41/41786988141ecdd7b576a4ea632b825b99be0cde.svn-base
1
<div class="contextual">
2
<%= link_to l(:label_role_new), new_role_path, :class => 'icon icon-add' %>
3
<%= link_to l(:label_permissions_report), {:action => 'permissions'}, :class => 'icon icon-summary' %>
4
</div>
5

  
6
<h2><%=l(:label_role_plural)%></h2>
7

  
8
<table class="list">
9
  <thead><tr>
10
    <th><%=l(:label_role)%></th>
11
    <th><%=l(:button_sort)%></th>
12
  <th></th>
13
  </tr></thead>
14
  <tbody>
15
<% for role in @roles %>
16
  <tr class="<%= cycle("odd", "even") %>">
17
  <td><%= content_tag(role.builtin? ? 'em' : 'span', link_to(h(role.name), edit_role_path(role))) %></td>
18
  <td align="center" style="width:15%;">
19
  <% unless role.builtin? %>
20
    <%= reorder_links('role', {:action => 'update', :id => role}, :put) %>
21
  <% end %>
22
  </td>
23
  <td class="buttons">
24
    <%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %>
25
    <%= delete_link role_path(role) unless role.builtin? %>
26
  </td>
27
  </tr>
28
<% end %>
29
  </tbody>
30
</table>
31

  
32
<p class="pagination"><%= pagination_links_full @role_pages %></p>
33

  
34
<% html_title(l(:label_role_plural)) -%>
.svn/pristine/41/41bdbe14ebfd5b9a3ed45b99dc9b8907015a77f4.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 Redmine::MimeTypeTest < ActiveSupport::TestCase
21

  
22
  def test_of
23
    to_test = {'test.unk' => nil,
24
               'test.txt' => 'text/plain',
25
               'test.c' => 'text/x-c',
26
               }
27
    to_test.each do |name, expected|
28
      assert_equal expected, Redmine::MimeType.of(name)
29
    end
30
  end
31

  
32
  def test_css_class_of
33
    to_test = {'test.unk' => nil,
34
               'test.txt' => 'text-plain',
35
               'test.c' => 'text-x-c',
36
               }
37
    to_test.each do |name, expected|
38
      assert_equal expected, Redmine::MimeType.css_class_of(name)
39
    end
40
  end
41

  
42
  def test_main_mimetype_of
43
    to_test = {'test.unk' => nil,
44
               'test.txt' => 'text',
45
               'test.c' => 'text',
46
               }
47
    to_test.each do |name, expected|
48
      assert_equal expected, Redmine::MimeType.main_mimetype_of(name)
49
    end
50
  end
51

  
52
  def test_is_type
53
    to_test = {['text', 'test.unk'] => false,
54
               ['text', 'test.txt'] => true,
55
               ['text', 'test.c'] => true,
56
               }
57
    to_test.each do |args, expected|
58
      assert_equal expected, Redmine::MimeType.is_type?(*args)
59
    end
60
  end
61
end
.svn/pristine/41/41c73fb4f60b24cc907c3a2ceee1b536d0b32b8a.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# FileSystem adapter
5
# File written by Paul Rivier, at Demotera.
6
#
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU General Public License
9
# as published by the Free Software Foundation; either version 2
10
# of the License, or (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20

  
21
require 'redmine/scm/adapters/filesystem_adapter'
22

  
23
class Repository::Filesystem < Repository
24
  attr_protected :root_url
25
  validates_presence_of :url
26

  
27
  def self.human_attribute_name(attribute_key_name, *args)
28
    attr_name = attribute_key_name.to_s
29
    if attr_name == "url"
30
      attr_name = "root_directory"
31
    end
32
    super(attr_name, *args)
33
  end
34

  
35
  def self.scm_adapter_class
36
    Redmine::Scm::Adapters::FilesystemAdapter
37
  end
38

  
39
  def self.scm_name
40
    'Filesystem'
41
  end
42

  
43
  def supports_all_revisions?
44
    false
45
  end
46

  
47
  def fetch_changesets
48
    nil
49
  end
50
end
.svn/pristine/41/41cb6312d6e48c2a3277ea516aa018704a81dd1c.svn-base
1
$('#tab-content-users').html('<%= escape_javascript(render :partial => 'groups/users') %>');
2
<% @users.each do |user| %>
3
  $('#user-<%= user.id %>').effect("highlight");
4
<% end %>

Also available in: Unified diff