oxen_printer 0.3.2 → 0.3.3

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
2
  SHA1:
3
- metadata.gz: 2fa5c49b87fd28334d19cf9290a170835f2d859b
4
- data.tar.gz: 49031c378a4acec58684ada7981dcd2f6ada83cb
3
+ metadata.gz: af93710a84b071079b364de088730cdebcb7aa71
4
+ data.tar.gz: a678d74880a62ab8874489c572d53727854167bb
5
5
  SHA512:
6
- metadata.gz: c61d1ba34ce9c021cef9e79ea37fc8a1dac011c90e70207ca0cd772604b614c52d89afa42c18ab00ebcdf25aa7b64a113b7aa8a3c5714c3cc962199cd0d18a22
7
- data.tar.gz: 027c34df4ae72ee882e0e7ded1d799c9e9345be6305c7b269b89530325bf280b77992c123dfe132c5dee09c2ea3c54d11197102f67930a742c61e5dbc7d9de84
6
+ metadata.gz: 12bfe5401a1776f02763886c7fb972c320013a9f759fc2303640f7716f56c1bde1774966c3a479e66caa2e20fe77fd12b863d1a3f6ecf541a5493dccffb546f1
7
+ data.tar.gz: 16d328802e1ec41e27242a2aa76c2400a1e887d5271736b2afbbd03dfd6bfd80ad82b39ea2a5a12c17c35ef59d2edc9c3127d22e4ba96459fc01ff441c403c96
@@ -13,18 +13,23 @@ class OxPrinter < AbstractResource
13
13
 
14
14
  scope :active, -> { where(active: true) }
15
15
  scope :preferred_printer, ->{ where("printables.preferred=1")}
16
- scope :on_paper, -> (pap){ where(paper: pap )}
16
+ scope :on_paper, -> (pap){ where("paper LIKE :pap", pap: "%#{pap}%")}
17
17
 
18
18
  def list_title
19
19
  name
20
20
  end
21
21
 
22
+ def _ref
23
+ paper
24
+ end
25
+
22
26
  def preferred? parent
23
27
  printables.where(printable: parent).first.preferred?
24
28
  end
25
29
 
26
30
  def prefer parent
27
- parent.printables.each{ |p| p.update_columns(preferred: false) }
31
+ ps = parent.printers.preferred_printer.on_paper(self.paper)
32
+ parent.printables.each{ |p| p.update_columns(preferred: false) if ps.include? p.printer }
28
33
  printables.where(printable: parent).first.update_columns( preferred: true )
29
34
  end
30
35
 
@@ -11,8 +11,8 @@
11
11
  %i.material-icons layers_clear
12
12
  %td
13
13
  - if user.printers.preferred_printer.include? printer
14
- -#= link_to defer_url( user,printer), class: 'preferred green-text', title: t('defer_printers') do
15
- %i.preferred.material-icons.green-text{ data: { id: printer.id }} bookmark
14
+ = link_to defer_url( user,printer), class: 'preferred green-text', ref: printer.paper, data: { id: printer.id }, title: t('defer_printers') do
15
+ %i.preferred.material-icons.green-text bookmark
16
16
  - else
17
- = link_to prefer_url( user,printer), class: 'deferred grey-text', data: { id: printer.id },title: t('prefer_printers') do
17
+ = link_to prefer_url( user,printer), class: 'deferred grey-text', ref: printer.paper, data: { id: printer.id },title: t('prefer_printers') do
18
18
  %i.material-icons bookmark_border
@@ -1,3 +1,3 @@
1
1
  module OxenPrinter
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/print_engine.rb CHANGED
@@ -61,6 +61,10 @@ module PrintEngine
61
61
  rescue PrintJobPrinterNotAvailableError
62
62
  logit :error, 'PrintJob could not be created - the user has no printers attached!!'
63
63
  return false
64
+
65
+ rescue NoPreferredPrintersFound
66
+ logit :error, 'PrintJob could not be created - the user has no preferred printers attached!!'
67
+ false
64
68
  end
65
69
 
66
70
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxen_printer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Walther H Diechmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-17 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oxen_job