upload_documents_tool 0.1.7 → 0.1.8

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: ebf37d6a27148fe240f2eb9e999ef9626e79a8ab
4
- data.tar.gz: 357cfed71b95c41886df65d9443234bc44b8d173
3
+ metadata.gz: 4ca84dfc22fc6f5e28c14e0eb3198efec8d837d1
4
+ data.tar.gz: 9805bc16009715445e9cfde4a9eedc6dfbeea083
5
5
  SHA512:
6
- metadata.gz: e71f6cf6ff161b3d47277607ae493a16c37ee4c694ae8f5811cb31170657e032aa07c3c11ef52b4da67a9e442033809b5e06620c4446b10f6b3423af4e53eb41
7
- data.tar.gz: 3bbf5420be1544d074ef7080a1019cb84d9bde6db6629055c9ab63471a489fa4fcd730f4f7aeecce4fa2f51f70eb31366aa2a2e38fd51dcdf9475a3ec08e35db
6
+ metadata.gz: ce6fa8a3f109d7b889836821cbeea6ea0132c4ebba58ee84eb401144ed4a9c0d48c46abdd5daebfa78107efedf2d2cb5b46c07494210852afb8ac83ea6f57a08
7
+ data.tar.gz: aa0e1b19294250a1ab8ebdaf54cb53dcaa32ad167532944f61c87cb1297e627dab9b009c87d06a2289d9897d78e1b1e823e6308b9f409326b69e9e02c56a17e3
data/.idea/workspace.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="df46d33f-74ef-431f-8aed-cd7454e07a46" name="Default" comment="">
5
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/assets/stylesheets/upload_document_tool.scss" afterPath="$PROJECT_DIR$/app/assets/stylesheets/upload_document_tool.scss" />
5
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/upload_documents_tool/version.rb" afterPath="$PROJECT_DIR$/lib/upload_documents_tool/version.rb" />
6
6
  </list>
7
7
  <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
8
8
  <option name="TRACKING_ENABLED" value="true" />
@@ -13,89 +13,17 @@
13
13
  </component>
14
14
  <component name="FileEditorManager">
15
15
  <leaf>
16
- <file leaf-file-name="upload_document_tool_helper.rb" pinned="false" current-in-tab="false">
17
- <entry file="file://$PROJECT_DIR$/app/helpers/upload_document_tool_helper.rb">
18
- <provider selected="true" editor-type-id="text-editor">
19
- <state relative-caret-position="228">
20
- <caret line="12" column="14" lean-forward="false" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
21
- <folding />
22
- </state>
23
- </provider>
24
- </entry>
25
- </file>
26
- <file leaf-file-name="documents_gem.coffee" pinned="false" current-in-tab="false">
27
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/documents_gem.coffee">
28
- <provider selected="true" editor-type-id="text-editor">
29
- <state relative-caret-position="608">
30
- <caret line="32" column="4" lean-forward="false" selection-start-line="32" selection-start-column="4" selection-end-line="32" selection-end-column="4" />
31
- <folding />
32
- </state>
33
- </provider>
34
- </entry>
35
- </file>
36
- <file leaf-file-name="upload_document_tool.js" pinned="false" current-in-tab="false">
37
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/upload_document_tool.js">
38
- <provider selected="true" editor-type-id="text-editor">
39
- <state relative-caret-position="19">
40
- <caret line="1" column="25" lean-forward="false" selection-start-line="1" selection-start-column="25" selection-end-line="1" selection-end-column="25" />
41
- <folding>
42
- <element signature="n#!!doc" expanded="true" />
43
- </folding>
44
- </state>
45
- </provider>
46
- </entry>
47
- </file>
48
- <file leaf-file-name="progress_bar.js" pinned="false" current-in-tab="false">
49
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/progress_bar.js">
50
- <provider selected="true" editor-type-id="text-editor">
51
- <state relative-caret-position="722">
52
- <caret line="38" column="3" lean-forward="false" selection-start-line="38" selection-start-column="3" selection-end-line="38" selection-end-column="3" />
53
- <folding />
54
- </state>
55
- </provider>
56
- </entry>
57
- </file>
58
16
  <file leaf-file-name="_documents.html.erb" pinned="false" current-in-tab="false">
59
17
  <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_documents.html.erb">
