da_funk 1.4.1 → 1.4.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/RELEASE_NOTES.md +6 -0
- data/lib/da_funk/helper.rb +23 -14
- data/lib/da_funk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2deca81b9c82dbcffb3f707550ad3cd63784362
|
4
|
+
data.tar.gz: aba07fa8b4ec242317d7c31efb73bdf6f80651c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6f9b06820c97c1a4814c9fee6a8d423de1cdfe0099c725f44c1fcca83a3153e619eac4642017fc05b36d3235b3975463688cee70235f145feabc606ee3e1f82
|
7
|
+
data.tar.gz: 181cacd28882a28283227d4cc4a5c5d3d0b5f15d2c0d80ae743116ae5632b511d15ec80ab6d24f007da33e517b5c329eb26c6da0825e704e9831e06079a786b1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
da_funk (1.4.
|
4
|
+
da_funk (1.4.2)
|
5
5
|
archive-zip (~> 0.5)
|
6
6
|
bundler
|
7
7
|
cloudwalk_handshake
|
@@ -27,7 +27,7 @@ GEM
|
|
27
27
|
parallel (1.12.1)
|
28
28
|
parser (2.4.0.2)
|
29
29
|
ast (~> 2.3)
|
30
|
-
posxml_parser (1.2.
|
30
|
+
posxml_parser (1.2.1)
|
31
31
|
funky-emv (~> 0.3)
|
32
32
|
powerpack (0.1.1)
|
33
33
|
rainbow (3.0.0)
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 1.4.2 - 2018-01-17
|
4
|
+
|
5
|
+
- Extract background pagination helper.
|
6
|
+
- Refactoring menu helper to support footer, header
|
7
|
+
and background customization.
|
8
|
+
|
3
9
|
### 1.4.1 - 2018-01-17
|
4
10
|
|
5
11
|
- Fix Notification parse to make communication management works.
|
data/lib/da_funk/helper.rb
CHANGED
@@ -170,14 +170,14 @@ module DaFunk
|
|
170
170
|
|
171
171
|
# TODO Scalone: Refactor.
|
172
172
|
def pagination(title, options, collection, &block)
|
173
|
-
start_line, options[:limit] = pagination_limit(title, options
|
173
|
+
start_line, options[:limit] = pagination_limit(title, options)
|
174
174
|
if collection.size > (options[:limit] - 1) # minus pagination header
|
175
175
|
key = Device::IO.back_key
|
176
176
|
pages = pagination_page(collection, options[:limit] - 1) # minus pagination header
|
177
177
|
page = 1
|
178
178
|
while(key == Device::IO.back_key || key == Device::IO.forward_key)
|
179
179
|
Device::Display.clear
|
180
|
-
pagination_header(title, page, pages.size, start_line, options[:default])
|
180
|
+
pagination_header(title, page, pages.size, start_line, options[:default], options[:header])
|
181
181
|
values = pages[page].to_a
|
182
182
|
block.call(values, start_line+1)
|
183
183
|
key = try_key(pagination_keys(values.size))
|
@@ -198,11 +198,13 @@ module DaFunk
|
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
|
-
def pagination_header(title, page, pages, line, default)
|
201
|
+
def pagination_header(title, page, pages, line, default = nil, header = nil)
|
202
202
|
print_title(title, default) if title
|
203
203
|
back = Device::IO.back_key_label
|
204
204
|
forward = Device::IO.forward_key_label
|
205
|
-
|
205
|
+
if header || header.nil?
|
206
|
+
Device::Display.print("< #{back} __ #{page}/#{pages} __ #{forward} >", line, 0)
|
207
|
+
end
|
206
208
|
end
|
207
209
|
|
208
210
|
def pagination_key_page(page, key, size)
|
@@ -231,22 +233,25 @@ module DaFunk
|
|
231
233
|
Device::IO::CANCEL, Device::IO.back_key, Device::IO.forward_key]
|
232
234
|
end
|
233
235
|
|
234
|
-
def pagination_limit(title,
|
235
|
-
|
236
|
+
def pagination_limit(title, options = {})
|
237
|
+
number = options[:limit]
|
238
|
+
unless (start = options[:start])
|
239
|
+
start = title.nil? ? 0 : 1 # start in next line if title
|
240
|
+
end
|
241
|
+
|
236
242
|
if number
|
237
243
|
limit = number
|
238
244
|
else
|
239
|
-
if STDOUT.max_y > 9
|
245
|
+
if STDOUT.max_y > (9 + start)
|
240
246
|
limit = 9
|
241
247
|
else
|
242
|
-
|
243
|
-
limit = STDOUT.max_y
|
244
|
-
else
|
245
|
-
limit = STDOUT.max_y - 1 # minus title
|
246
|
-
end
|
248
|
+
limit = STDOUT.max_y - start # minus title
|
247
249
|
end
|
248
250
|
end
|
249
|
-
|
251
|
+
|
252
|
+
footer = options[:footer] ? options[:footer] : 0
|
253
|
+
|
254
|
+
[start, limit - footer]
|
250
255
|
end
|
251
256
|
|
252
257
|
def number_to_currency(value, options = {})
|
@@ -305,8 +310,12 @@ module DaFunk
|
|
305
310
|
options
|
306
311
|
end
|
307
312
|
|
313
|
+
def pagination_bg_image(string)
|
314
|
+
string.to_s.downcase.include?(".bmp") && (path = "./shared/#{string}") && File.file?(path) && path
|
315
|
+
end
|
316
|
+
|
308
317
|
def print_title(string, default)
|
309
|
-
if
|
318
|
+
if path = pagination_bg_image(string)
|
310
319
|
Device::Display.print_bitmap(path)
|
311
320
|
else
|
312
321
|
if default
|
data/lib/da_funk/version.rb
CHANGED