Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: 2Toad/xtform
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: development
Choose a base ref
...
head repository: refactorthis/xtform
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: development
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 9 commits
  • 13 files changed
  • 5 contributors

Commits on Feb 17, 2015

  1. Use object property bracket notation around Javascript keywords to fi…

    …x IE8 compatibility issues.
    
    Fixes refactorthis#20
    Ryan Wischkaemper committed Feb 17, 2015
    Copy the full SHA
    0d1ca50 View commit details

Commits on Apr 16, 2015

  1. Merge pull request refactorthis#28 from ryanwischkaemper/development

    Use object property bracket notation around Javascript keywords to fix I...
    refactorthis committed Apr 16, 2015
    Copy the full SHA
    49b9afc View commit details
  2. Merge pull request refactorthis#32 from 2Toad/development

    Added angular DI annotations via ng-annotate
    refactorthis committed Apr 16, 2015
    Copy the full SHA
    f37f384 View commit details
  3. chore: increment build version.

    McKendrick, Brent committed Apr 16, 2015
    Copy the full SHA
    11f9cef View commit details

Commits on Apr 22, 2015

  1. Fixed a typo

    idreeshaddad committed Apr 22, 2015
    Copy the full SHA
    873fc1a View commit details

Commits on Apr 23, 2015

  1. Copy the full SHA
    97e2724 View commit details

Commits on Apr 29, 2015

  1. updated how xtValidationTooltip gets ngModel

    dkhunt27 committed Apr 29, 2015
    Copy the full SHA
    8fd156e View commit details
  2. added .bowerrc to fix bower_components location

    dkhunt27 committed Apr 29, 2015
    Copy the full SHA
    80da5fe View commit details

Commits on Apr 30, 2015

  1. Merge pull request refactorthis#37 from dkhunt27/development

    updated how xtValidationTooltip gets ngModel
    refactorthis committed Apr 30, 2015
    Copy the full SHA
    e0bc455 View commit details
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
### Change log

### 2.0.0
### 2.0.0-beta.2

* Fixes for IE8
* Minification support using ngAnnotate in build

### 2.0.0-beta.1