60
18
  <provider selected="true" editor-type-id="text-editor">
61
- <state relative-caret-position="209">
62
- <caret line="11" column="51" lean-forward="false" selection-start-line="11" selection-start-column="51" selection-end-line="11" selection-end-column="51" />
63
- <folding />
64
- </state>
65
- </provider>
66
- </entry>
67
- </file>
68
- <file leaf-file-name="_form_error.html.erb" pinned="false" current-in-tab="false">
69
- <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_form_error.html.erb">
70
- <provider selected="true" editor-type-id="text-editor">
71
- <state relative-caret-position="57">
72
- <caret line="3" column="14" lean-forward="false" selection-start-line="3" selection-start-column="14" selection-end-line="3" selection-end-column="14" />
73
- <folding />
74
- </state>
75
- </provider>
76
- </entry>
77
- </file>
78
- <file leaf-file-name="_form.html.erb" pinned="false" current-in-tab="false">
79
- <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_form.html.erb">
80
- <provider selected="true" editor-type-id="text-editor">
81
- <state relative-caret-position="38">
82
- <caret line="2" column="16" lean-forward="false" selection-start-line="2" selection-start-column="16" selection-end-line="2" selection-end-column="16" />
83
- <folding />
84
- </state>
85
- </provider>
86
- </entry>
87
- </file>
88
- <file leaf-file-name="upload_document_tool.scss" pinned="false" current-in-tab="true">
89
- <entry file="file://$PROJECT_DIR$/app/assets/stylesheets/upload_document_tool.scss">
90
- <provider selected="true" editor-type-id="text-editor">
91
- <state relative-caret-position="456">
92
- <caret line="24" column="44" lean-forward="true" selection-start-line="24" selection-start-column="44" selection-end-line="24" selection-end-column="44" />
19
+ <state relative-caret-position="19">
20
+ <caret line="1" column="43" lean-forward="true" selection-start-line="1" selection-start-column="43" selection-end-line="1" selection-end-column="43" />
93
21
  <folding />
94
22
  </state>
95
23
  </provider>
96
24
  </entry>
97
25
  </file>
98
- <file leaf-file-name="version.rb" pinned="false" current-in-tab="false">
26
+ <file leaf-file-name="version.rb" pinned="false" current-in-tab="true">
99
27
  <entry file="file://$PROJECT_DIR$/lib/upload_documents_tool/version.rb">
100
28
  <provider selected="true" editor-type-id="text-editor">
101
29
  <state relative-caret-position="19">
@@ -105,16 +33,6 @@
105
33
  </provider>
106
34
  </entry>
107
35
  </file>
108
- <file leaf-file-name="upload_documents_tool.rb" pinned="false" current-in-tab="false">
109
- <entry file="file://$PROJECT_DIR$/lib/upload_documents_tool.rb">
110
- <provider selected="true" editor-type-id="text-editor">
111
- <state relative-caret-position="342">
112
- <caret line="18" column="50" lean-forward="false" selection-start-line="18" selection-start-column="50" selection-end-line="18" selection-end-column="50" />
113
- <folding />
114
- </state>
115
- </provider>
116
- </entry>
117
- </file>
118
36
  </leaf>
119
37
  </component>
120
38
  <component name="FileTemplateManagerImpl">
@@ -140,7 +58,6 @@
140
58
  <option value="$PROJECT_DIR$/lib/upload_documents_tool/validators.rb" />
141
59
  <option value="$PROJECT_DIR$/app/assets/javascripts/documents.coffee" />
142
60
  <option value="$PROJECT_DIR$/app/assets/javascripts/progress_bar.js" />
143
- <option value="$PROJECT_DIR$/app/views/upload_documents_tool/_documents.html.erb" />
144
61
  <option value="$PROJECT_DIR$/app/views/upload_documents_tool/_form_error.html.erb" />
145
62
  <option value="$PROJECT_DIR$/upload_documents_tool.gemspec" />
146
63
  <option value="$PROJECT_DIR$/lib/upload_documents_tool.rb" />
@@ -148,8 +65,9 @@
148
65
  <option value="$PROJECT_DIR$/app/views/upload_documents_tool/_form.html.erb" />
149
66
  <option value="$PROJECT_DIR$/app/models/document.rb" />
