Fixes more of the umbcontentname directive - but we still have no design to show a validation message

This commit is contained in:
Shannon
2013-10-09 19:42:41 +11:00
parent 95a834b8b6
commit f7c49758e1
2 changed files with 8 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ angular.module("umbraco.directives")
ngModel.$render = function(){
$timeout(function(){
if(scope.model === ""){
if(!scope.model){
scope.goEdit();
}
}, 100);
@@ -37,7 +37,10 @@ angular.module("umbraco.directives")
scope.exitEdit = function(){
scope.editMode = false;
if(scope.model === ""){
if (!scope.model) {
//TODO: This will not solve the problem of showing validation!
// if this is a duplicate name the server will return a server side valiation
// message - and we still have no place for this to display.
scope.model = "Empty...";
}
};

View File

@@ -5,14 +5,15 @@
<h1 ng-click="goEdit()" ng-hide="editMode">{{model}}</h1>
<input
class="input-xlarge"
on-blur="exitEdit()"
ng-show="editMode"
name="name"
type="text"
placeholder="{{placeholder}}"
ng-model="model"
required
val-server-field="Name" />
required
val-server-field="Name" />
<span class="help-inline" val-msg-for="name" val-toggle-msg="required">Required</span>
<span class="help-inline" val-msg-for="name" val-toggle-msg="valServerField">{{contentNameForm.name.errorMsg}}</span>