ui_alchemy-rails 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,28 +2,47 @@ angular.module("alch-templates").run(function($templateCache) {
2
2
  $templateCache.put("component/templates/table.html",
3
3
  "<thead>" +
4
4
  " <tr>" +
5
- " <th class=\"table-selection-row\" colspan=\"{{ table.data.columns.length +1 }}\" ng-show=\"table.more_results()\">" +
6
- " All {{ table.offset }} results shown are currently selected. " +
7
- " <a href=\"\">Select all {{ table.total }} results.</a>" +
5
+ " <th class=\"table-selection-row\" " +
6
+ " colspan=\"{{ table.data.columns.length +1 }}\" " +
7
+ " ng-show=\"table.more_results()\">" +
8
+ "" +
9
+ " All {{ table.offset }} results shown are currently selected. " +
10
+ " <a href=\"\">Select all {{ table.total }} results.</a>" +
8
11
  " </th>" +
9
12
  " </tr>" +
10
13
  " <tr>" +
11
14
  " <th ng-show=\"rowSelect\">" +
12
- " <input class=\"select_all\" type=\"checkbox\" name=\"select_all\" ng-model=\"table.all_selected\" ng-change=\"table.select_all()\">" +
15
+ " <input class=\"select_all\" " +
16
+ " type=\"checkbox\" " +
17
+ " name=\"select_all\" " +
18
+ " ng-model=\"table.all_selected\" " +
19
+ " ng-change=\"table.select_all()\">" +
13
20
  " </th>" +
14
- " <th ng-click=\"table.sort(header)\" ng-show=\"header.show\" ng-repeat=\"header in table.data.columns\" ng-class=\"{ 'active-column' : header.active }\">" +
15
- " {{ header.display }}" +
21
+ " <th ng-click=\"table.sort(header)\" " +
22
+ " ng-show=\"header.show\" " +
23
+ " ng-repeat=\"header in table.data.columns\" " +
24
+ " ng-class=\"{ 'active-column' : header.active }\">" +
25
+ "" +
26
+ " {{ header.display }}" +
16
27
  " </th>" +
17
28
  " </tr>" +
18
29
  "</thead>" +
19
- "" +
20
- "<tbody>" +
21
- " <tr ng-class=\"{active : row.selected }\" ng-repeat=\"row in table.data.rows\" ng-show=\"show_row(row)\">" +
30
+ "<tbody infinite-scroll=\"table.next_page()\" " +
31
+ " infinite-scroll-disable=\"table.loading_more\" " +
32
+ " infinite-scroll-distance=\"table.scroll_distance\">" +
33
+ " <tr ng-class=\"{active : row.selected }\" " +
34
+ " ng-repeat=\"row in table.data.rows\" " +
35
+ " ng-show=\"show_row(row)\">" +
22
36
  " <td ng-show=\"rowSelect\">" +
23
- " <input ng-model=\"row.selected\" type=\"checkbox\" name=\"{{ row.id }}\" value=\"{{ row.id }}\" ng-change=\"adjust_num_selected(row.selected)\">" +
37
+ " <input ng-model=\"row.selected\" " +
38
+ " type=\"checkbox\" name=\"{{ row.id }}\" " +
39
+ " value=\"{{ row.id }}\" " +
40
+ " ng-change=\"adjust_num_selected(row.selected)\">" +
24
41
  " </td>" +
25
- " <td ng-show=\"show_cell(cell)\" ng-repeat=\"cell in row.cells\">" +
26
- " {{ cell.display }}" +
42
+ " <td ng-show=\"show_cell(cell)\" " +
43
+ " ng-repeat=\"cell in row.cells\">" +
44
+ " " +
45
+ " {{ cell.display }}" +
27
46
  " </td>" +
28
47
  " </tr>" +
29
48
  "</tbody>" +
@@ -34,7 +53,12 @@ angular.module("alch-templates").run(function($templateCache) {
34
53
  $templateCache.put("component/templates/tool_bar.html",
35
54
  "<div ng-model=\"table.data.columns\" class=\"form table-toolbar\">" +
36
55
  " <div class=\"fl\">" +
37
- " <input type=\"text\" class=\"input\" placeholder=\"Search...\" ng-model=\"table.search_string\" on-enter=\"table.search(table.search_string)\">" +
56
+ " <input type=\"text\" " +
57
+ " class=\"input\" " +
58
+ " placeholder=\"Search...\" " +
59
+ " ng-model=\"table.search_string\" " +
60
+ " on-enter=\"table.search(table.search_string)\"" +
61
+ " />" +
38
62
  " Showing {{ table.start }}-{{ table.offset }} of {{ table.total }} {{ table.model }}" +
39
63
  " </div>" +
40
64
  " <div class=\"fr deselect\" ng-show=\"table.num_selected\">" +
@@ -57,6 +81,9 @@ angular.module('alchemy').directive('alchTable', function(){
57
81
  templateUrl: 'component/templates/table.html',
58
82
 
59
83
  controller: function($scope){
84
+ if (!$scope.table.scroll_distance) {
85
+ $scope.table.scroll_distance = 0;
86
+ }
60
87
 
61
88
  $scope.show_cell = function(cell){
62
89
  var to_show;
@@ -118,17 +145,3 @@ angular.module('alchemy').directive('alchTableToolbar', function(){
118
145
  }
119
146
  };
120
147
  });
121
-
122
- angular.module('alchemy').directive('onEnter', function() {
123
- return {
124
- scope: true,
125
-
126
- link: function(scope, element, attrs) {
127
- element.bind('keydown keypress', function(event) {
128
- if(event.which === 13) {
129
- scope.$apply(attrs.onEnter);
130
- }
131
- });
132
- }
133
- };
134
- });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alchemy-tables",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "main": [
5
5
  "./*.js",
6
6
  "./*.scss",
@@ -9,6 +9,7 @@
9
9
  "dependencies": {
10
10
  "angular": "~1.0.5",
11
11
  "jquery": "~1.9.1",
12
+ "ngInfiniteScroll": "~1.0.0",
12
13
  "alchemy": ">=0.0.1",
13
14
  "alchemy-forms": ">=0.0.1"
14
15
  },
@@ -16,8 +17,8 @@
16
17
  "angular-mocks": "~1.0.5",
17
18
  "angular-scenario": "~1.0.5"
18
19
  },
19
- "gitHead": "aaac01b6007bf4183d71fc2ec7a99231779dd0e0",
20
- "_id": "alchemy-tables@0.0.13",
20
+ "gitHead": "89802f847840cbb994d7d3824150b15979ec8a2b",
21
+ "_id": "alchemy-tables@0.0.15",
21
22
  "readme": "ERROR: No README.md file found!",
22
23
  "description": "ERROR: No README.md file found!",
23
24
  "repository": {
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "ngInfiniteScroll",
3
+ "version": "1.0.0",
4
+ "main": "./ng-infinite-scroll.js",
5
+ "dependencies": {},
6
+ "gitHead": "4afe47961d5aa5de625c8757c69215fdf78c39dd",
7
+ "_id": "ngInfiniteScroll@1.0.0",
8
+ "readme": "ERROR: No README.md file found!",
9
+ "description": "ERROR: No README.md file found!",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git://github.com/BinaryMuse/ngInfiniteScroll-bower.git"
13
+ }
14
+ }
@@ -0,0 +1,61 @@
1
+ /* ng-infinite-scroll - v1.0.0 - 2013-02-23 */
2
+ var mod;
3
+
4
+ mod = angular.module('infinite-scroll', []);
5
+
6
+ mod.directive('infiniteScroll', [
7
+ '$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) {
8
+ return {
9
+ link: function(scope, elem, attrs) {
10
+ var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
11
+ $window = angular.element($window);
12
+ scrollDistance = 0;
13
+ if (attrs.infiniteScrollDistance != null) {
14
+ scope.$watch(attrs.infiniteScrollDistance, function(value) {
15
+ return scrollDistance = parseInt(value, 10);
16
+ });
17
+ }
18
+ scrollEnabled = true;
19
+ checkWhenEnabled = false;
20
+ if (attrs.infiniteScrollDisabled != null) {
21
+ scope.$watch(attrs.infiniteScrollDisabled, function(value) {
22
+ scrollEnabled = !value;
23
+ if (scrollEnabled && checkWhenEnabled) {
24
+ checkWhenEnabled = false;
25
+ return handler();
26
+ }
27
+ });
28
+ }
29
+ handler = function() {
30
+ var elementBottom, remaining, shouldScroll, windowBottom;
31
+ windowBottom = $window.height() + $window.scrollTop();
32
+ elementBottom = elem.offset().top + elem.height();
33
+ remaining = elementBottom - windowBottom;
34
+ shouldScroll = remaining <= $window.height() * scrollDistance;
35
+ if (shouldScroll && scrollEnabled) {
36
+ if ($rootScope.$$phase) {
37
+ return scope.$eval(attrs.infiniteScroll);
38
+ } else {
39
+ return scope.$apply(attrs.infiniteScroll);
40
+ }
41
+ } else if (shouldScroll) {
42
+ return checkWhenEnabled = true;
43
+ }
44
+ };
45
+ $window.on('scroll', handler);
46
+ scope.$on('$destroy', function() {
47
+ return $window.off('scroll', handler);
48
+ });
49
+ return $timeout((function() {
50
+ if (attrs.infiniteScrollImmediateCheck) {
51
+ if (scope.$eval(attrs.infiniteScrollImmediateCheck)) {
52
+ return handler();
53
+ }
54
+ } else {
55
+ return handler();
56
+ }
57
+ }), 0);
58
+ }
59
+ };
60
+ }
61
+ ]);