150
67
  <option value="$PROJECT_DIR$/app/assets/javascripts/upload_document_tool.js" />
151
- <option value="$PROJECT_DIR$/lib/upload_documents_tool/version.rb" />
152
68
  <option value="$PROJECT_DIR$/app/assets/stylesheets/upload_document_tool.scss" />
69
+ <option value="$PROJECT_DIR$/app/views/upload_documents_tool/_documents.html.erb" />
70
+ <option value="$PROJECT_DIR$/lib/upload_documents_tool/version.rb" />
153
71
  </list>
154
72
  </option>
155
73
  </component>
@@ -159,9 +77,9 @@
159
77
  <detection-done>true</detection-done>
160
78
  <sorting>DEFINITION_ORDER</sorting>
161
79
  </component>
162
- <component name="ProjectFrameBounds">
163
- <option name="x" value="28" />
164
- <option name="y" value="22" />
80
+ <component name="ProjectFrameBounds" extendedState="6">
81
+ <option name="x" value="134" />
82
+ <option name="y" value="94" />
165
83
  <option name="width" value="1920" />
166
84
  <option name="height" value="1054" />
167
85
  </component>
@@ -294,15 +212,15 @@
294
212
  <option name="number" value="Default" />
295
213
  <option name="presentableId" value="Default" />
296
214
  <updated>1507017759027</updated>
297
- <workItem from="1507017760194" duration="15063000" />
215
+ <workItem from="1507017760194" duration="19620000" />
298
216
  </task>
299
217
  <servers />
300
218
  </component>
301
219
  <component name="TimeTrackingManager">
302
- <option name="totallyTimeSpent" value="15063000" />
220
+ <option name="totallyTimeSpent" value="19620000" />
303
221
  </component>
304
222
  <component name="ToolWindowManager">
305
- <frame x="28" y="22" width="1920" height="1054" extended-state="0" />
223
+ <frame x="0" y="22" width="1920" height="1054" extended-state="6" />
306
224
  <editor active="true" />
307
225
  <layout>
308
226
  <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2414347" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
@@ -335,19 +253,6 @@
335
253
  <watches-manager />
336
254
  </component>
337
255
  <component name="editorHistoryManager">
338
- <entry file="file://$PROJECT_DIR$/README.md">
339
- <provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
340
- <state split_layout="SPLIT">
341
- <first_editor relative-caret-position="0">
342
- <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
343
- <folding />
344
- </first_editor>
345
- <second_editor>
346
- <js_state />
347
- </second_editor>
348
- </state>
349
- </provider>
350
- </entry>
351
256
  <entry file="file://$PROJECT_DIR$/.gitignore">
352
257
  <provider selected="true" editor-type-id="text-editor">
353
258
  <state relative-caret-position="228">
@@ -380,15 +285,15 @@
380
285
  </state>
381
286
  </provider>
382
287
  </entry>
383
- <entry file="file://$PROJECT_DIR$/upload_documents_tool.gemspec">
288
+ <entry file="file://$PROJECT_DIR$/spec/upload_documents_tool_spec.rb">
384
289
  <provider selected="true" editor-type-id="text-editor">
385
- <state relative-caret-position="261">
386
- <caret line="16" column="28" lean-forward="false" selection-start-line="16" selection-start-column="28" selection-end-line="16" selection-end-column="28" />
290
+ <state relative-caret-position="0">
291
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
387
292
  <folding />
388
293
  </state>
389
294
  </provider>
390
295
  </entry>
391
- <entry file="file://$PROJECT_DIR$/spec/upload_documents_tool_spec.rb">
296
+ <entry file="file://$PROJECT_DIR$/app/models/document.rb">
392
297
  <provider selected="true" editor-type-id="text-editor">
393
298
  <state relative-caret-position="0">
394
299
  <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
@@ -396,92 +301,113 @@
396
301
  </state>
397
302
  </provider>
398
303
  </entry>
399
- <entry file="file://$PROJECT_DIR$/app/models/document.rb">
304
+ <entry file="file://$PROJECT_DIR$/lib/upload_documents_tool.rb">
400
305
  <provider selected="true" editor-type-id="text-editor">
