Skip to content

Commit

Permalink
Released version 0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Jun 16, 2015
1 parent 2ad665e commit 9524390
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 37 deletions.
31 changes: 19 additions & 12 deletions ng-tasty-tpls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* ng-tasty
* https://github.com/Zizzamia/ng-tasty
* Version: 0.5.4 - 2015-05-04
* Version: 0.5.5 - 2015-06-15
* License: MIT
*/
angular.module("ngTasty", ["ngTasty.tpls", "ngTasty.component.table","ngTasty.filter.camelize","ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range","ngTasty.filter.slugify","ngTasty.service.bindTo","ngTasty.service.debounce","ngTasty.service.joinObjects","ngTasty.service.setProperty","ngTasty.service.tastyUtil","ngTasty.service.throttle","ngTasty.service.webSocket"]);
angular.module("ngTasty", ["ngTasty.tpls", "ngTasty.component.table","ngTasty.service.bindTo","ngTasty.service.debounce","ngTasty.service.joinObjects","ngTasty.service.setProperty","ngTasty.service.tastyUtil","ngTasty.service.throttle","ngTasty.service.webSocket","ngTasty.filter.camelize","ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range","ngTasty.filter.slugify"]);
angular.module("ngTasty.tpls", ["ngTasty.tpls.table.head","ngTasty.tpls.table.pagination"]);
/**
* @ngdoc directive
Expand Down Expand Up @@ -91,7 +91,11 @@ angular.module('ngTasty.component.table', [
this.config = {};
if (angular.isObject($scope.theme)) {
Object.keys(tableConfig).forEach(function(key) {
this.config[key] = $scope.theme[key] || tableConfig[key];
if (angular.isDefined($scope.theme[key])) {
this.config[key] = $scope.theme[key];
} else {
this.config[key] = tableConfig[key];
}
}, this);
} else {
this.config = tableConfig;
Expand Down Expand Up @@ -696,6 +700,7 @@ angular.module('ngTasty.component.table', [

setCount = function(count) {
var maxItems, page;
scope.itemsPerPage = count;
maxItems = count * scope.pagination.page;
if (maxItems > scope.pagination.size) {
page = Math.ceil(scope.pagination.size / count);
Expand All @@ -721,20 +726,22 @@ angular.module('ngTasty.component.table', [
return false;
}
scope.pagMaxRange = scope.pagMinRange;
scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
scope.pagMinRange = scope.pagMaxRange - 5;
setPaginationRanges();
};

setRemainingRange = function () {
if (scope.pagHideMaxRange === true || scope.pagMaxRange > scope.pagination.pages) {
if (scope.pagHideMaxRange === true ||
scope.pagMaxRange > scope.pagination.pages) {
return false;
}
scope.pagMinRange = scope.pagMaxRange;
scope.pagMaxRange = scope.pagMinRange + scope.itemsPerPage;
if (scope.pagMaxRange > scope.pagination.pages) {
scope.pagMaxRange = scope.pagination.pages;
scope.pagMaxRange = scope.pagMinRange + 5;
if (scope.pagMaxRange >= scope.pagination.pages) {
scope.pagMaxRange = scope.pagination.pages + 1;
scope.pagMinRange = scope.pagMaxRange - 5 + 1;
}
scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
scope.pagMinRange = scope.pagMaxRange - 5;
setPaginationRanges();
};

Expand All @@ -746,7 +753,7 @@ angular.module('ngTasty.component.table', [
scope.pagMaxRange = scope.pagination.pages + 1;
}
scope.pagHideMinRange = scope.pagMinRange <= 1;
scope.pagHideMaxRange = scope.pagMaxRange >= scope.pagination.pages;
scope.pagHideMaxRange = scope.pagMaxRange > scope.pagination.pages;
scope.classPageMinRange = scope.pagHideMinRange ? 'disabled' : '';
scope.classPageMaxRange = scope.pagHideMaxRange ? 'disabled' : '';

Expand All @@ -756,7 +763,6 @@ angular.module('ngTasty.component.table', [
break;
}
}

scope.rangePage = $filter('range')([], scope.pagMinRange, scope.pagMaxRange);

if (!tastyTable.start) {
Expand Down Expand Up @@ -1292,7 +1298,8 @@ module.run(['$templateCache', function($templateCache) {
' <th ng-repeat="column in columns track by $index" \n' +
' ng-class="classToShow(column)"\n' +
' ng-style="::column.style" ng-click="sortBy(column)">\n' +
' <span ng-bind="::column.name"></span>\n' +
' <span ng-if="bindOnce" ng-bind="::column.name"></span>\n' +
' <span ng-if="!bindOnce" ng-bind="column.name"></span>\n' +
' <span ng-class="column.isSorted">\n' +
' <span ng-class="column.isSortedCaret" ng-if="::bootstrapIcon"></span>\n' +
' </span>\n' +
Expand Down
4 changes: 2 additions & 2 deletions ng-tasty-tpls.min.js

Large diffs are not rendered by default.

28 changes: 17 additions & 11 deletions ng-tasty.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* ng-tasty
* https://github.com/Zizzamia/ng-tasty
* Version: 0.5.4 - 2015-05-04
* Version: 0.5.5 - 2015-06-15
* License: MIT
*/
angular.module("ngTasty", ["ngTasty.component.table","ngTasty.filter.camelize","ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range","ngTasty.filter.slugify","ngTasty.service.bindTo","ngTasty.service.debounce","ngTasty.service.joinObjects","ngTasty.service.setProperty","ngTasty.service.tastyUtil","ngTasty.service.throttle","ngTasty.service.webSocket"]);
angular.module("ngTasty", ["ngTasty.component.table","ngTasty.service.bindTo","ngTasty.service.debounce","ngTasty.service.joinObjects","ngTasty.service.setProperty","ngTasty.service.tastyUtil","ngTasty.service.throttle","ngTasty.service.webSocket","ngTasty.filter.camelize","ngTasty.filter.cleanFieldName","ngTasty.filter.filterInt","ngTasty.filter.range","ngTasty.filter.slugify"]);
/**
* @ngdoc directive
* @name ngTasty.component.tastyTable
Expand Down Expand Up @@ -90,7 +90,11 @@ angular.module('ngTasty.component.table', [
this.config = {};
if (angular.isObject($scope.theme)) {
Object.keys(tableConfig).forEach(function(key) {
this.config[key] = $scope.theme[key] || tableConfig[key];
if (angular.isDefined($scope.theme[key])) {
this.config[key] = $scope.theme[key];
} else {
this.config[key] = tableConfig[key];
}
}, this);
} else {
this.config = tableConfig;
Expand Down Expand Up @@ -695,6 +699,7 @@ angular.module('ngTasty.component.table', [

setCount = function(count) {
var maxItems, page;
scope.itemsPerPage = count;
maxItems = count * scope.pagination.page;
if (maxItems > scope.pagination.size) {
page = Math.ceil(scope.pagination.size / count);
Expand All @@ -720,20 +725,22 @@ angular.module('ngTasty.component.table', [
return false;
}
scope.pagMaxRange = scope.pagMinRange;
scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
scope.pagMinRange = scope.pagMaxRange - 5;
setPaginationRanges();
};

setRemainingRange = function () {
if (scope.pagHideMaxRange === true || scope.pagMaxRange > scope.pagination.pages) {
if (scope.pagHideMaxRange === true ||
scope.pagMaxRange > scope.pagination.pages) {
return false;
}
scope.pagMinRange = scope.pagMaxRange;
scope.pagMaxRange = scope.pagMinRange + scope.itemsPerPage;
if (scope.pagMaxRange > scope.pagination.pages) {
scope.pagMaxRange = scope.pagination.pages;
scope.pagMaxRange = scope.pagMinRange + 5;
if (scope.pagMaxRange >= scope.pagination.pages) {
scope.pagMaxRange = scope.pagination.pages + 1;
scope.pagMinRange = scope.pagMaxRange - 5 + 1;
}
scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
scope.pagMinRange = scope.pagMaxRange - 5;
setPaginationRanges();
};

Expand All @@ -745,7 +752,7 @@ angular.module('ngTasty.component.table', [
scope.pagMaxRange = scope.pagination.pages + 1;
}
scope.pagHideMinRange = scope.pagMinRange <= 1;
scope.pagHideMaxRange = scope.pagMaxRange >= scope.pagination.pages;
scope.pagHideMaxRange = scope.pagMaxRange > scope.pagination.pages;
scope.classPageMinRange = scope.pagHideMinRange ? 'disabled' : '';
scope.classPageMaxRange = scope.pagHideMaxRange ? 'disabled' : '';

Expand All @@ -755,7 +762,6 @@ angular.module('ngTasty.component.table', [
break;
}
}

scope.rangePage = $filter('range')([], scope.pagMinRange, scope.pagMaxRange);

if (!tastyTable.start) {
Expand Down
4 changes: 2 additions & 2 deletions ng-tasty.min.js

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions src/component/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ angular.module('ngTasty.component.table', [
this.config = {};
if (angular.isObject($scope.theme)) {
Object.keys(tableConfig).forEach(function(key) {
this.config[key] = $scope.theme[key] || tableConfig[key];
if (angular.isDefined($scope.theme[key])) {
this.config[key] = $scope.theme[key];
} else {
this.config[key] = tableConfig[key];
}
}, this);
} else {
this.config = tableConfig;
Expand Down Expand Up @@ -687,6 +691,7 @@ angular.module('ngTasty.component.table', [

setCount = function(count) {
var maxItems, page;
scope.itemsPerPage = count;
maxItems = count * scope.pagination.page;
if (maxItems > scope.pagination.size) {
page = Math.ceil(scope.pagination.size / count);
Expand All @@ -712,20 +717,22 @@ angular.module('ngTasty.component.table', [
return false;
}
scope.pagMaxRange = scope.pagMinRange;
scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
scope.pagMinRange = scope.pagMaxRange - 5;
setPaginationRanges();
};

setRemainingRange = function () {
if (scope.pagHideMaxRange === true || scope.pagMaxRange > scope.pagination.pages) {
if (scope.pagHideMaxRange === true ||
scope.pagMaxRange > scope.pagination.pages) {
return false;
}
scope.pagMinRange = scope.pagMaxRange;
scope.pagMaxRange = scope.pagMinRange + scope.itemsPerPage;
if (scope.pagMaxRange > scope.pagination.pages) {
scope.pagMaxRange = scope.pagination.pages;
scope.pagMaxRange = scope.pagMinRange + 5;
if (scope.pagMaxRange >= scope.pagination.pages) {
scope.pagMaxRange = scope.pagination.pages + 1;
scope.pagMinRange = scope.pagMaxRange - 5 + 1;
}
scope.pagMinRange = scope.pagMaxRange - scope.itemsPerPage;
scope.pagMinRange = scope.pagMaxRange - 5;
setPaginationRanges();
};

Expand All @@ -737,7 +744,7 @@ angular.module('ngTasty.component.table', [
scope.pagMaxRange = scope.pagination.pages + 1;
}
scope.pagHideMinRange = scope.pagMinRange <= 1;
scope.pagHideMaxRange = scope.pagMaxRange >= scope.pagination.pages;
scope.pagHideMaxRange = scope.pagMaxRange > scope.pagination.pages;
scope.classPageMinRange = scope.pagHideMinRange ? 'disabled' : '';
scope.classPageMaxRange = scope.pagHideMaxRange ? 'disabled' : '';

Expand All @@ -747,7 +754,6 @@ angular.module('ngTasty.component.table', [
break;
}
}

scope.rangePage = $filter('range')([], scope.pagMinRange, scope.pagMaxRange);

if (!tastyTable.start) {
Expand Down
3 changes: 2 additions & 1 deletion template/table/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<th ng-repeat="column in columns track by $index"
ng-class="classToShow(column)"
ng-style="::column.style" ng-click="sortBy(column)">
<span ng-bind="::column.name"></span>
<span ng-if="bindOnce" ng-bind="::column.name"></span>
<span ng-if="!bindOnce" ng-bind="column.name"></span>
<span ng-class="column.isSorted">
<span ng-class="column.isSortedCaret" ng-if="::bootstrapIcon"></span>
</span>
Expand Down

0 comments on commit 9524390

Please sign in to comment.