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

Commit

Permalink
Release 0.9.13
Browse files Browse the repository at this point in the history
  • Loading branch information
geoperez committed May 27, 2015
1 parent a46cb1a commit f6ba0fc
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 86 deletions.
46 changes: 27 additions & 19 deletions Unosquare.Tubular.Sample/ui/tubular/tubular-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,7 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
template: '<div ng-class="{ \'form-group\' : isEditing, \'has-error\' : !$valid }">' +
'<span ng-hide="isEditing">{{ value }}</span>' +
'<label ng-show="showLabel">{{ label }}</label>' +
'<select ng-options="d for d in options" ng-show="isEditing" ng-model="value" class="form-control" ' +
'<select ng-options="{{ selectOptions }}" ng-show="isEditing" ng-model="value" class="form-control" ' +
'ng-required="required" />' +
'<span class="help-block error-block" ng-show="isEditing" ng-repeat="error in state.$errors">' +
'{{error}}' +
Expand All @@ -2413,11 +2413,15 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
restrict: 'E',
replace: true,
transclude: true,
scope: angular.extend({ options: '=?', optionsUrl: '@', optionsMethod: '@?' }, tubularEditorService.defaultScope),
scope: angular.extend({ options: '=?', optionsUrl: '@', optionsMethod: '@?', optionLabel: '@?' }, tubularEditorService.defaultScope),
controller: [
'$scope', function ($scope) {
tubularEditorService.setupScope($scope);
$scope.dataIsLoaded = false;
$scope.selectOptions = "d for d in options";
if (angular.isDefined($scope.optionLabel)) {
$scope.selectOptions = "d." + $scope.optionLabel + " for d in options";
}

$scope.loadData = function() {
if ($scope.dataIsLoaded) return;
Expand All @@ -2434,7 +2438,7 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
$scope.value = '';

currentRequest.promise.then(
function(data) {
function (data) {
$scope.options = data;
$scope.dataIsLoaded = true;
$scope.value = value;
Expand Down Expand Up @@ -4247,6 +4251,17 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
};

me.pageRequest = function(request) {
var response = {
Counter: 0,
CurrentPage: 1,
FilteredRecordCount: 0,
TotalRecordCount: 0,
Payload: [],
TotalPages: 0
};

if (me.database.length == 0) return response;

var set = me.database;

// Get columns with sort
Expand All @@ -4260,11 +4275,11 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])

// Get filters (only Contains)
var filters = request.Columns
.filter(function (el) { return el.Filter != null && el.Filter.Text != null; })
.map(function (el) {
var obj = {};
if (el.Filter.Operator == 'Contains')
obj[el.Name] = el.Filter.Text;
.filter(function(el) { return el.Filter != null && el.Filter.Text != null; })
.map(function(el) {
var obj = {};
if (el.Filter.Operator == 'Contains')
obj[el.Name] = el.Filter.Text;

return obj;
});
Expand All @@ -4281,26 +4296,19 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])

// TODO: Free text search

var response = {
Counter: 0,
CurrentPage: 1,
FilteredRecordCount: set.length,
TotalRecordCount: set.length
};

response.FilteredRecordCount = set.length;
response.TotalRecordCount = set.length;
response.Payload = set.slice(request.Skip, request.Take + request.Skip);
response.TotalRecordCount = response.Payload.length;

response.TotalPages = (response.FilteredRecordCount + request.Take - 1) / request.Take;

if (response.TotalPages > 0) {
response.CurrentPage = 1 + ((request.Skip / response.FilteredRecordCount) * response.TotalPages);
response.CurrentPage = Math.trunc(1 + ((request.Skip / response.FilteredRecordCount) * response.TotalPages));
}

return response;
};

me.saveDataAsync = function (model, request) {
me.saveDataAsync = function(model, request) {
// TODO: COMPLETE
};

Expand Down
2 changes: 1 addition & 1 deletion Unosquare.Tubular.Sample/ui/tubular/tubular-bundle.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Unosquare.Tubular.Sample/ui/tubular/tubular-bundle.min.js.map

Large diffs are not rendered by default.

46 changes: 27 additions & 19 deletions Unosquare.Tubular/Javascript/tubular-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,7 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
template: '<div ng-class="{ \'form-group\' : isEditing, \'has-error\' : !$valid }">' +
'<span ng-hide="isEditing">{{ value }}</span>' +
'<label ng-show="showLabel">{{ label }}</label>' +
'<select ng-options="d for d in options" ng-show="isEditing" ng-model="value" class="form-control" ' +
'<select ng-options="{{ selectOptions }}" ng-show="isEditing" ng-model="value" class="form-control" ' +
'ng-required="required" />' +
'<span class="help-block error-block" ng-show="isEditing" ng-repeat="error in state.$errors">' +
'{{error}}' +
Expand All @@ -2413,11 +2413,15 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
restrict: 'E',
replace: true,
transclude: true,
scope: angular.extend({ options: '=?', optionsUrl: '@', optionsMethod: '@?' }, tubularEditorService.defaultScope),
scope: angular.extend({ options: '=?', optionsUrl: '@', optionsMethod: '@?', optionLabel: '@?' }, tubularEditorService.defaultScope),
controller: [
'$scope', function ($scope) {
tubularEditorService.setupScope($scope);
$scope.dataIsLoaded = false;
$scope.selectOptions = "d for d in options";
if (angular.isDefined($scope.optionLabel)) {
$scope.selectOptions = "d." + $scope.optionLabel + " for d in options";
}

$scope.loadData = function() {
if ($scope.dataIsLoaded) return;
Expand All @@ -2434,7 +2438,7 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
$scope.value = '';

currentRequest.promise.then(
function(data) {
function (data) {
$scope.options = data;
$scope.dataIsLoaded = true;
$scope.value = value;
Expand Down Expand Up @@ -4247,6 +4251,17 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])
};

me.pageRequest = function(request) {
var response = {
Counter: 0,
CurrentPage: 1,
FilteredRecordCount: 0,
TotalRecordCount: 0,
Payload: [],
TotalPages: 0
};

if (me.database.length == 0) return response;

var set = me.database;

// Get columns with sort
Expand All @@ -4260,11 +4275,11 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])

// Get filters (only Contains)
var filters = request.Columns
.filter(function (el) { return el.Filter != null && el.Filter.Text != null; })
.map(function (el) {
var obj = {};
if (el.Filter.Operator == 'Contains')
obj[el.Name] = el.Filter.Text;
.filter(function(el) { return el.Filter != null && el.Filter.Text != null; })
.map(function(el) {
var obj = {};
if (el.Filter.Operator == 'Contains')
obj[el.Name] = el.Filter.Text;

return obj;
});
Expand All @@ -4281,26 +4296,19 @@ angular.module('a8m.group-by', ['a8m.filter-watcher'])

// TODO: Free text search

var response = {
Counter: 0,
CurrentPage: 1,
FilteredRecordCount: set.length,
TotalRecordCount: set.length
};

response.FilteredRecordCount = set.length;
response.TotalRecordCount = set.length;
response.Payload = set.slice(request.Skip, request.Take + request.Skip);
response.TotalRecordCount = response.Payload.length;

response.TotalPages = (response.FilteredRecordCount + request.Take - 1) / request.Take;

if (response.TotalPages > 0) {
response.CurrentPage = 1 + ((request.Skip / response.FilteredRecordCount) * response.TotalPages);
response.CurrentPage = Math.trunc(1 + ((request.Skip / response.FilteredRecordCount) * response.TotalPages));
}

return response;
};

me.saveDataAsync = function (model, request) {
me.saveDataAsync = function(model, request) {
// TODO: COMPLETE
};

Expand Down
2 changes: 1 addition & 1 deletion Unosquare.Tubular/Javascript/tubular-bundle.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Unosquare.Tubular/Javascript/tubular-bundle.min.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
template: '<div ng-class="{ \'form-group\' : isEditing, \'has-error\' : !$valid }">' +
'<span ng-hide="isEditing">{{ value }}</span>' +
'<label ng-show="showLabel">{{ label }}</label>' +
'<select ng-options="d for d in options" ng-show="isEditing" ng-model="value" class="form-control" ' +
'<select ng-options="{{ selectOptions }}" ng-show="isEditing" ng-model="value" class="form-control" ' +
'ng-required="required" />' +
'<span class="help-block error-block" ng-show="isEditing" ng-repeat="error in state.$errors">' +
'{{error}}' +
Expand All @@ -358,11 +358,15 @@
restrict: 'E',
replace: true,
transclude: true,
scope: angular.extend({ options: '=?', optionsUrl: '@', optionsMethod: '@?' }, tubularEditorService.defaultScope),
scope: angular.extend({ options: '=?', optionsUrl: '@', optionsMethod: '@?', optionLabel: '@?' }, tubularEditorService.defaultScope),
controller: [
'$scope', function ($scope) {
tubularEditorService.setupScope($scope);
$scope.dataIsLoaded = false;
$scope.selectOptions = "d for d in options";
if (angular.isDefined($scope.optionLabel)) {
$scope.selectOptions = "d." + $scope.optionLabel + " for d in options";
}

$scope.loadData = function() {
if ($scope.dataIsLoaded) return;
Expand All @@ -379,7 +383,7 @@
$scope.value = '';

currentRequest.promise.then(
function(data) {
function (data) {
$scope.options = data;
$scope.dataIsLoaded = true;
$scope.value = value;
Expand Down
36 changes: 20 additions & 16 deletions Unosquare.Tubular/Javascript/tubular/tubular-services-localdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
};

me.pageRequest = function(request) {
var response = {
Counter: 0,
CurrentPage: 1,
FilteredRecordCount: 0,
TotalRecordCount: 0,
Payload: [],
TotalPages: 0
};

if (me.database.length == 0) return response;

var set = me.database;

// Get columns with sort
Expand All @@ -59,11 +70,11 @@

// Get filters (only Contains)
var filters = request.Columns
.filter(function (el) { return el.Filter != null && el.Filter.Text != null; })
.map(function (el) {
var obj = {};
if (el.Filter.Operator == 'Contains')
obj[el.Name] = el.Filter.Text;
.filter(function(el) { return el.Filter != null && el.Filter.Text != null; })
.map(function(el) {
var obj = {};
if (el.Filter.Operator == 'Contains')
obj[el.Name] = el.Filter.Text;

return obj;
});
Expand All @@ -80,26 +91,19 @@

// TODO: Free text search

var response = {
Counter: 0,
CurrentPage: 1,
FilteredRecordCount: set.length,
TotalRecordCount: set.length
};

response.FilteredRecordCount = set.length;
response.TotalRecordCount = set.length;
response.Payload = set.slice(request.Skip, request.Take + request.Skip);
response.TotalRecordCount = response.Payload.length;

response.TotalPages = (response.FilteredRecordCount + request.Take - 1) / request.Take;

if (response.TotalPages > 0) {
response.CurrentPage = 1 + ((request.Skip / response.FilteredRecordCount) * response.TotalPages);
response.CurrentPage = Math.trunc(1 + ((request.Skip / response.FilteredRecordCount) * response.TotalPages));
}

return response;
};

me.saveDataAsync = function (model, request) {
me.saveDataAsync = function(model, request) {
// TODO: COMPLETE
};

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tubular",
"version": "0.9.12",
"version": "0.9.13",
"description": "A set of AngularJS directives and designed to rapidly build modern web applications.",
"homepage": "http://unosquare.github.io/tubular",
"repository": {
Expand Down
Loading

0 comments on commit f6ba0fc

Please sign in to comment.