401
- <state relative-caret-position="0">
402
- <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
306
+ <state relative-caret-position="342">
307
+ <caret line="18" column="50" lean-forward="false" selection-start-line="18" selection-start-column="50" selection-end-line="18" selection-end-column="50" />
403
308
  <folding />
404
309
  </state>
405
310
  </provider>
406
311
  </entry>
407
- <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_form_error.html.erb">
312
+ <entry file="file://$PROJECT_DIR$/app/assets/javascripts/documents_gem.coffee">
408
313
  <provider selected="true" editor-type-id="text-editor">
409
- <state relative-caret-position="57">
410
- <caret line="3" column="14" lean-forward="false" selection-start-line="3" selection-start-column="14" selection-end-line="3" selection-end-column="14" />
314
+ <state relative-caret-position="608">
315
+ <caret line="32" column="4" lean-forward="false" selection-start-line="32" selection-start-column="4" selection-end-line="32" selection-end-column="4" />
411
316
  <folding />
412
317
  </state>
413
318
  </provider>
414
319
  </entry>
415
- <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_form.html.erb">
320
+ <entry file="file://$PROJECT_DIR$/app/assets/javascripts/progress_bar.js">
416
321
  <provider selected="true" editor-type-id="text-editor">
417
- <state relative-caret-position="38">
418
- <caret line="2" column="16" lean-forward="false" selection-start-line="2" selection-start-column="16" selection-end-line="2" selection-end-column="16" />
322
+ <state relative-caret-position="722">
323
+ <caret line="38" column="3" lean-forward="false" selection-start-line="38" selection-start-column="3" selection-end-line="38" selection-end-column="3" />
419
324
  <folding />
420
325
  </state>
421
326
  </provider>
422
327
  </entry>
423
- <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_documents.html.erb">
328
+ <entry file="file://$PROJECT_DIR$/app/assets/javascripts/upload_document_tool.js">
424
329
  <provider selected="true" editor-type-id="text-editor">
425
- <state relative-caret-position="209">
426
- <caret line="11" column="51" lean-forward="false" selection-start-line="11" selection-start-column="51" selection-end-line="11" selection-end-column="51" />
330
+ <state relative-caret-position="19">
331
+ <caret line="1" column="25" lean-forward="false" selection-start-line="1" selection-start-column="25" selection-end-line="1" selection-end-column="25" />
332
+ <folding>
333
+ <element signature="n#!!doc" expanded="true" />
334
+ </folding>
335
+ </state>
336
+ </provider>
337
+ </entry>
338
+ <entry file="file://$PROJECT_DIR$/app/assets/stylesheets/upload_document_tool.scss">
339
+ <provider selected="true" editor-type-id="text-editor">
340
+ <state relative-caret-position="456">
341
+ <caret line="24" column="44" lean-forward="true" selection-start-line="24" selection-start-column="44" selection-end-line="24" selection-end-column="44" />
427
342
  <folding />
428
343
  </state>
429
344
  </provider>
430
345
  </entry>
431
- <entry file="file://$PROJECT_DIR$/lib/upload_documents_tool.rb">
346
+ <entry file="file://$PROJECT_DIR$/README.md">
347
+ <provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
348
+ <state split_layout="SPLIT">
349
+ <first_editor relative-caret-position="0">
350
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
351
+ <folding />
352
+ </first_editor>
353
+ <second_editor>
354
+ <js_state />
355
+ </second_editor>
356
+ </state>
357
+ </provider>
358
+ </entry>
359
+ <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_form.html.erb">
432
360
  <provider selected="true" editor-type-id="text-editor">
433
- <state relative-caret-position="342">
434
- <caret line="18" column="50" lean-forward="false" selection-start-line="18" selection-start-column="50" selection-end-line="18" selection-end-column="50" />
361
+ <state relative-caret-position="38">
362
+ <caret line="2" column="16" lean-forward="false" selection-start-line="2" selection-start-column="16" selection-end-line="2" selection-end-column="16" />
435
363
  <folding />
436
364
  </state>
437
365
  </provider>
438
366
  </entry>
439
- <entry file="file://$PROJECT_DIR$/app/helpers/upload_document_tool_helper.rb">
367
+ <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_form_error.html.erb">
440
368
  <provider selected="true" editor-type-id="text-editor">
