oxen_printer 0.4.14 → 0.4.15

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: a0667e65611a816dad4cf1cea56248dfa8826432
4
- data.tar.gz: cf999a49b5b893197bb434e5fa642f9d9d3a9b32
3
+ metadata.gz: dd2b879b5f0f922f528fede4205f1dfe2f6cc23e
4
+ data.tar.gz: 5462cf2b97d393267331098080b5eb6332be1c2d
5
5
  SHA512:
6
- metadata.gz: bd8b6f82e6f7aaf8de12edc4252f76f57a3dcdf18ba979a66f15f3fdb01c3ee581793bf9c3319bf24f7dbba9682437f630dc6afc8d0fbd7e74c8c23507eca169
7
- data.tar.gz: 65109ae64cd9e01a2ca0fa13cddea4d6a1b9db6b66cb194ef0c4afe210333b6b42a2f8fc71b7235e3b640860d46786fe663da884a7a7be1171f775a65ec3992b
6
+ metadata.gz: f0063ef38fe26e4320ed8c7212c2d71b517a7f5fa6c5dbbef6bae9599f1288fd613dab93556806f246a53637440cac5ee97ed29d1af20b422fc77bee81309eef
7
+ data.tar.gz: 0424e98f70409bc50d8f545a4aa29f072cd10ea9d69831929dfd6612a13aeadd28b7bb2901c8a59a1385deaabe7be94081c109ee22aa8182b5c21e086d42ebe4
@@ -0,0 +1,309 @@
1
+ { div, form, input, textarea, select, option, label, h4, p, a } = React.DOM
2
+
3
+ class @PrintPrompt extends React.Component
4
+ constructor: (props) ->
5
+ super props
6
+ @state =
7
+ url: props.url
8
+ collation: props.collation
9
+ template: props.template
10
+ paper: props.paper
11
+ user_id: props.user_id
12
+ user_email: props.user_email
13
+ shared: new App.Shared()
14
+ printers_url: "/admin/users/" + props.user_id + "/printers.json"
15
+ wurl: ""
16
+ args: ""
17
+
18
+ @propTypes =
19
+ url: React.PropTypes.string
20
+ template: React.PropTypes.string
21
+ paper: React.PropTypes.string
22
+ user_id: React.PropTypes.number
23
+ collation: React.PropTypes.string
24
+ user_email: React.PropTypes.string
25
+
26
+ @defaultProps =
27
+ url: ""
28
+ collation: "list"
29
+ template: ""
30
+ paper: "A4"
31
+ user_id: 1
32
+ user_email: ""
33
+
34
+ getPrinterList: (e) =>
35
+ jqxhr = $.ajax
36
+ url: @state.printers_url
37
+ method: 'GET'
38
+ .done (printers) ->
39
+ @obj=$("#user_suggested_printer_list")
40
+ for printer in printers
41
+ opt = document.createElement("option")
42
+ opt.value = printer.id
43
+ opt.text = printer.name
44
+ @obj.append opt
45
+ @obj.material_select()
46
+ .fail (data) ->
47
+ console.log 'fejl ved opslag i printer liste'
48
+
49
+ hidePrinterList: (e) =>
50
+ $('.select-wrapper.printer_list').hide()
51
+
52
+ showPrinterList: (e) =>
53
+ $('.select-wrapper.printer_list').show()
54
+
55
+ hideEmailForm: (e) =>
56
+ $('.emailForm').hide()
57
+
58
+ showEmailForm: (e) =>
59
+ $('.emailForm').show()
60
+
61
+ hideDisplayForm: (e) =>
62
+ $('.displayForm').hide()
63
+
64
+ showDisplayForm: (e) =>
65
+ $('.displayForm').show()
66
+
67
+ onDisplay: (e) =>
68
+ @hidePrinterList()
69
+ @hideEmailForm()
70
+ @showDisplayForm()
71
+
72
+ onEmail: (e) =>
73
+ @hidePrinterList()
74
+ @hideDisplayForm()
75
+ @showEmailForm()
76
+
77
+ onPrint: (e) =>
78
+ @showPrinterList()
79
+ @hideEmailForm()
80
+ @hideDisplayForm()
81
+
82
+ onDownload: (e)=>
83
+ @hidePrinterList()
84
+ @hideEmailForm()
85
+ @hideDisplayForm()
86
+
87
+ onHTML_PDF: (e) =>
88
+ if $(e.currentTarget).attr('id') == "display_file_as_pdf"
89
+ $("#display_file_as_html").prop 'checked', !$("#display_file_as_pdf").prop('checked')
90
+ else
91
+ $("#display_file_as_pdf").prop 'checked', !$("#display_file_as_html").prop('checked')
92
+
93
+ cancelModal: (e) =>
94
+ App.shared.spinWhileLoading()
95
+ $("#print-dialog").closeModal()
96
+
97
+ animatePrint: (e) =>
98
+ if e
99
+ $(".print-ok-button").html('<div class="la-square-loader"><div></div></div>')
100
+ else
101
+ $(".print-ok-button").html('Ok')
102
+
103
+ sendPrintRequest: (e) =>
104
+ @animatePrint(e)
105
+ wrl = @state.url
106
+ arg = @state.args
107
+ if wrl=='href'
108
+ wrl = window.location.href.replace( /#!$/, "")
109
+ if wrl.match /\?/
110
+ w = wrl.split("?")[0] + "/print"
111
+ arg = wrl.split("?")[1] + "&"
112
+ else
113
+ w = wrl + "/print"
114
+ arg = arg + "&collation=#{@state.collation}&template=#{@state.template}&paper=#{@state.paper}"
115
+ @form = $('#print-dialog form')
116
+ @setState {wurl: w, args: arg}, () =>
117
+ if $('input[name="print[medium]"]:checked').val()=="display"
118
+ @animatePrint()
119
+ $("#print-dialog").closeModal()
120
+ window.open @state.wurl + "?" + @form.serialize() + '&' + @state.args
121
+ return
122
+
123
+ jqxhr = $.ajax
124
+ url: @state.wurl
125
+ method: "GET"
126
+ data: @form.serialize() + '&' + @state.args
127
+ dataType: 'html'
128
+ .done (data) =>
129
+ @animatePrint()
130
+ $("#print-dialog").closeModal()
131
+ .fail (data) =>
132
+ @animatePrint()
133
+ $("#print-dialog").closeModal()
134
+
135
+
136
+
137
+ componentDidMount: ->
138
+ $(document.body).on 'app:print-dialog:state:changed', (e) =>
139
+ @setState(e.state)
140
+ @getPrinterList()
141
+ @hidePrinterList()
142
+ @hideEmailForm()
143
+ $('#print_email_to').val @state.user_email
144
+
145
+
146
+ render: ->
147
+ div
148
+ className: "modal"
149
+ id: "print-dialog"
150
+ div
151
+ className: "modal-content"
152
+ div
153
+ className: "container"
154
+ div
155
+ className: "row"
156
+ div
157
+ className: "col s12 m12 l12"
158
+ h4
159
+ className: "h4"
160
+ "Se, sende eller udskrive?"
161
+ p
162
+ className: "p"
163
+ "Dette printjob har du mulighed for at se på flere måder - du kan udskrive det direkte på en printer, sende en email besked hvor du hæfter det ved, eller få det vist som PDF på skærmen. Valget er dit"
164
+ div
165
+ className: "row"
166
+ div
167
+ className: "col s12 m12 l12"
168
+ form
169
+ className: "print_form"
170
+ div
171
+ className: "row"
172
+ div
173
+ className: "col s12 m6 l6"
174
+ p
175
+ className: "p"
176
+ input
177
+ className: "with-gap"
178
+ id: "display"
179
+ type: "radio"
180
+ name: "print[medium]"
181
+ value: "display"
182
+ onClick: @onDisplay
183
+ label
184
+ className: "label"
185
+ htmlFor: "display"
186
+ "På skærmen"
187
+ p
188
+ className: "p"
189
+ input
190
+ className: "with-gap"
191
+ id: "email"
192
+ type: "radio"
193
+ name: "print[medium]"
194
+ value: "email"
195
+ onClick: @onEmail
196
+ label
197
+ className: "label"
198
+ htmlFor: "email"
199
+ "Vedhæftet en email"
200
+ p
201
+ className: "p"
202
+ input
203
+ className: "with-gap"
204
+ id: "printer"
205
+ type: "radio"
206
+ name: "print[medium]"
207
+ value: "printer"
208
+ onClick: @onPrint
209
+ label
210
+ className: "label"
211
+ htmlFor: "printer"
212
+ "til printer"
213
+ p
214
+ className: "p"
215
+ input
216
+ className: "with-gap"
217
+ id: "download"
218
+ type: "radio"
219
+ name: "print[medium]"
220
+ value: "download"
221
+ onClick: @onDownload
222
+ label
223
+ className: "label"
224
+ htmlFor: "download"
225
+ "som fil"
226
+
227
+ div
228
+ className: "col s12 m6 l6"
229
+ p
230
+ className: "p"
231
+ select
232
+ className: "printer_list"
233
+ name: "print[printer]"
234
+ id: "user_suggested_printer_list"
235
+ defaultValue: "0"
236
+ option
237
+ className: "printer_list_option"
238
+ value:"0"
239
+ disabled: "true"
240
+ "Vælg en printer"
241
+
242
+ label
243
+ className: "label"
244
+ "Printer"
245
+ p
246
+ className: "p displayForm"
247
+ input
248
+ className: "with-gap"
249
+ id: "display_file_as_html"
250
+ type: "checkbox"
251
+ name: "print[output_type]"
252
+ value: "html"
253
+ onClick: @onHTML_PDF
254
+ label
255
+ className: "label"
256
+ htmlFor: "display_file_as_html"
257
+ "HTML"
258
+ p
259
+ className: "p displayForm"
260
+ input
261
+ className: "with-gap"
262
+ id: "display_file_as_pdf"
263
+ type: "checkbox"
264
+ name: "print[output_type]"
265
+ value: "pdf"
266
+ onClick: @onHTML_PDF
267
+ label
268
+ className: "label"
269
+ htmlFor: "display_file_as_pdf"
270
+ "PDF"
271
+ p
272
+ className: "p emailForm"
273
+ label
274
+ className: 'label'
275
+ htmlFor: "print_email_to"
276
+ "Modtager:"
277
+ input
278
+ className: "text"
279
+ id: "print_email_to"
280
+ type: "text"
281
+ name: "print[email_to]"
282
+
283
+ div
284
+ className: "col s12 m12 l12"
285
+ p
286
+ className: "p emailForm"
287
+ label
288
+ className: 'label'
289
+ htmlFor: "print_message"
290
+ "Besked:"
291
+ textarea
292
+ className: "materialize-textarea"
293
+ id: "print_message"
294
+ name: "print[message]"
295
+
296
+
297
+
298
+ div
299
+ className: "modal-footer"
300
+ a
301
+ className: "print-ok-button green btn modal-action waves-effect waves-green"
302
+ href: "#!"
303
+ onClick: @sendPrintRequest
304
+ "Ok"
305
+ a
306
+ className: "orange btn modal-action waves-effect waves-orange"
307
+ href: "#!"
308
+ onClick: @cancelModal
309
+ "Fortryd"
@@ -1,3 +1,3 @@
1
1
  module OxenPrinter
2
- VERSION = "0.4.14"
2
+ VERSION = "0.4.15"
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "oxen_job"
21
+ spec.add_dependency "oxen_job", '~> 0'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.7"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxen_printer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.14
4
+ version: 0.4.15
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: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oxen_job
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
@@ -66,6 +66,7 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - app/assets/javascripts/components/print_prompt.js.jsx.coffee
69
+ - app/assets/javascripts/components/print_prompt.wasjsjsxcoffee
69
70
  - app/assets/javascripts/oxen_printer.js
70
71
  - app/controllers/oxen/print_jobs_controller.rb
71
72
  - app/controllers/oxen/printers_controller.rb