[Notice] Announcing the End of Demo Server [Read me]
Jihan Kim 2013-04-02
font family adjusted and form validator modified.
@14eca0299439d09f368d2975b474bd9345fc461c
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -3055,5 +3055,5 @@
 /*
 hr.dark-gray { border-top:1px solid #d4d4d4; }
 */
-.alert { position:absolute; width:830px; top:0px; /*top:76px;*/ margin-left:auto; z-index:999; }
+.alert { position:absolute; width:830px; top:0px; /*top:76px;*/ margin-left:auto; z-index:999; display:none; }
 form { margin:0 0 2px; }
(No newline at end of file)
app/assets/stylesheets/less/_variables.less
--- app/assets/stylesheets/less/_variables.less
+++ app/assets/stylesheets/less/_variables.less
@@ -9,7 +9,9 @@
 @base-webfont-path: "/assets/images/webfont";
 
 // Typography
-@base-font-family: 'Droid Sans', Tahoma;/*, '돋움', Dotum, Arial, sans-serif;*/
+@base-font-family:"나눔고딕", "NanumGothic", "NanumGothicOTF", "맑은고딕", "Malgun Gothic", dotum, Arial; 
+/*'Droid Sans', Tahoma;*/
+/*, '돋움', Dotum, Arial, sans-serif;*/
 @base-font-size  : 13px;
 @base-line-height: 18px;
 @base-text-color : @gray-33;
app/views/topmenu.scala.html
--- app/views/topmenu.scala.html
+++ app/views/topmenu.scala.html
@@ -10,7 +10,7 @@
             <a href="@routes.Application.index()" class="logo"><span>HIVE</span></a>
 
 			<h1 class="page-title">
-				<span class="gray">/<a href="@routes.UserApp.userInfo(project.owner)">@project.owner</a>/</span><!-- 
+				<span class="gray">/ <a href="@routes.UserApp.userInfo(project.owner)">@project.owner</a> / </span><!-- 
 				 --><a href="@routes.ProjectApp.project(project.owner, project.name)">@project.name</a>
 			</h1>
 
app/views/user/signup.scala.html
--- app/views/user/signup.scala.html
+++ app/views/user/signup.scala.html
@@ -1,4 +1,5 @@
 @(message: String, newUserForm: Form[User])
+@import utils.TemplateHelper._
 
 @home(message, utils.MenuType.NONE) {
 	@** Messages("title.signup") **@
@@ -57,114 +58,20 @@
         </div>
     </div>
     
+    <script type="text/javascript" src="@getJSLink("lib/validate")"></script>
     <script type="text/javascript">
-        var passwordField = $('#password');
-        var emailField = $('#email');
-        var loginIdField = $('#loginId');
-        var passwordPlaceholder = passwordField.attr("placeholder");
-        var errorMessage = {
-            required: {
-                title: "@Messages("validation.required")"
-            },
-            duplicated: {
-                title: "@Messages("validation.duplicated")"
-            },
-            passwordMismatch: {
-                title: "@Messages("validation.passwordMismatch")"
-            },
-            tooShortPassword: {
-                title: "@Messages("validation.tooShortPassword")"
-            },
-            invalidEmail: {
-                title: "@Messages("validation.invalidEmail")"
-            }
-        };
+    	$(document).ready(function(){
+    		var htErrorMessage = {
+   				"required"  : {"title": "@Messages("validation.required")"},
+   				"duplicated": {"title": "@Messages("validation.duplicated")"},
+   				"passwordMismatch": {"title": "@Messages("validation.passwordMismatch")"},
+   				"tooShortPassword": {"title": "@Messages("validation.tooShortPassword")"},
+   				"invalidEmail": {"title": "@Messages("validation.invalidEmail")"}
+   			};
 
-        // Bootstrap tooltip function has some limitation.
-        // In this case, tooltip doesn't provide easy way to change title and contents.
-        // So, unfortunately I had to change data value in directly.
-        var showErrorMessage = function(field, errorMessage){
-                field.tooltip({trigger:'manual', placement: 'left'});
-                var tooltip = field.data('tooltip');
-                tooltip.options.title = errorMessage.title;
-                tooltip.options.content = errorMessage.content;
-                tooltip.options.placement = 'left';
-                tooltip.options.trigger = 'manual';
-                field.tooltip('show');
-        }
-        var isExist = function(checkId, url){
-            var checkPosition = checkId.next(".isValid");
-            if( url[url.length-1] != "/" ) url = url.concat("/");
-            $.ajax({
-                url: url + checkId.val()
-                }
-            ).done(function(data){
-                if(data.isExist === true){
-                    showErrorMessage(checkId, errorMessage.duplicated);
-                    checkId.tooltip("show");
-                } else {
-                    checkId.tooltip("hide");
-                    try{
-                        checkId.tooltip("destory");
-                    } catch(err){} // to avoid boostrap bug
-                }
-            });
-        };
-        $("#loginId")
-            .focusout(function(){
-                $(this).val( $(this).val().trim().toLowerCase().replace(/\s+/g, '')); //양쪽 공백을 없애고 소문자로 변경 후 중간 공백 없앰
-                if ($(this).val() !== "") isExist($(this), "/user/isExist/");
-            });
-        $("#email").focusout(function(){
-            if ($(this).val() !== "") isExist($(this), "/user/isEmailExist/");
-        });
-
-        var validator = new FormValidator('signup', [{
-            name: 'loginId',
-            rules: 'required|alpha_numeric'
-        },
-        {
-            name: 'email',
-            rules: 'required|valid_email'
-        },
-        {
-          name: 'password',
-          rules: 'required|min_length[4]'
-        },
-        {
-            name: 'retypedPassword',
-            rules: 'required|matches[password]'
-        }], function(errors, event){
-          if( errors.length > 0 ){
-            console.log(errors);
-            switch(errors[0].id){
-                case "retypedPassword" :
-                    showErrorMessage(passwordField, errorMessage.passwordMismatch);
-                    break;
-                case "password" :
-                    showErrorMessage(passwordField, errorMessage.tooShortPassword);
-                    break;
-                case "email" :
-                    showErrorMessage(emailField, errorMessage.invalidEmail);
-                    break;
-                case "loginId" :
-                    showErrorMessage(loginIdField, errorMessage.required);
-                    break;
-                default:
-                    break;
-            }
-          } else {
-            try{
-                passwordField.tooltip('destroy');
-                emailField.tooltip('destroy');
-                loginIdField.tooltip('destroy');
-            } catch(err){
-                console.log(err);
-            } // to avoid boostrap bug
-          }
-        });
-        $('#retypedPassword').focusout(function(){
-            validator._validateForm();
-        });
+    		$hive.loadModule("user.SignUp", {
+    			"htErrorMessage": htErrorMessage
+    		});
+    	});
     </script>
 }
