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