Chore: Replaced jQuery.focus() with a focus-on directive

This commit is contained in:
tanshu committed 2015-01-09 12:29:42 +05:30
1 parent e27424c41e
commit e0d3887fa9
70 files changed
+98 -260

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@ var AccountController = ['$scope', '$location', '$modal', 'account', 'accountTyp
$scope.delete();
});
};
$('#txtName').focus();
$scope.foName = true;
}];
AccountController.resolve = {
+21 -2
View File
@@ -153,7 +153,7 @@ overlordDirective.directive('onReturn', ['$parse', function ($parse) {
overlordDirective.directive('tanSse', ['$parse', function ($parse) {
return{
return {
restrict: 'EM',
link: function ($scope, element, attrs) {
var url = attrs.url,
@@ -371,9 +371,28 @@ overlordDirective.directive('fileUpload', function () {
//iterate files since 'multiple' may be specified on the element
for (var i = 0; i < files.length; i++) {
//emit event upward
scope.$emit("fileSelected", { file: files[i] });
scope.$emit("fileSelected", {file: files[i]});
}
});
}
};
});
overlordDirective.directive('focusOn', ['$timeout', function ($timeout) {
return {
restrict: 'A',
scope: {
focusOn: '='
},
link: function (scope, element, attrs) {
scope.$watch('focusOn', function (value) {
if (value === true) {
//$timeout(function () {
element[0].focus();
scope.focusOn = false;
//});
}
});
}
};
}]);
+1 -1
View File
@@ -15,7 +15,7 @@ var AttendanceController = ['$scope', '$location', 'asDateFilter', 'Attendance',
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtDate').focus();
$scope.foDate = true;
}];
var AttendanceSubController = ['$scope', function ($scope) {
+1 -1
View File
@@ -6,7 +6,7 @@ var BalanceSheetController = ['$scope', '$location', 'asDateFilter', 'info', fun
var date = asDate($scope.info.Date);
$location.path('/BalanceSheet/' + date);
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
BalanceSheetController.resolve = {
+1 -1
View File
@@ -7,7 +7,7 @@ var CashFlowController = ['$scope', '$routeParams', '$location', 'asDateFilter',
finishDate = asDate($scope.info.FinishDate);
$location.path('/CashFlow').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
CashFlowController.resolve = {
cashFlow: ['$route', 'CashFlow', function ($route, CashFlow) {
+1 -1
View File
@@ -51,7 +51,7 @@ var ClientController = ['$scope', '$location', '$modal', 'client', function ($sc
$scope.delete();
});
};
$('#txtName').focus();
$scope.foName = true;
}];
ClientController.resolve = {
+1 -1
View File
@@ -6,7 +6,7 @@ var ClosingStockController = ['$scope', '$location', 'asDateFilter', 'info', fun
var date = asDate($scope.info.Date);
$location.path('/ClosingStock/' + date);
};
$('#txtDate').focus();
$scope.foDate = true;
}];
ClosingStockController.resolve = {
+1 -1
View File
@@ -30,7 +30,7 @@ var CostCenterController = ['$scope', '$routeParams', '$location', 'costCenter',
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtName').focus();
$scope.foName = true;
}];
CostCenterController.resolve = {
+1 -1
View File
@@ -7,7 +7,7 @@ var DaybookController = ['$scope', '$location', 'asDateFilter', 'info', function
finishDate = asDate($scope.info.FinishDate);
$location.path('/Daybook').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
DaybookController.resolve = {
info: ['$route', 'Daybook', function ($route, Daybook) {
@@ -28,7 +28,7 @@ var EmployeeAttendanceController = ['$scope', '$location', '$routeParams', 'asDa
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtEmployee').focus();
$scope.foEmployee = true;
}];
var EmployeeAttendanceSubController = ['$scope', function ($scope) {
+1 -2
View File
@@ -124,8 +124,7 @@ var EmployeeController = ['$scope', '$routeParams', '$location', 'asDateFilter',
$scope.delete();
});
};
$('#txtName').focus();
$scope.foName = true;
}];
EmployeeController.resolve = {
+1 -1
View File
@@ -30,7 +30,7 @@ var GroupController = ['$scope', '$location', 'group', function ($scope, $locati
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtName').focus();
$scope.foName = true;
}];
GroupController.resolve = {
+2 -2
View File
@@ -33,7 +33,7 @@ var IssueController = ['$scope', '$routeParams', '$location', 'asDateFilter', 'v
oldInventory.Quantity += quantity;
delete $scope.batch;
delete $scope.quantity;
$('#txtBatch').focus();
$scope.foBatch = true;
}
if (angular.isUndefined(oldInventory) && (!consumption || quantity <= $scope.batch.QuantityRemaining)) {
@@ -49,7 +49,7 @@ var IssueController = ['$scope', '$routeParams', '$location', 'asDateFilter', 'v
});
delete $scope.batch;
delete $scope.quantity;
$('#txtBatch').focus();
$scope.foBatch = true;
}
};
$scope.removeInventory = function (inventory) {
+2 -2
View File
@@ -1,7 +1,7 @@
'use strict';
var JournalController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'Account', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, Account) {
$('#txtAccount').focus();
$scope.foAccount = true;
$scope.voucher = voucher;
$scope.debit = 1;
@@ -53,7 +53,7 @@ var JournalController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploa
}
delete $scope.account;
delete $scope.amount;
$('#txtAccount').focus();
$scope.foAccount = true;
};
$scope.removeJournal = function (journal) {
+2 -2
View File
@@ -25,9 +25,9 @@ var LedgerController = ['$scope', '$routeParams', '$location', 'asDateFilter', '
};
if ($routeParams.id) {
$('#gvGrid').focus();
$scope.foGrid = true;
} else {
$('#txtLedger').focus();
$scope.foLedger = true;
}
$scope.selected = -1;
+1 -1
View File
@@ -29,7 +29,7 @@ var LoginController = ['$scope', '$http', '$location', '$routeParams', '$cookieS
$scope.toasts.push({Type: 'Danger', Message: data});
});
};
$('#username').focus();
$scope.foUsername = true;
}];
var LogoutController = ['$scope', '$http', '$location', function ($scope, $http, $location) {
+1 -1
View File
@@ -33,7 +33,7 @@ var MessageController = ['$scope', '$location', 'asDateFilter', 'message', 'tags
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtTitle').focus();
$scope.foTitle = true;
}];
MessageController.resolve = {
+1 -1
View File
@@ -7,7 +7,7 @@ var NetTransactionsController = ['$scope', '$location', 'asDateFilter', 'netTran
finishDate = asDate($scope.info.FinishDate);
$location.path('/NetTransactions').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
NetTransactionsController.resolve = {
+2 -2
View File
@@ -1,7 +1,7 @@
'use strict';
var PaymentController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'ledgers', 'Account', function ($scope, $location, asDate, $modal, uploadedImageResizer, voucher, ledgers, Account) {
$('#txtAccount').focus();
$scope.foAccount = true;
$scope.voucher = voucher;
$scope.ledgers = ledgers;
@@ -50,7 +50,7 @@ var PaymentController = ['$scope', '$location', 'asDateFilter', '$modal', 'uploa
}
delete $scope.account;
delete $scope.amount;
$('#txtAccount').focus();
$scope.foAccount = true;
};
$scope.removeJournal = function (journal) {
+1 -1
View File
@@ -30,7 +30,7 @@ var ProductGroupController = ['$scope', '$location', 'productGroup', function ($
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtName').focus();
$scope.foName = true;
}];
ProductGroupController.resolve = {
+1 -2
View File
@@ -24,8 +24,7 @@ var ProductLedgerController = ['$scope', '$routeParams', '$location', 'asDateFil
$scope.products = function ($viewValue) {
return Product.autocomplete({term: $viewValue, count: 20}).$promise;
};
$('#txtProduct').focus();
$scope.foProduct = true;
}];
ProductLedgerController.resolve = {
productLedger: ['$route', 'ProductLedger', function ($route, ProductLedger) {
+1 -2
View File
@@ -128,8 +128,7 @@ var ProductController = ['$scope', '$location', '$window', '$modal', 'product',
$scope.delete();
});
};
$('#txtName').focus();
$scope.foName = true;
}];
ProductController.resolve = {
+1 -1
View File
@@ -7,7 +7,7 @@ var ProfitLossController = ['$scope', '$location', 'asDateFilter', 'profit_loss'
finishDate = asDate($scope.info.FinishDate);
$location.path('/ProfitLoss').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
ProfitLossController.resolve = {
+1 -1
View File
@@ -8,7 +8,7 @@ var PurchaseEntriesController = ['$scope', '$location', 'asDateFilter', 'purchas
finishDate = asDate($scope.info.FinishDate);
$location.path('/PurchaseEntries').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
PurchaseEntriesController.resolve = {
+1 -2
View File
@@ -53,8 +53,7 @@ var PurchaseReturnController = ['$scope', '$location', 'asDateFilter', '$modal',
});
delete $scope.batch;
delete $scope.quantity;
$('#txtBatch').val('');
$('#txtBatch').focus();
$scope.foBatch = true;
}
};
$scope.removeInventory = function (inventory) {
+1 -1
View File
@@ -56,7 +56,7 @@ var PurchaseController = ['$scope', '$location', 'asDateFilter', '$modal', 'uplo
delete $scope.quantity;
delete $scope.tax;
delete $scope.discount;
$('#txtProduct').focus();
$scope.foProduct = true;
}
};
$scope.removeInventory = function (inventory) {
+1 -1
View File
@@ -7,7 +7,7 @@ var RawMaterialCostController = ['$scope', '$location', 'asDateFilter', 'rawMate
finishDate = asDate($scope.info.FinishDate);
$location.path('/RawMaterialCost').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
RawMaterialCostController.resolve = {
+2 -3
View File
@@ -1,8 +1,7 @@
'use strict';
var ReceiptController = ['$scope', '$routeParams', '$location', 'asDateFilter', '$modal', 'uploadedImageResizer', 'voucher', 'ledgers', 'Voucher', 'Account', function ($scope, $routeParams, $location, asDate, $modal, uploadedImageResizer, voucher, ledgers, Voucher, Account) {
$('#txtAccount').focus();
$scope.foAccount = true;
$scope.voucher = voucher;
$scope.ledgers = ledgers;
function getOld(ledgerID, journals) {
@@ -50,7 +49,7 @@ var ReceiptController = ['$scope', '$routeParams', '$location', 'asDateFilter',
}
delete $scope.account;
delete $scope.amount;
$('#txtAccount').focus();
$scope.foAccount = true;
};
$scope.removeJournal = function (journal) {
+2 -2
View File
@@ -69,7 +69,7 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
}
delete $scope.quantity;
delete $scope.product;
$('#txtProduct').focus();
$scope.foProduct = true;
};
$scope.removeItem = function (item) {
@@ -155,7 +155,7 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
$scope.delete();
});
};
$('#txtName').focus();
$scope.foName = true;
$scope.products = function ($viewValue) {
return Product.autocomplete({term: $viewValue, count: 20, a: true, e: true, t: 'S'}).$promise;
+2 -2
View File
@@ -36,9 +36,9 @@ var ReconcileController = ['$scope', '$routeParams', '$location', 'asDateFilter'
};
if ($routeParams.id) {
$('#gvGrid').focus();
$scope.foGrid = true;
} else {
$('#txtLedger').focus();
$scope.foLedger = true;
}
$scope.selected = -1;
+1 -1
View File
@@ -79,7 +79,7 @@ var SalaryDeductionController = ['$scope', '$location', 'asDateFilter', '$modal'
delete $scope.employee;
delete $scope.grossSalary;
delete $scope.daysWorked;
$('#txtEmployee').focus();
$scope.foEmployee = true;
};
$scope.remove = function (deduction) {
+1 -1
View File
@@ -7,7 +7,7 @@ var StockMovementController = ['$scope', '$location', 'asDateFilter', 'stockMove
finishDate = asDate($scope.info.FinishDate);
$location.path('/StockMovement').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
$scope.foDate = true;
}];
StockMovementController.resolve = {
+1 -1
View File
@@ -5,7 +5,7 @@ var TrialBalanceController = ['$scope', '$location', 'asDateFilter', 'trialBalan
$scope.show = function () {
$location.path('/TrialBalance/' + asDate($scope.info.Date));
};
$('#txtDate').focus();
$scope.foDate = true;
}];
TrialBalanceController.resolve = {
trialBalance: ['$route', 'TrialBalance', function ($route, TrialBalance) {
+1 -1
View File
@@ -30,7 +30,7 @@ var UserController = ['$scope', '$location', 'user', function ($scope, $location
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$('#txtName').focus();
$scope.foName = true;
}];
UserController.resolve = {