Commit c5336b2eec00696cd185fdff328f4b6ba38a272f
Committed by
Paulo Meireles
1 parent
55847003
Exists in
master
and in
28 other branches
[Mezuro] Fixed the previous repository validation commit.
Showing
1 changed file
with
21 additions
and
13 deletions
Show diff stats
plugins/mezuro/public/javascripts/validations.js
@@ -8,12 +8,6 @@ function validate_code(code){ | @@ -8,12 +8,6 @@ function validate_code(code){ | ||
8 | return true; | 8 | return true; |
9 | } | 9 | } |
10 | 10 | ||
11 | -function validate_new_repository() { | ||
12 | - if (allRequiredFieldsAreFilled())) | ||
13 | - return addressAndTypeMatch(); | ||
14 | - return false; | ||
15 | -} | ||
16 | - | ||
17 | function allRequiredFieldsAreFilled() { | 11 | function allRequiredFieldsAreFilled() { |
18 | var name = jQuery('#repository_name').val(); | 12 | var name = jQuery('#repository_name').val(); |
19 | var address = jQuery('#repository_address').val(); | 13 | var address = jQuery('#repository_address').val(); |
@@ -25,6 +19,13 @@ function allRequiredFieldsAreFilled() { | @@ -25,6 +19,13 @@ function allRequiredFieldsAreFilled() { | ||
25 | return true; | 19 | return true; |
26 | } | 20 | } |
27 | 21 | ||
22 | +function validate_new_repository() { | ||
23 | + if (allRequiredFieldsAreFilled()) { | ||
24 | + return addressAndTypeMatch(); | ||
25 | + } | ||
26 | + return false; | ||
27 | +} | ||
28 | + | ||
28 | function addressAndTypeMatch() { | 29 | function addressAndTypeMatch() { |
29 | var type = jQuery('#repository_type').val(); | 30 | var type = jQuery('#repository_type').val(); |
30 | var address = jQuery('#repository_address').val(); | 31 | var address = jQuery('#repository_address').val(); |
@@ -41,50 +42,57 @@ function addressAndTypeMatch() { | @@ -41,50 +42,57 @@ function addressAndTypeMatch() { | ||
41 | } | 42 | } |
42 | 43 | ||
43 | function matchBazaar(address) { | 44 | function matchBazaar(address) { |
44 | - if (address.match(/bzr/)) | 45 | + if (address.match(/bzr/)) { |
45 | return true; | 46 | return true; |
47 | + } | ||
46 | alert("Address does not match type BAZAAR chosen."); | 48 | alert("Address does not match type BAZAAR chosen."); |
47 | return false; | 49 | return false; |
48 | } | 50 | } |
49 | 51 | ||
50 | function matchCVS(address) { | 52 | function matchCVS(address) { |
51 | - if (address.match(/cvs/)) | 53 | + if (address.match(/cvs/)) { |
52 | return true; | 54 | return true; |
55 | + } | ||
53 | alert("Address does not match type CVS chosen."); | 56 | alert("Address does not match type CVS chosen."); |
54 | return false; | 57 | return false; |
55 | } | 58 | } |
56 | 59 | ||
57 | function matchGIT(address) { | 60 | function matchGIT(address) { |
58 | - if (address.match(/^(http(s)?:\/\/git(hub)?\.|git:\/\/git(hub\.com|orious\.org)\/|git@git(hub\.com|orious\.org):).+.git$/)) | 61 | + if (address.match(/^(http(s)?:\/\/git(hub)?\.|git:\/\/git(hub\.com|orious\.org)\/|git@git(hub\.com|orious\.org):).+.git$/)) { |
59 | return true; | 62 | return true; |
63 | + } | ||
60 | alert("Address does not match type GIT chosen."); | 64 | alert("Address does not match type GIT chosen."); |
61 | return false; | 65 | return false; |
62 | } | 66 | } |
63 | 67 | ||
64 | function matchMercurial(address) { | 68 | function matchMercurial(address) { |
65 | - if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) | 69 | + if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) { |
66 | return true; | 70 | return true; |
71 | + } | ||
67 | alert("Address does not match type MERCURIAL chosen."); | 72 | alert("Address does not match type MERCURIAL chosen."); |
68 | return false; | 73 | return false; |
69 | } | 74 | } |
70 | 75 | ||
71 | function matchRemoteTarball(address) { | 76 | function matchRemoteTarball(address) { |
72 | - if (address.match(/\.tar(\..+)*$/)) | 77 | + if (address.match(/\.tar(\..+)*$/)) { |
73 | return true; | 78 | return true; |
79 | + } | ||
74 | alert("Address does not match type REMOTE_TARBALL chosen."); | 80 | alert("Address does not match type REMOTE_TARBALL chosen."); |
75 | return false; | 81 | return false; |
76 | } | 82 | } |
77 | 83 | ||
78 | function matchRemoteZIP(address) { | 84 | function matchRemoteZIP(address) { |
79 | - if (address.match(/\.zip$/)) | 85 | + if (address.match(/\.zip$/)) { |
80 | return true; | 86 | return true; |
87 | + } | ||
81 | alert("Address does not match type REMOTE_ZIP chosen."); | 88 | alert("Address does not match type REMOTE_ZIP chosen."); |
82 | return false; | 89 | return false; |
83 | } | 90 | } |
84 | 91 | ||
85 | function matchSubversion(address) { | 92 | function matchSubversion(address) { |
86 | - if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) | 93 | + if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) { |
87 | return true; | 94 | return true; |
95 | + } | ||
88 | alert("Address does not match type SUBVERSION chosen."); | 96 | alert("Address does not match type SUBVERSION chosen."); |
89 | return false; | 97 | return false; |
90 | } | 98 | } |