[Notice] Announcing the End of Demo Server [Read me]

font family adjusted and form validator modified.
@14eca0299439d09f368d2975b474bd9345fc461c
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
... | ... | @@ -3055,5 +3055,5 @@ |
3055 | 3055 |
/* |
3056 | 3056 |
hr.dark-gray { border-top:1px solid #d4d4d4; } |
3057 | 3057 |
*/ |
3058 |
-.alert { position:absolute; width:830px; top:0px; /*top:76px;*/ margin-left:auto; z-index:999; } |
|
3058 |
+.alert { position:absolute; width:830px; top:0px; /*top:76px;*/ margin-left:auto; z-index:999; display:none; } |
|
3059 | 3059 |
form { margin:0 0 2px; }(No newline at end of file) |
--- app/assets/stylesheets/less/_variables.less
+++ app/assets/stylesheets/less/_variables.less
... | ... | @@ -9,7 +9,9 @@ |
9 | 9 |
@base-webfont-path: "/assets/images/webfont"; |
10 | 10 |
|
11 | 11 |
// Typography |
12 |
-@base-font-family: 'Droid Sans', Tahoma;/*, '돋움', Dotum, Arial, sans-serif;*/ |
|
12 |
+@base-font-family:"나눔고딕", "NanumGothic", "NanumGothicOTF", "맑은고딕", "Malgun Gothic", dotum, Arial; |
|
13 |
+/*'Droid Sans', Tahoma;*/ |
|
14 |
+/*, '돋움', Dotum, Arial, sans-serif;*/ |
|
13 | 15 |
@base-font-size : 13px; |
14 | 16 |
@base-line-height: 18px; |
15 | 17 |
@base-text-color : @gray-33; |
--- app/views/user/signup.scala.html
+++ app/views/user/signup.scala.html
... | ... | @@ -1,4 +1,5 @@ |
1 | 1 |
@(message: String, newUserForm: Form[User]) |
2 |
+@import utils.TemplateHelper._ |
|
2 | 3 |
|
3 | 4 |
@home(message, utils.MenuType.NONE) { |
4 | 5 |
@** Messages("title.signup") **@ |
... | ... | @@ -57,114 +58,20 @@ |
57 | 58 |
</div> |
58 | 59 |
</div> |
59 | 60 |
|
61 |
+ <script type="text/javascript" src="@getJSLink("lib/validate")"></script> |
|
60 | 62 |
<script type="text/javascript"> |
61 |
- var passwordField = $('#password'); |
|
62 |
- var emailField = $('#email'); |
|
63 |
- var loginIdField = $('#loginId'); |
|
64 |
- var passwordPlaceholder = passwordField.attr("placeholder"); |
|
65 |
- var errorMessage = { |
|
66 |
- required: { |
|
67 |
- title: "@Messages("validation.required")" |
|
68 |
- }, |
|
69 |
- duplicated: { |
|
70 |
- title: "@Messages("validation.duplicated")" |
|
71 |
- }, |
|
72 |
- passwordMismatch: { |
|
73 |
- title: "@Messages("validation.passwordMismatch")" |
|
74 |
- }, |
|
75 |
- tooShortPassword: { |
|
76 |
- title: "@Messages("validation.tooShortPassword")" |
|
77 |
- }, |
|
78 |
- invalidEmail: { |
|
79 |
- title: "@Messages("validation.invalidEmail")" |
|
80 |
- } |
|
81 |
- }; |
|
63 |
+ $(document).ready(function(){ |
|
64 |
+ var htErrorMessage = { |
|
65 |
+ "required" : {"title": "@Messages("validation.required")"}, |
|
66 |
+ "duplicated": {"title": "@Messages("validation.duplicated")"}, |
|
67 |
+ "passwordMismatch": {"title": "@Messages("validation.passwordMismatch")"}, |
|
68 |
+ "tooShortPassword": {"title": "@Messages("validation.tooShortPassword")"}, |
|
69 |
+ "invalidEmail": {"title": "@Messages("validation.invalidEmail")"} |
|
70 |
+ }; |
|
82 | 71 |
|
83 |
- // Bootstrap tooltip function has some limitation. |
|
84 |
- // In this case, tooltip doesn't provide easy way to change title and contents. |
|
85 |
- // So, unfortunately I had to change data value in directly. |
|
86 |
- var showErrorMessage = function(field, errorMessage){ |
|
87 |
- field.tooltip({trigger:'manual', placement: 'left'}); |
|
88 |
- var tooltip = field.data('tooltip'); |
|
89 |
- tooltip.options.title = errorMessage.title; |
|
90 |
- tooltip.options.content = errorMessage.content; |
|
91 |
- tooltip.options.placement = 'left'; |
|
92 |
- tooltip.options.trigger = 'manual'; |
|
93 |
- field.tooltip('show'); |
|
94 |
- } |
|
95 |
- var isExist = function(checkId, url){ |
|
96 |
- var checkPosition = checkId.next(".isValid"); |
|
97 |
- if( url[url.length-1] != "/" ) url = url.concat("/"); |
|
98 |
- $.ajax({ |
|
99 |
- url: url + checkId.val() |
|
100 |
- } |
|
101 |
- ).done(function(data){ |
|
102 |
- if(data.isExist === true){ |
|
103 |
- showErrorMessage(checkId, errorMessage.duplicated); |
|
104 |
- checkId.tooltip("show"); |
|
105 |
- } else { |
|
106 |
- checkId.tooltip("hide"); |
|
107 |
- try{ |
|
108 |
- checkId.tooltip("destory"); |
|
109 |
- } catch(err){} // to avoid boostrap bug |
|
110 |
- } |
|
111 |
- }); |
|
112 |
- }; |
|
113 |
- $("#loginId") |
|
114 |
- .focusout(function(){ |
|
115 |
- $(this).val( $(this).val().trim().toLowerCase().replace(/\s+/g, '')); //양쪽 공백을 없애고 소문자로 변경 후 중간 공백 없앰 |
|
116 |
- if ($(this).val() !== "") isExist($(this), "/user/isExist/"); |
|
117 |
- }); |
|
118 |
- $("#email").focusout(function(){ |
|
119 |
- if ($(this).val() !== "") isExist($(this), "/user/isEmailExist/"); |
|
120 |
- }); |
|
121 |
- |
|
122 |
- var validator = new FormValidator('signup', [{ |
|
123 |
- name: 'loginId', |
|
124 |
- rules: 'required|alpha_numeric' |
|
125 |
- }, |
|
126 |
- { |
|
127 |
- name: 'email', |
|
128 |
- rules: 'required|valid_email' |
|
129 |
- }, |
|
130 |
- { |
|
131 |
- name: 'password', |
|
132 |
- rules: 'required|min_length[4]' |
|
133 |
- }, |
|
134 |
- { |
|
135 |
- name: 'retypedPassword', |
|
136 |
- rules: 'required|matches[password]' |
|
137 |
- }], function(errors, event){ |
|
138 |
- if( errors.length > 0 ){ |
|
139 |
- console.log(errors); |
|
140 |
- switch(errors[0].id){ |
|
141 |
- case "retypedPassword" : |
|
142 |
- showErrorMessage(passwordField, errorMessage.passwordMismatch); |
|
143 |
- break; |
|
144 |
- case "password" : |
|
145 |
- showErrorMessage(passwordField, errorMessage.tooShortPassword); |
|
146 |
- break; |
|
147 |
- case "email" : |
|
148 |
- showErrorMessage(emailField, errorMessage.invalidEmail); |
|
149 |
- break; |
|
150 |
- case "loginId" : |
|
151 |
- showErrorMessage(loginIdField, errorMessage.required); |
|
152 |
- break; |
|
153 |
- default: |
|
154 |
- break; |
|
155 |
- } |
|
156 |
- } else { |
|
157 |
- try{ |
|
158 |
- passwordField.tooltip('destroy'); |
|
159 |
- emailField.tooltip('destroy'); |
|
160 |
- loginIdField.tooltip('destroy'); |
|
161 |
- } catch(err){ |
|
162 |
- console.log(err); |
|
163 |
- } // to avoid boostrap bug |
|
164 |
- } |
|
165 |
- }); |
|
166 |
- $('#retypedPassword').focusout(function(){ |
|
167 |
- validator._validateForm(); |
|
168 |
- }); |
|
72 |
+ $hive.loadModule("user.SignUp", { |
|
73 |
+ "htErrorMessage": htErrorMessage |
|
74 |
+ }); |
|
75 |
+ }); |
|
169 | 76 |
</script> |
170 | 77 |
} |
--- conf/messages.ko
+++ conf/messages.ko
... | ... | @@ -70,7 +70,7 @@ |
70 | 70 |
button.delete = 삭제 |
71 | 71 |
button.list = 목록 |
72 | 72 |
button.selectFile = 파일 선택 |
73 |
-button.comment.new = 댓글입력 |
|
73 |
+button.comment.new = 댓글 입력 |
|
74 | 74 |
button.autoNotification = 자동알림 |
75 | 75 |
button.excelDownload = Excel |
76 | 76 |
button.yes = 예 |
... | ... | @@ -79,8 +79,8 @@ |
79 | 79 |
button.add = 추가 |
80 | 80 |
button.login = 로그인 |
81 | 81 |
button.signup = 가입하기 |
82 |
-button.newProject = 여러분의 프로젝트를 만드세요. |
|
83 |
-button.detail = 상세조회 |
|
82 |
+button.newProject = 새 프로젝트 만들기 |
|
83 |
+button.detail = 자세히 |
|
84 | 84 |
button.apply = 적용 |
85 | 85 |
|
86 | 86 |
checkbox.commented = 댓글 |
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 |
milestone.state.all = 전체 |
94 | 94 |
milestone.state.open = 미완료 |
95 | 95 |
milestone.state.closed = 완료 |
96 |
-milestone.is.empty = 등록된 마일스톤이 없습니다. |
|
96 |
+milestone.is.empty = 등록된 마일스톤이 없습니다 |
|
97 | 97 |
milestone.menu.manage = 마일스톤 관리 |
98 | 98 |
milestone.menu.new = 새 마일스톤 |
99 | 99 |
milestone.none = 없음 |
--- public/javascripts/service/hive.project.New.js
+++ public/javascripts/service/hive.project.New.js
... | ... | @@ -70,22 +70,16 @@ |
70 | 70 |
var htRuleAccept = {"name":"accept", "rules":"required"}; // accept agreement |
71 | 71 |
var aRules = [htRuleName, htRuleAccept]; |
72 | 72 |
|
73 |
- htVar.oValidator = new FormValidator(htVar.sFormName, aRules, _onErrorValidate); |
|
73 |
+ htVar.oValidator = new FormValidator(htVar.sFormName, aRules, _onFormValidate); |
|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
/** |
77 | 77 |
* handler for validation errors. |
78 | 78 |
* callback should return an appropriate message for the given error |
79 | 79 |
*/ |
80 |
- function _onErrorValidate(aErrors){ |
|
81 |
- var htError = aErrors[0]; |
|
82 |
- var welTarget = $('div.n-alert[data-errType="' + htError.name + '"]'); |
|
83 |
- welTarget.show(); |
|
84 |
- |
|
85 |
- try { |
|
86 |
- return htError.message; |
|
87 |
- } finally { |
|
88 |
- welTarget = htError = null; |
|
80 |
+ function _onFormValidate(aErrors){ |
|
81 |
+ if(aErrors.length > 0){ |
|
82 |
+ $('div.n-alert[data-errType="' + aErrors[0].name + '"]').show(); |
|
89 | 83 |
} |
90 | 84 |
} |
91 | 85 |
|
+++ public/javascripts/service/hive.user.SignUp.js
... | ... | @@ -0,0 +1,172 @@ |
1 | +/** | |
2 | + * @(#)hive.user.SignUp.js 2013.04.02 | |
3 | + * | |
4 | + * Copyright NHN Corporation. | |
5 | + * Released under the MIT license | |
6 | + * | |
7 | + * http://hive.dev.naver.com/license | |
8 | + */ | |
9 | + | |
10 | +(function(ns){ | |
11 | + | |
12 | + var oNS = $hive.createNamespace(ns); | |
13 | + oNS.container[oNS.name] = function(htOptions){ | |
14 | + | |
15 | + var htVar = {}; | |
16 | + var htElement = {}; | |
17 | + | |
18 | + /** | |
19 | + * initialize | |
20 | + */ | |
21 | + function _init(htOptions){ | |
22 | + _initElement(htOptions); | |
23 | + _initVar(htOptions); | |
24 | + | |
25 | + _initFormValidator(); | |
26 | + } | |
27 | + | |
28 | + /** | |
29 | + * initialize elements | |
30 | + */ | |
31 | + function _initElement(htOptions){ | |
32 | + htElement.welInputPassword = $('#password'); | |
33 | + htElement.welInputEmail = $('#email'); | |
34 | + htElement.welInputLoginId = $('#loginId'); | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * initialize variables | |
39 | + */ | |
40 | + function _initVar(htOptions){ | |
41 | + htVar.rxTrim = /\s+/g; | |
42 | + htVar.htErrorMessage = htOptions.htErrorMessage || {}; | |
43 | + | |
44 | + // error definition | |
45 | + htVar.htErrors = { | |
46 | + "retypedPassword": { | |
47 | + "elTarget": htElement.welInputPassword, | |
48 | + "sMessage": htVar.htErrorMessage.passwordMismatch | |
49 | + }, | |
50 | + "password": { | |
51 | + "elTarget": htElement.welInputPassword, | |
52 | + "sMessage": htVar.htErrorMessage.tooShortPassword | |
53 | + }, | |
54 | + "email":{ | |
55 | + "elTarget": htElement.welInputEmail, | |
56 | + "sMessage": htVar.htErrorMessage.invalidEmail | |
57 | + }, | |
58 | + "loginId":{ | |
59 | + "elTarget": htElement.welInputLoginId, | |
60 | + "sMessage": htVar.htErrorMessage.required | |
61 | + } | |
62 | + }; | |
63 | + } | |
64 | + | |
65 | + /** | |
66 | + * Bootstrap toolTip function has some limitation. | |
67 | + * In this case, toolTip doesn't provide easy way to change title and contents. | |
68 | + * So, unfortunately I had to change data value in directly. | |
69 | + * @param {Wrapped Element} welInput | |
70 | + * @param {Hash Table} htMessage | |
71 | + */ | |
72 | + function showErrorMessage(welInput, htMessage){ | |
73 | + welInput.tooltip({trigger:'manual', placement: 'left'}); | |
74 | + | |
75 | + var oToolTip = welInput.data('tooltip'); | |
76 | + oToolTip.options.title = htMessage.title; | |
77 | + oToolTip.options.content = htMessage.content; | |
78 | + oToolTip.options.placement = 'left'; | |
79 | + oToolTip.options.trigger = 'manual'; | |
80 | + | |
81 | + welInput.tooltip('show'); | |
82 | + } | |
83 | + | |
84 | + /** | |
85 | + * @param {Wrapped Element} welCheckId | |
86 | + * @param {String} sURL | |
87 | + */ | |
88 | + function doesExists(welCheckId, sURL){ | |
89 | + var checkPosition = welCheckId.next(".isValid"); | |
90 | + if(sURL.substr(-1) != "/"){ | |
91 | + sURL += "/"; | |
92 | + } | |
93 | + | |
94 | + $.ajax( | |
95 | + {"url": sURL + welCheckId.val()} | |
96 | + ).done(function(data){ | |
97 | + if(data.doesExists === true){ | |
98 | + showErrorMessage(welCheckId, htVar.htErrorMessage.duplicated); | |
99 | + welCheckId.tooltip("show"); | |
100 | + } else { | |
101 | + welCheckId.tooltip("hide"); | |
102 | + try{ | |
103 | + welCheckId.tooltip("destory"); | |
104 | + } catch(err){} // to avoid boostrap bug | |
105 | + } | |
106 | + }); | |
107 | + } | |
108 | + | |
109 | + /** | |
110 | + * attach event | |
111 | + */ | |
112 | + function _attachEvent(){ | |
113 | + $("#loginId").focusout(function(){ | |
114 | + // 양쪽 공백을 없애고 소문자로 변경 후 중간 공백 없앰 | |
115 | + $(this).val($(this).val().trim().toLowerCase().replace(htVar.rxTrim, '')); | |
116 | + | |
117 | + if ($(this).val() !== "") { | |
118 | + doesExists($(this), "/user/doesExists/"); | |
119 | + } | |
120 | + }); | |
121 | + | |
122 | + $("#email").focusout(function(){ | |
123 | + if ($(this).val() !== "") { | |
124 | + doesExists($(this), "/user/isEmailExist/"); | |
125 | + } | |
126 | + }); | |
127 | + | |
128 | + $('#retypedPassword').focusout(function(){ | |
129 | + htVar.oValidator._validateForm(); | |
130 | + }); | |
131 | + } | |
132 | + | |
133 | + /** | |
134 | + * initialize FormValidator | |
135 | + * @require validate.js | |
136 | + */ | |
137 | + function _initFormValidator(){ | |
138 | + var aRules = [ | |
139 | + {"name": 'loginId', "rules": 'required|alpha_numeric'}, | |
140 | + {"name": 'email', "rules": 'required|valid_email'}, | |
141 | + {"name": 'password', "rules": 'required|min_length[4]'}, | |
142 | + {"name": 'retypedPassword', "rules": 'required|matches[password]'} | |
143 | + ]; | |
144 | + | |
145 | + htVar.oValidator = new FormValidator('signup', aRules, _onFormValidate); | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * on validate form | |
150 | + */ | |
151 | + function _onFormValidate(aErrors, event){ | |
152 | + if (aErrors.length > 0) { | |
153 | + var htError = htVar.htErrors[aErrors[0].id]; | |
154 | + if (htError) { | |
155 | + showErrorMessage(htError.elTarget, htError.sMessage); | |
156 | + } | |
157 | + } else { | |
158 | + // to avoid bootstrap bug | |
159 | + try { | |
160 | + htElement.welInputPassword.tooltip('destroy'); | |
161 | + htElement.welInputEmail.tooltip('destroy'); | |
162 | + htElement.welInputLoginId.tooltip('destroy'); | |
163 | + } catch (err) { | |
164 | +// console.log(err); | |
165 | + } | |
166 | + } | |
167 | + } | |
168 | + | |
169 | + | |
170 | + _init(htOptions); | |
171 | + }; | |
172 | +})("hive.user.SignUp");(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?