@@ -1,28 +1,28 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class Repository < ActiveRecord::Base |
|
18 | class Repository < ActiveRecord::Base | |
19 | belongs_to :project |
|
19 | belongs_to :project | |
20 | validates_presence_of :url |
|
20 | validates_presence_of :url | |
21 | validates_format_of :url, :with => /^(http|https|svn):\/\/.+/i |
|
21 | validates_format_of :url, :with => /^(http|https|svn|file):\/\/.+/i | |
22 |
|
22 | |||
23 | @scm = nil |
|
23 | @scm = nil | |
24 |
|
24 | |||
25 | def scm |
|
25 | def scm | |
26 | @scm ||= SvnRepos::Base.new url |
|
26 | @scm ||= SvnRepos::Base.new url | |
27 | end |
|
27 | end | |
28 | end |
|
28 | end |
@@ -1,37 +1,37 | |||||
1 | <%= error_messages_for 'project' %> |
|
1 | <%= error_messages_for 'project' %> | |
2 |
|
2 | |||
3 | <div class="box"> |
|
3 | <div class="box"> | |
4 | <!--[form:project]--> |
|
4 | <!--[form:project]--> | |
5 | <p><%= f.text_field :name, :required => true %></p> |
|
5 | <p><%= f.text_field :name, :required => true %></p> | |
6 |
|
6 | |||
7 | <% if admin_loggedin? and !@root_projects.empty? %> |
|
7 | <% if admin_loggedin? and !@root_projects.empty? %> | |
8 | <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p> |
|
8 | <p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p> | |
9 | <% end %> |
|
9 | <% end %> | |
10 |
|
10 | |||
11 | <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></p> |
|
11 | <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></p> | |
12 | <p><%= f.text_field :homepage, :size => 40 %></p> |
|
12 | <p><%= f.text_field :homepage, :size => 40 %></p> | |
13 | <p><%= f.check_box :is_public %></p> |
|
13 | <p><%= f.check_box :is_public %></p> | |
14 |
|
14 | |||
15 | <% for @custom_value in @custom_values %> |
|
15 | <% for @custom_value in @custom_values %> | |
16 | <p><%= custom_field_tag_with_label @custom_value %></p> |
|
16 | <p><%= custom_field_tag_with_label @custom_value %></p> | |
17 | <% end %> |
|
17 | <% end %> | |
18 |
|
18 | |||
19 | <% unless @custom_fields.empty? %> |
|
19 | <% unless @custom_fields.empty? %> | |
20 | <p><label><%=l(:label_custom_field_plural)%></label> |
|
20 | <p><label><%=l(:label_custom_field_plural)%></label> | |
21 | <% for custom_field in @custom_fields %> |
|
21 | <% for custom_field in @custom_fields %> | |
22 | <%= check_box_tag "custom_field_ids[]", custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %> |
|
22 | <%= check_box_tag "custom_field_ids[]", custom_field.id, ((@project.custom_fields.include? custom_field) or custom_field.is_for_all?), (custom_field.is_for_all? ? {:disabled => "disabled"} : {}) %> | |
23 | <%= custom_field.name %> |
|
23 | <%= custom_field.name %> | |
24 | <% end %></p> |
|
24 | <% end %></p> | |
25 | <% end %> |
|
25 | <% end %> | |
26 | <!--[eoform:project]--> |
|
26 | <!--[eoform:project]--> | |
27 | </div> |
|
27 | </div> | |
28 |
|
28 | |||
29 | <div class="box"><h3><%= check_box_tag "repository_enabled", 1, !@project.repository.nil?, :onclick => "Element.toggle('repository');" %> <%= l(:label_repository) %></h3> |
|
29 | <div class="box"><h3><%= check_box_tag "repository_enabled", 1, !@project.repository.nil?, :onclick => "Element.toggle('repository');" %> <%= l(:label_repository) %></h3> | |
30 | <%= hidden_field_tag "repository_enabled", 0 %> |
|
30 | <%= hidden_field_tag "repository_enabled", 0 %> | |
31 | <div id="repository"> |
|
31 | <div id="repository"> | |
32 | <% fields_for :repository, @project.repository, { :builder => TabularFormBuilder, :lang => current_language} do |repository| %> |
|
32 | <% fields_for :repository, @project.repository, { :builder => TabularFormBuilder, :lang => current_language} do |repository| %> | |
33 | <p><%= repository.text_field :url, :size => 60, :required => true %><br />(http://, https://, svn://)</p> |
|
33 | <p><%= repository.text_field :url, :size => 60, :required => true %><br />(http://, https://, svn://, file:///)</p> | |
34 | <% end %> |
|
34 | <% end %> | |
35 | </div> |
|
35 | </div> | |
36 | <%= javascript_tag "Element.hide('repository');" if @project.repository.nil? %> |
|
36 | <%= javascript_tag "Element.hide('repository');" if @project.repository.nil? %> | |
37 | </div> |
|
37 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now