conf/messages.ko
--- conf/messages.ko
+++ conf/messages.ko
@@ -70,7 +70,7 @@
 button.delete = 삭제
 button.list = 목록
 button.selectFile = 파일 선택
-button.comment.new = 댓글입력
+button.comment.new = 댓글 입력
 button.autoNotification = 자동알림
 button.excelDownload = Excel
 button.yes = 예
@@ -79,8 +79,8 @@
 button.add = 추가
 button.login = 로그인
 button.signup = 가입하기
-button.newProject = 여러분의 프로젝트를 만드세요.
-button.detail = 상세조회
+button.newProject = 새 프로젝트 만들기
+button.detail = 자세히
 button.apply = 적용
 
 checkbox.commented = 댓글
@@ -93,7 +93,7 @@
 milestone.state.all = 전체
 milestone.state.open = 미완료
 milestone.state.closed = 완료
-milestone.is.empty = 등록된 마일스톤이 없습니다.
+milestone.is.empty = 등록된 마일스톤이 없습니다
 milestone.menu.manage = 마일스톤 관리
 milestone.menu.new = 새 마일스톤
 milestone.none = 없음
public/javascripts/service/hive.project.New.js
--- public/javascripts/service/hive.project.New.js
+++ public/javascripts/service/hive.project.New.js
@@ -70,22 +70,16 @@
 			var htRuleAccept = {"name":"accept", "rules":"required"}; // accept agreement
 			var aRules = [htRuleName, htRuleAccept];
 			
-			htVar.oValidator = new FormValidator(htVar.sFormName, aRules, _onErrorValidate);
+			htVar.oValidator = new FormValidator(htVar.sFormName, aRules, _onFormValidate);
 		}
 
 		/**
 		 * handler for validation errors.
 		 * callback should return an appropriate message for the given error
 		 */
-		function _onErrorValidate(aErrors){
-			var htError = aErrors[0];
-			var welTarget = $('div.n-alert[data-errType="' + htError.name + '"]');
-			welTarget.show();
-			
-			try {
-				return htError.message;
-			} finally {
-				welTarget = htError = null;
+		function _onFormValidate(aErrors){
+			if(aErrors.length > 0){
+				$('div.n-alert[data-errType="' + aErrors[0].name + '"]').show();
 			}
 		}
 		
 
public/javascripts/service/hive.user.SignUp.js (added)
+++ public/javascripts/service/hive.user.SignUp.js
@@ -0,0 +1,172 @@
+/**
+ * @(#)hive.user.SignUp.js 2013.04.02
+ *
+ * Copyright NHN Corporation.
+ * Released under the MIT license
+ * 
+ * http://hive.dev.naver.com/license
+ */
+
+(function(ns){
+	
+	var oNS = $hive.createNamespace(ns);
+	oNS.container[oNS.name] = function(htOptions){
+		
+		var htVar = {};
+		var htElement = {};
+		
+		/**
+		 * initialize
+		 */
+		function _init(htOptions){
+			_initElement(htOptions);
+			_initVar(htOptions);
+			
+			_initFormValidator();
+		}
+		
+		/**
+		 * initialize elements
+		 */
+		function _initElement(htOptions){
+			htElement.welInputPassword = $('#password');
+			htElement.welInputEmail    = $('#email');
+			htElement.welInputLoginId  = $('#loginId');			
+		}
+		
+		/**
+		 * initialize variables
+		 */
+		function _initVar(htOptions){
+			htVar.rxTrim = /\s+/g;
+			htVar.htErrorMessage = htOptions.htErrorMessage || {}; 
+
+			// error definition
+		    htVar.htErrors = {
+		    	"retypedPassword": {
+		    		"elTarget": htElement.welInputPassword,
+		    		"sMessage": htVar.htErrorMessage.passwordMismatch
+		    	},
+		    	"password": {
+		    		"elTarget": htElement.welInputPassword,
+		    		"sMessage": htVar.htErrorMessage.tooShortPassword	    		
+		    	},
+		    	"email":{
+		    		"elTarget": htElement.welInputEmail,
+		    		"sMessage": htVar.htErrorMessage.invalidEmail	    		
+		    	},
+		    	"loginId":{
+		    		"elTarget": htElement.welInputLoginId,
+		    		"sMessage": htVar.htErrorMessage.required	    		
+		    	}
+		    };
+		}
+		
+		/**
+		 * Bootstrap toolTip function has some limitation.
+		 * In this case, toolTip doesn't provide easy way to change title and contents.
+		 * So, unfortunately I had to change data value in directly.
+		 * @param {Wrapped Element} welInput
+		 * @param {Hash Table} htMessage
+		 */
+		function showErrorMessage(welInput, htMessage){
+	        welInput.tooltip({trigger:'manual', placement: 'left'});
+	        
+	        var oToolTip = welInput.data('tooltip');
+	        oToolTip.options.title     = htMessage.title;
+	        oToolTip.options.content   = htMessage.content;
+	        oToolTip.options.placement = 'left';
+	        oToolTip.options.trigger   = 'manual';
+
+	        welInput.tooltip('show');
+		}
+		
+		/**
+		 * @param {Wrapped Element} welCheckId
+		 * @param {String} sURL
+		 */
+		function doesExists(welCheckId, sURL){
+		    var checkPosition = welCheckId.next(".isValid");
+		    if(sURL.substr(-1) != "/"){
+		    	sURL += "/";
+		    }
+		    
+		    $.ajax(
+		    	{"url": sURL + welCheckId.val()}
+		    ).done(function(data){
+		        if(data.doesExists === true){
+		            showErrorMessage(welCheckId, htVar.htErrorMessage.duplicated);
+		            welCheckId.tooltip("show");
+		        } else {
+		            welCheckId.tooltip("hide");
+		            try{
+		                welCheckId.tooltip("destory");
+		            } catch(err){} // to avoid boostrap bug
+		        }
+		    });
+		}
+
+		/**
+		 * attach event
+		 */
+		function _attachEvent(){
+			$("#loginId").focusout(function(){
+				// 양쪽 공백을 없애고 소문자로 변경 후 중간 공백 없앰
+				$(this).val($(this).val().trim().toLowerCase().replace(htVar.rxTrim, ''));
+				
+				if ($(this).val() !== "") {
+					doesExists($(this), "/user/doesExists/");
+				}
+			});
+			
+			$("#email").focusout(function(){
+			    if ($(this).val() !== "") {
+			    	doesExists($(this), "/user/isEmailExist/");
+			    }
+			});
+			
+			$('#retypedPassword').focusout(function(){
+			    htVar.oValidator._validateForm();
+			});
+		}
+
+		/**
+		 * initialize FormValidator
+		 * @require validate.js
+		 */
+		function _initFormValidator(){
+			var aRules = [
+	  			{"name": 'loginId',			"rules": 'required|alpha_numeric'},
+	  			{"name": 'email',			"rules": 'required|valid_email'},
+	  			{"name": 'password',		"rules": 'required|min_length[4]'},
+	  			{"name": 'retypedPassword', "rules": 'required|matches[password]'}
+	  		];
+
+			htVar.oValidator = new FormValidator('signup', aRules, _onFormValidate);
+		}
+		
+		/**
+		 * on validate form
+		 */
+		function _onFormValidate(aErrors, event){
+			if (aErrors.length > 0) {
+				var htError = htVar.htErrors[aErrors[0].id];
+				if (htError) {
+					showErrorMessage(htError.elTarget, htError.sMessage);
+				}
+			} else {
+				// to avoid bootstrap bug
+				try {
+					htElement.welInputPassword.tooltip('destroy');
+					htElement.welInputEmail.tooltip('destroy');
+					htElement.welInputLoginId.tooltip('destroy');
+				} catch (err) {
+//					console.log(err);
+				} 
+			}
+		}
+
+		
+		_init(htOptions);
+	};
+})("hive.user.SignUp");(파일 끝에 줄바꿈 문자 없음)
Add a comment
List