441
- <state relative-caret-position="228">
442
- <caret line="12" column="14" lean-forward="false" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
369
+ <state relative-caret-position="114">
370
+ <caret line="6" column="9" lean-forward="true" selection-start-line="6" selection-start-column="9" selection-end-line="6" selection-end-column="9" />
443
371
  <folding />
444
372
  </state>
445
373
  </provider>
446
374
  </entry>
447
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/documents_gem.coffee">
375
+ <entry file="file://$PROJECT_DIR$/Gemfile">
448
376
  <provider selected="true" editor-type-id="text-editor">
449
- <state relative-caret-position="608">
450
- <caret line="32" column="4" lean-forward="false" selection-start-line="32" selection-start-column="4" selection-end-line="32" selection-end-column="4" />
377
+ <state relative-caret-position="0">
378
+ <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
451
379
  <folding />
452
380
  </state>
453
381
  </provider>
454
382
  </entry>
455
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/progress_bar.js">
383
+ <entry file="file://$PROJECT_DIR$/upload_documents_tool.gemspec">
456
384
  <provider selected="true" editor-type-id="text-editor">
457
- <state relative-caret-position="722">
458
- <caret line="38" column="3" lean-forward="false" selection-start-line="38" selection-start-column="3" selection-end-line="38" selection-end-column="3" />
385
+ <state relative-caret-position="541">
386
+ <caret line="32" column="36" lean-forward="false" selection-start-line="32" selection-start-column="22" selection-end-line="32" selection-end-column="36" />
459
387
  <folding />
460
388
  </state>
461
389
  </provider>
462
390
  </entry>
463
- <entry file="file://$PROJECT_DIR$/lib/upload_documents_tool/version.rb">
391
+ <entry file="file://$PROJECT_DIR$/app/helpers/upload_document_tool_helper.rb">
464
392
  <provider selected="true" editor-type-id="text-editor">
465
- <state relative-caret-position="19">
466
- <caret line="1" column="18" lean-forward="false" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
393
+ <state relative-caret-position="228">
394
+ <caret line="12" column="14" lean-forward="false" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
467
395
  <folding />
468
396
  </state>
469
397
  </provider>
470
398
  </entry>
471
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/upload_document_tool.js">
399
+ <entry file="file://$PROJECT_DIR$/app/views/upload_documents_tool/_documents.html.erb">
472
400
  <provider selected="true" editor-type-id="text-editor">
473
401
  <state relative-caret-position="19">
474
- <caret line="1" column="25" lean-forward="false" selection-start-line="1" selection-start-column="25" selection-end-line="1" selection-end-column="25" />
475
- <folding>
476
- <element signature="n#!!doc" expanded="true" />
477
- </folding>
402
+ <caret line="1" column="43" lean-forward="true" selection-start-line="1" selection-start-column="43" selection-end-line="1" selection-end-column="43" />
403
+ <folding />
478
404
  </state>
479
405
  </provider>
480
406
  </entry>
481
- <entry file="file://$PROJECT_DIR$/app/assets/stylesheets/upload_document_tool.scss">
407
+ <entry file="file://$PROJECT_DIR$/lib/upload_documents_tool/version.rb">
482
408
  <provider selected="true" editor-type-id="text-editor">
483
- <state relative-caret-position="456">
484
- <caret line="24" column="44" lean-forward="true" selection-start-line="24" selection-start-column="44" selection-end-line="24" selection-end-column="44" />
409
+ <state relative-caret-position="19">
410
+ <caret line="1" column="18" lean-forward="false" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
485
411
  <folding />
486
412
  </state>
487
413
  </provider>
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- upload_documents_tool (0.1.7)
4
+ upload_documents_tool (0.1.8)
5
5
  bootstrap-kaminari-views (~> 0.0.5)
6
6
  bootstrap-sass
7
7
  font-awesome-sass
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # UploadDocumentsTool
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/upload_documents_tool`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This Gem provides a tool which can be integrated easaly in a panel/dashboard of any kind.
4
+ It is providing essentially three partial views which can be implemented anywhere in an app where this Gem is imported. The implementation is easy due the helper method made especially for render the views.
5
+ The tool provides this three views:
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ - _documents.html.erb. // This is the table showing all he documents
8
+ - _form.html.erb // This is the upload form for upload the documents
9
+ - _form_error.html.erb // This is the form error for show erros in the form by a message
10
+
11
+ The tool autogenerate during the first upload a new folder under uploads called documents. Here all documents are stored.
6
12
 
7
13
  ## Installation
8
14
 
@@ -11,6 +17,11 @@ Add this line to your application's Gemfile:
11
17
  ```ruby