Completely re-imagined and rewritten from 1.0. Now includes multiple new features:
* Inline, form summary & tooltip validation styles
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xtform",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"homepage": "https://github.com/refactorthis/xtform",
"authors": [
"Brent McKendrick <www.brentmckendrick.com>"
2 changes: 1 addition & 1 deletion component/inline/validationInline.dir.js
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ xtForm.directive('xtValidationInline', function ($templateCache) {
},
link: function (scope, element, attrs) {

var inputId = attrs.for || attrs.xtValidationInline;
var inputId = attrs['for'] || attrs.xtValidationInline;
if (angular.isUndefined(inputId)) {
throw new Error('The validation input id must be specified eg. for="id"');
}
2 changes: 1 addition & 1 deletion component/inline/validationInline.test.js
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ describe('inline validation directive', function () {
expect(function () {
var tmp = '<form xt-form><xt-validation-inline for="el1"></xt-validation-inline></form>';
setTemplate(tmp);
}).toThrow(new Error('Can not find the input element for the validation directive'));
}).toThrow(new Error('Can not find input element for the validation directive'));
});

it('should add xt-validation-inline class to element', function () {
28 changes: 10 additions & 18 deletions component/tooltip/validationTooltip.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
xtForm.directive('xtValidationTooltip', function ($timeout) {
xtForm.directive('xtValidationTooltip', function () {
'use strict';

return {
require: '^xtForm',
require: ['^xtForm', '^ngModel'],
restrict: 'EA',
link: function (scope, element, attrs, xtForm) {
link: function (scope, element, attrs, ctrls) {

var ngModelElement,
ngModel,
lastErrors;
var xtForm = ctrls[0];
var ngModel = ctrls[1];

var ngModelElement;
var lastErrors;

/**
* Activates the directive
@@ -48,7 +50,7 @@ xtForm.directive('xtValidationTooltip', function ($timeout) {
function setupNgModel() {

// allow for a different tooltip container that is not on the ngModel element
var ngModelElementId = attrs.for || attrs.xtValidationTooltip;
var ngModelElementId = attrs['for'] || attrs.xtValidationTooltip;
ngModelElement = ngModelElementId ?
angular.element(document.getElementById(ngModelElementId)) :
element;
@@ -58,16 +60,6 @@ xtForm.directive('xtValidationTooltip', function ($timeout) {
if (!!ngModelElement.attr('required')) {
ngModelElement.attr('aria-required', true);
}

// TODO This is a HACK to ensure the ngModel controller is created on the element before usage.
// FIXME this should be removed and replaced with an alternative method perhaps on the ngModel directive
// to register with xtform controller
$timeout(function () {
ngModel = ngModelElement.controller('ngModel');
if (!ngModel) {
throw new Error('Cannot find ngModel element for xtValidationTooltip');
}
});
}

function redrawErrors() {
@@ -107,4 +99,4 @@ xtForm.directive('xtValidationTooltip', function ($timeout) {
activate();
}
};
});
});
115 changes: 54 additions & 61 deletions dist/xtForm.js
Original file line number Diff line number Diff line change
@@ -301,7 +301,7 @@ xtForm.directive('xtValidationInline', ["$templateCache", function ($templateCac
},
link: function (scope, element, attrs) {

var inputId = attrs.for || attrs.xtValidationInline;
var inputId = attrs['for'] || attrs.xtValidationInline;
if (angular.isUndefined(inputId)) {
throw new Error('The validation input id must be specified eg. for="id"');
}
@@ -367,17 +367,62 @@ xtForm.directive('xtValidationInline', ["$templateCache", function ($templateCac
}
};
}]);
xtForm.directive('xtValidationTooltip', ["$timeout", function ($timeout) {
xtForm.directive('xtValidationSummary', ["$templateCache", function ($templateCache) {
'use strict';

return {
require: ['^xtForm', '^form'],
restrict: 'EA',
replace: true,
scope: true,
template: function (element, attrs) {
return $templateCache.get(attrs.templateUrl || 'xtForm/summary/validationSummary.html');
},
link: function (scope, element, attrs, ctrls) {

var form = ctrls[1];
scope.showLabel = (attrs.showLabel === 'true') || angular.isUndefined(attrs.showLabel);

function redrawErrors() {

scope.errors = [];
angular.forEach(form, function (ngModel, ngModelKey) {
if (ngModelKey[0] !== '$') {

// can show one error for each input, or multiple
var noOfErrors = attrs.multiple ? ngModel.$xtErrors.length : 1,
errors = ngModel.$xtErrors.slice(0, noOfErrors);

angular.forEach(errors, function (value) {
scope.errors.push({
key: value.key,
label: ngModel.$label,
message: value.message
});
});
}
});

scope.showErrors = scope.errors.length > 0;
}

scope.$on('XtForm.ErrorsUpdated', redrawErrors);
}
};
}]);
xtForm.directive('xtValidationTooltip', function () {
'use strict';

return {
require: '^xtForm',
require: ['^xtForm', '^ngModel'],
restrict: 'EA',
link: function (scope, element, attrs, xtForm) {
link: function (scope, element, attrs, ctrls) {

var ngModelElement,
ngModel,
lastErrors;
var xtForm = ctrls[0];
var ngModel = ctrls[1];

var ngModelElement;
var lastErrors;

/**
* Activates the directive
@@ -417,7 +462,7 @@ xtForm.directive('xtValidationTooltip', ["$timeout", function ($timeout) {
function setupNgModel() {

// allow for a different tooltip container that is not on the ngModel element
var ngModelElementId = attrs.for || attrs.xtValidationTooltip;
var ngModelElementId = attrs['for'] || attrs.xtValidationTooltip;
ngModelElement = ngModelElementId ?
angular.element(document.getElementById(ngModelElementId)) :
element;
@@ -427,16 +472,6 @@ xtForm.directive('xtValidationTooltip', ["$timeout", function ($timeout) {
if (!!ngModelElement.attr('required')) {
ngModelElement.attr('aria-required', true);
}

// TODO This is a HACK to ensure the ngModel controller is created on the element before usage.
// FIXME this should be removed and replaced with an alternative method perhaps on the ngModel directive
// to register with xtform controller
$timeout(function () {
ngModel = ngModelElement.controller('ngModel');
if (!ngModel) {
throw new Error('Cannot find ngModel element for xtValidationTooltip');
}
});
}

function redrawErrors() {
@@ -476,48 +511,6 @@ xtForm.directive('xtValidationTooltip', ["$timeout", function ($timeout) {
activate();
}
};
}]);
xtForm.directive('xtValidationSummary', ["$templateCache", function ($templateCache) {
'use strict';

return {
require: ['^xtForm', '^form'],
restrict: 'EA',
replace: true,
scope: true,
template: function (element, attrs) {
return $templateCache.get(attrs.templateUrl || 'xtForm/summary/validationSummary.html');
},
link: function (scope, element, attrs, ctrls) {

var form = ctrls[1];
scope.showLabel = (attrs.showLabel === 'true') || angular.isUndefined(attrs.showLabel);

function redrawErrors() {

scope.errors = [];
angular.forEach(form, function (ngModel, ngModelKey) {
if (ngModelKey[0] !== '$') {

// can show one error for each input, or multiple
var noOfErrors = attrs.multiple ? ngModel.$xtErrors.length : 1,
errors = ngModel.$xtErrors.slice(0, noOfErrors);

angular.forEach(errors, function (value) {
scope.errors.push({
key: value.key,
label: ngModel.$label,
message: value.message
});
});
}
});

scope.showErrors = scope.errors.length > 0;
}
});

scope.$on('XtForm.ErrorsUpdated', redrawErrors);
}
};
}]);
})();
Loading