• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修訂a0d1af6c8633494b5063f5f66f64b3306aad8ef6 (tree)
時間2012-05-22 11:01:29
作者Cory Johns <johnsca@geek...>
CommiterTim Van Steenburgh

Log Message

[#3592] Prevent submitting new project form if errors

Signed-off-by: Cory Johns <johnsca@geek.net>

Change Summary

差異

--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -288,10 +288,10 @@ class NeighborhoodAddProjectForm(ForgeForm):
288288 yield ew.JSScript('''
289289 $(function(){
290290 var $scms = $('input[type=checkbox].scm');
291- var $name_avail_message = $('#name_availability');
292291 var $name_input = $('input[name="%(project_name)s"]');
293292 var $unixname_input = $('input[name="%(project_unixname)s"]');
294293 var $url_fragment = $('#url_fragment');
294+ var $form = $name_input.closest('form');
295295 var delay = (function(){
296296 var timers = {};
297297 return function(callback, ms){
@@ -317,6 +317,14 @@ class NeighborhoodAddProjectForm(ForgeForm):
317317 $error_field.text(message).toggle(!!message);
318318 update_icon($input);
319319 };
320+ $form.submit(function(e) {
321+ var has_errors = $name_input.add($unixname_input).nextAll('.error').is(':visible');
322+ if (has_errors || $name_input.val() == '' || $unixname_input.val() == '') {
323+ e.preventDefault();
324+ alert('You must resolve the issues with the project name.');
325+ return false;
326+ }
327+ });
320328 $scms.change(function(){
321329 if ( $(this).attr('checked') ) {
322330 var on = this;