Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
그룹 이름 변경 시 예외가 발생합니다. issue #810
Browse files Browse the repository at this point in the history
그룹 이름 변경 하는 부분 수정하였습니다.
  • Loading branch information
hyeok.oh committed Jan 5, 2015
1 parent eb33152 commit a4dee0c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/views/organization/setting.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div class="page-wrap-outer">
<div class="project-page-wrap">
@partial_settingmenu(organization)
<form id="saveSetting" method="post" action="@routes.OrganizationApp.updateOrganizationInfo(organization.name)" enctype="multipart/form-data" class="nm">
<form id="saveSetting" method="post" action="@routes.OrganizationApp.updateOrganizationInfo(organization.name)" enctype="multipart/form-data" class="nm" name="update-org">
<input type="hidden" name="id" value="@organization.id">
<div class="bubble-wrap gray">
<div class="box-wrap top clearfix frm-wrap" style="padding-top:20px;">
Expand Down Expand Up @@ -58,6 +58,7 @@
<input id="project-name" type="text" name="name" maxlength="250" value="@organization.name">
<div class="orange-txt">
@if(organizationForm.error("name") != null) { <span class="warning">@Messages(organizationForm.error("name").message())</span> }
<span class="msg wrongName" style="display: none;"></span>
</div>
</dd>
<dt>
Expand All @@ -70,7 +71,7 @@
</div>
</div>
<div class="box-wrap bottom">
<button id="save" type="submit" class="ybtn ybtn-success">@Messages("button.save")</button>
<button id="save" class="ybtn ybtn-success">@Messages("button.save")</button>
</div>
</form>
</div>
Expand Down
54 changes: 51 additions & 3 deletions public/javascripts/service/yobi.organization.Setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,28 @@
(function(ns){

var oNS = $yobi.createNamespace(ns);
oNS.container[oNS.name] = function(){
oNS.container[oNS.name] = function(htOptions){

var htVar = {};
var htElement = {};

/**
* initialize
*/
function _init(){
function _init(htOptions){
_initVar(htOptions);
_initElement();
_attachEvent();

_initFormValidator();
}

/**
* initialize variables
*/
function _initVar(htOptions){
htVar.sFormName = htOptions.sFormName || "update-org";
htVar.rxOrgName = /^[a-zA-Z0-9-]+([_.][a-zA-Z0-9-]+)*$/;
}

/**
Expand Down Expand Up @@ -60,7 +72,43 @@
htElement.welForm.submit();
}

_init();
/**
* initialize formValidator
* @require validate.js
*/
function _initFormValidator(){
// name : name of input element
// rules: rules to apply to the input element.
var aRules = [];

htVar.oValidator = new FormValidator(htVar.sFormName, aRules, function(aErrors){
var oForm = $(document.forms[htVar.sFormName]);
var oElement = oForm.find("input[name=name]");
var sOrgName = oElement.val();
if(!htVar.rxOrgName.test(sOrgName)){
aErrors.push({
id: oElement.attr("id"),
name: oElement.attr("name"),
message: Messages("organization.name.alert")
});
}
_onFormValidate(aErrors);
});
}

/**
* handler for validation errors.
*/
function _onFormValidate(aErrors){
if(aErrors.length > 0){
$('span.warning').hide();
$('span.msg').html(aErrors[0].message).show();
} else {
yobi.ui.Spinner.show();
}
}

_init(htOptions || {});
};

})("yobi.organization.Setting");

0 comments on commit a4dee0c

Please sign in to comment.