12
18
  gem 'upload_documents_tool'
13
19
  ```
20
+ Or for local enviroment
21
+
22
+ ```ruby
23
+ gem 'uploade_document_tool', path: "<pathToTheGem>/uploade_document_tool"
24
+ ```
14
25
 
15
26
  And then execute:
16
27
 
@@ -22,7 +33,76 @@ Or install it yourself as:
22
33
 
23
34
  ## Usage
24
35
 
25
- TODO: Write usage instructions here
36
+ To be able to use the Gem in the correct way we need the next dependencies:
37
+
38
+ - ["railties", "~> 4.2.6"](https://github.com/rails/rails/tree/master/railties)
39
+ - ["jquery-rails"](https://github.com/rails/jquery-rails)
40
+ - ["kaminari", "~> 1.0.1"](https://github.com/kaminari/kaminari)
41
+ - ["bootstrap-kaminari-views", "~> 0.0.5"](https://github.com/matenia/bootstrap-kaminari-views)
42
+ - ["bootstrap-sass"](https://github.com/twbs/bootstrap-sass)
43
+ - ["jasny-bootstrap-rails"](http://www.jasny.net/bootstrap/)
44
+ - ["font-awesome-sass"](https://github.com/FortAwesome/font-awesome-sass)
45
+ - ["toastr-rails"](https://github.com/tylergannon/toastr-rails)
46
+
47
+ After the Gem was succesfully installed in your system, you need to set up a table in your database where to store the uploaded documents. You can do that under the folder `./db/migrate/` and in your migration file you can add like next(Your migration file should be similar with different name and less fields):
48
+
49
+ ```ruby
50
+ class CreateDocuments < ActiveRecord::Migration
51
+ def change
52
+ create_table :documents do |t|
53
+ t.string :filename
54
+ t.string :content_type
55
+ t.binary :file_contents
56
+
57
+ t.timestamps null: false
58
+ end
59
+ end
60
+ end
61
+ ```
62
+
63
+ Then run migration:
64
+
65
+ ```
66
+ rake db:migrate
67
+ ```
68
+
69
+ To be able to use the functionality of the Gem you need tu use the next implementation in your controller using this `@documents = ...` this calls the Gem:
70
+
71
+ ```ruby
72
+ def index
73
+ @documents = Document.order(sort_column + " " + sort_direction).page(params[:page]).per(params[:limit])
74
+ end
75
+ ```
76
+
77
+ In this example we are setting up in the Index the table of all documents providing the sort, pagination and item per page to show.
78
+
79
+ For the validation checking we need to import in to a model the functionality of the tool.
80
+ We can do like the next model example:
81
+
82
+ ```ruby
83
+ class Document < ActiveRecord::Base
84
+ include UploadDocumentsTool
85
+ validate :document_file_format
86
+ before_save :upload_local
87
+ validates_uniqueness_of :filename, message: "File exist"
88
+ end
89
+ ```
90
+
91
+ The [helper method](https://github.com/Jakub41/upload_documents_tool/blob/master/app/helpers/upload_document_tool_helper.rb) inside the Gem provide an easy way to render the partials inside a prefered view.
92
+
93
+ Table of all documents:
94
+
95
+ ```ruby
96
+ <%= documents_table @documents %>
97
+ ```
98
+
99
+ Upload form:
100
+
101
+ ```ruby
102
+ <%= document_form @document %>
103
+ ```
104
+
105
+
26
106
 
27
107
  ## Development
28
108
 
@@ -1,3 +1,6 @@
1
+ <%= link_to new_document_path, class: "btn btn-success pull-right", data: {turbolinks: false} do %>
2
+ <i class="fa fa-plus"></i> New Document
3
+ <% end %>
1
4
  <table class="table table-striped table-hover">
2
5
  <div class="pull-left">
3
6
  <%= form_tag controller_name, method: :get, id: 'limit_form' do %>
@@ -1,3 +1,3 @@
1
1
  module UploadDocumentsTool
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upload_documents_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub41