boxlet 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e992bafcddffa31e97f52f3b4bc68987b820951a
4
- data.tar.gz: 9f0ab5017c04358b38e4e4942dde625eb97c8221
2
+ SHA256:
3
+ metadata.gz: 22addba52278e369b28f8982c4677e755836f4d2c04fbe707b44801fb9f07ad1
4
+ data.tar.gz: 60efb6a881c856d933f01cca1dc4990994d9f51de84a284cc165dcb38d2b5fb4
5
5
  SHA512:
6
- metadata.gz: ea4c9a1b3c1cc531de755f341f7511c163395ce0748604b77d1ae4927d1720165a68d6513f8a46cb02f008bd074a8e52d401dfa2fb63dd750a4589a55f856107
7
- data.tar.gz: 6e0323011705d423caaae87cef98106851f8f4897302ce7034eed070b08cfd1823ad28d68f0984dd5b0f5533b31aa2de39492079d394cc4fa59b045ea64f1816
6
+ metadata.gz: b3f361c702384a91af6cc15ba8996d6971f39ed6ae40605c429537dd62c3e922ec765db8e447af822e00cb132eb8bc0fc902a9f10c64383f6ba525a27d08caa9
7
+ data.tar.gz: 248a1db5306eeac1def8e27c1cd3fd3b7df9d9e5895ea4f00f675cdf0ec5aa66de4fe2de7b3eece3e86f12a4fb04f7c43320c43b56ab586c2ee0ef8ebe332bd3
@@ -33,6 +33,7 @@ module Boxlet
33
33
  ["/flashback", :post] => :flashback,
34
34
  ["/gallery", :get] => :gallery,
35
35
  ["/gallery/images", :get] => :gallery_images,
36
+ ["/hello", :get] => :hello,
36
37
  }
37
38
  end
38
39
 
@@ -18,6 +18,7 @@ require 'boxlet/app/templates'
18
18
  # ["/flashback", :post] => :flashback,
19
19
  # ["/gallery", :get] => :gallery,
20
20
  # ["/gallery/images", :get] => :gallery_images,
21
+ # ["/hello", :get] => :hello,
21
22
  # }
22
23
 
23
24
 
@@ -213,6 +214,10 @@ module Boxlet
213
214
  end
214
215
  end
215
216
 
217
+ def hello
218
+ 'hi'
219
+ end
220
+
216
221
 
217
222
  private
218
223
 
@@ -61,10 +61,13 @@
61
61
  $scope.page = 1;
62
62
  $scope.limit = 50;
63
63
  $scope.images = [];
64
+ $scope.count = 0;
64
65
  $scope.heroImage = null;
65
- $scope.counter = function() {
66
+
67
+ buildCounter = function(count) {
66
68
  var a = [],
67
- pages = Math.ceil($scope.count / $scope.limit);
69
+ pages = getPageCount();
70
+
68
71
  for (var i = 1; i <= pages; i++) {
69
72
  a.push(i);
70
73
  }
@@ -79,16 +82,39 @@
79
82
  $scope.heroImage = image;
80
83
  };
81
84
 
85
+ function getPageCount() {
86
+ var lastPage = Math.ceil($scope.count / $scope.limit);
87
+
88
+ if (lastPage < 1) {
89
+ lastPage = 1;
90
+ }
91
+
92
+ return lastPage;
93
+ }
94
+
82
95
  $scope.fetchImages = function() {
83
- var imagesUrl = "/gallery/images?page=" + $scope.page + "&limit=" + $scope.limit + "&uuid=" + uuid;
84
-
85
- $http.get(imagesUrl).then(function(results) {
86
- basePath = results.data.base_path;
87
- $scope.basePath = basePath;
88
- $scope.count = results.data.count;
89
- $scope.images = results.data.images;
90
- $scope.heroImage = $scope.images[0];
91
- });
96
+ var imagesUrl;
97
+
98
+ $scope.limit = parseInt($scope.limit);
99
+
100
+ if ($scope.limit >= 1) {
101
+ var newLastPossiblePage = getPageCount();
102
+
103
+ if ($scope.page > newLastPossiblePage) {
104
+ $scope.page = newLastPossiblePage;
105
+ }
106
+
107
+ imagesUrl = "/gallery/images?page=" + $scope.page + "&limit=" + $scope.limit + "&uuid=" + uuid;
108
+
109
+ $http.get(imagesUrl).then(function(results) {
110
+ $scope.count = results.data.count;
111
+ $scope.basePath = results.data.base_path;
112
+ $scope.images = results.data.images;
113
+ $scope.heroImage = $scope.images[0];
114
+
115
+ $scope.imagePages = buildCounter($scope.count);
116
+ });
117
+ }
92
118
  }
93
119
 
94
120
  $scope.fetchImages();
@@ -101,9 +127,11 @@
101
127
  <img ng-src="{{basePath}}/{{heroImage.filename}}" />
102
128
  </div>
103
129
 
104
- <select ng-change="fetchImages()" ng-model="page" ng-options="page for page in counter() track by page">
105
- <option ng-repeat="page in counter()" value="page">{{page}}</option>
130
+ <select ng-change="fetchImages()" ng-model="page" ng-options="page for page in imagePages track by page">
106
131
  </select>
132
+
133
+ <input ng-model="limit" type="number" min="1" max="50" ng-change="fetchImages()" />
134
+
107
135
  <ul class="image-row">
108
136
  <li ng-repeat="image in images" style="background-image: url({{imageSource(image, 'thumbnail')}})" ng-click="setHeroImage(image)"></li>
109
137
  </ul>
@@ -1,3 +1,3 @@
1
1
  module Boxlet
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - arktisklada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-27 00:00:00.000000000 Z
11
+ date: 2019-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -241,9 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  version: '0'
242
242
  requirements: []
243
243
  rubyforge_project:
244
- rubygems_version: 2.4.8
244
+ rubygems_version: 2.7.6
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: Upload pics from your phone
248
248
  test_files: []
249
- has_rdoc: