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 | 8 | return true; |
9 | 9 | } |
10 | 10 | |
11 | -function validate_new_repository() { | |
12 | - if (allRequiredFieldsAreFilled())) | |
13 | - return addressAndTypeMatch(); | |
14 | - return false; | |
15 | -} | |
16 | - | |
17 | 11 | function allRequiredFieldsAreFilled() { |
18 | 12 | var name = jQuery('#repository_name').val(); |
19 | 13 | var address = jQuery('#repository_address').val(); |
... | ... | @@ -25,6 +19,13 @@ function allRequiredFieldsAreFilled() { |
25 | 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 | 29 | function addressAndTypeMatch() { |
29 | 30 | var type = jQuery('#repository_type').val(); |
30 | 31 | var address = jQuery('#repository_address').val(); |
... | ... | @@ -41,50 +42,57 @@ function addressAndTypeMatch() { |
41 | 42 | } |
42 | 43 | |
43 | 44 | function matchBazaar(address) { |
44 | - if (address.match(/bzr/)) | |
45 | + if (address.match(/bzr/)) { | |
45 | 46 | return true; |
47 | + } | |
46 | 48 | alert("Address does not match type BAZAAR chosen."); |
47 | 49 | return false; |
48 | 50 | } |
49 | 51 | |
50 | 52 | function matchCVS(address) { |
51 | - if (address.match(/cvs/)) | |
53 | + if (address.match(/cvs/)) { | |
52 | 54 | return true; |
55 | + } | |
53 | 56 | alert("Address does not match type CVS chosen."); |
54 | 57 | return false; |
55 | 58 | } |
56 | 59 | |
57 | 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 | 62 | return true; |
63 | + } | |
60 | 64 | alert("Address does not match type GIT chosen."); |
61 | 65 | return false; |
62 | 66 | } |
63 | 67 | |
64 | 68 | function matchMercurial(address) { |
65 | - if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) | |
69 | + if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) { | |
66 | 70 | return true; |
71 | + } | |
67 | 72 | alert("Address does not match type MERCURIAL chosen."); |
68 | 73 | return false; |
69 | 74 | } |
70 | 75 | |
71 | 76 | function matchRemoteTarball(address) { |
72 | - if (address.match(/\.tar(\..+)*$/)) | |
77 | + if (address.match(/\.tar(\..+)*$/)) { | |
73 | 78 | return true; |
79 | + } | |
74 | 80 | alert("Address does not match type REMOTE_TARBALL chosen."); |
75 | 81 | return false; |
76 | 82 | } |
77 | 83 | |
78 | 84 | function matchRemoteZIP(address) { |
79 | - if (address.match(/\.zip$/)) | |
85 | + if (address.match(/\.zip$/)) { | |
80 | 86 | return true; |
87 | + } | |
81 | 88 | alert("Address does not match type REMOTE_ZIP chosen."); |
82 | 89 | return false; |
83 | 90 | } |
84 | 91 | |
85 | 92 | function matchSubversion(address) { |
86 | - if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) | |
93 | + if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) { | |
87 | 94 | return true; |
95 | + } | |
88 | 96 | alert("Address does not match type SUBVERSION chosen."); |
89 | 97 | return false; |
90 | 98 | } | ... | ... |