Skip to content

Commit

Permalink
Merge pull request #102 from luiscoimbra/master
Browse files Browse the repository at this point in the history
added PasswordField type to forms
  • Loading branch information
jeromemacias committed Nov 7, 2014
2 parents 3cf368d + 71ccc2e commit cfae8a8
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/ng-admin.min.css

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions build/ng-admin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/ng-admin.min.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/javascripts/ng-admin/Crud/CrudModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define(function (require) {
CrudModule.directive('compile', require('ng-admin/Crud/component/directive/Compile'));

CrudModule.directive('stringField', require('ng-admin/Crud/component/directive/field/StringField'));
CrudModule.directive('passwordField', require('ng-admin/Crud/component/directive/field/PasswordField'));
CrudModule.directive('emailField', require('ng-admin/Crud/component/directive/field/EmailField'));
CrudModule.directive('textField', require('ng-admin/Crud/component/directive/field/TextField'));
CrudModule.directive('numberField', require('ng-admin/Crud/component/directive/field/NumberField'));
Expand All @@ -39,6 +40,7 @@ define(function (require) {
CrudModule.directive('callbackField', require('ng-admin/Crud/component/directive/field/CallbackField'));

CrudModule.directive('stringColumn', require('ng-admin/Crud/component/directive/column/StringColumn'));
CrudModule.directive('passwordColumn', require('ng-admin/Crud/component/directive/column/PasswordColumn'));
CrudModule.directive('emailColumn', require('ng-admin/Crud/component/directive/column/EmailColumn'));
CrudModule.directive('textColumn', require('ng-admin/Crud/component/directive/column/TextColumn'));
CrudModule.directive('numberColumn', require('ng-admin/Crud/component/directive/column/NumberColumn'));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
define(function(require) {
'use strict';

var angular = require('angular');
var passwordColumnView = require('text!../../../view/column/password.html');

function PasswordColumn() {
return {
restrict: 'E',
template: passwordColumnView
};
}

PasswordColumn.$inject = [];

return PasswordColumn;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
define(function(require) {
'use strict';

var angular = require('angular');
var passwordFieldView = require('text!../../../view/field/password.html');

function PasswordField() {
return {
restrict: 'E',
template: passwordFieldView
};
}

PasswordField.$inject = [];

return PasswordField;
});
7 changes: 7 additions & 0 deletions src/javascripts/ng-admin/Crud/view/column/password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div ng-switch="entity.getField(column.field.name()).isEditLink()">
<a ng-switch-when="true" ng-click="edit(entity)">
xxx
</a>

<span ng-switch-default>xxx</span>
</div>
2 changes: 2 additions & 0 deletions src/javascripts/ng-admin/Crud/view/datagrid.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<td ng-repeat="column in columns" ng-switch="column.field.type()">
<string-column ng-switch-when="string"></string-column>

<password-column ng-switch-when="password"></password-column>

<text-column ng-switch-when="text"></text-column>

<email-column ng-switch-when="email"></email-column>
Expand Down
2 changes: 2 additions & 0 deletions src/javascripts/ng-admin/Crud/view/edit-attribute.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<div class="col-sm-10" ng-if="field.edition() == 'editable'" ng-switch="field.type()">
<string-field ng-switch-when="string"></string-field>

<password-field ng-switch-when="password"></password-field>

<text-field ng-switch-when="text"></text-field>

<email-field ng-switch-when="email"></email-field>
Expand Down
6 changes: 6 additions & 0 deletions src/javascripts/ng-admin/Crud/view/field/password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<input id="{{ field.name() }}"
class="form-control"
type="password"
ng-model="field.value"
ng-required="field.validation().required"
maxlength="{{ field.validation.maxlength }}" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ define(function (require) {
'use strict';

var Configurable = require('ng-admin/Main/component/service/config/Configurable');
var availableTypes = ['number', 'string', 'text', 'boolean', 'wysiwyg', 'email', 'date', 'callback', 'choice'];
var availableTypes = ['number', 'string', 'text', 'boolean', 'wysiwyg', 'email', 'date', 'callback', 'choice', 'password'];
var availableEditions = ['read-only', 'editable'];

var defaultValueTransformer = function(value) {
Expand Down

0 comments on commit cfae8a8

Please sign in to comment.