the_storages 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/app/assets/images/content_types/default.jpg +0 -0
  2. data/app/assets/images/content_types/file_extension_3gp.png +0 -0
  3. data/app/assets/images/content_types/file_extension_7z.png +0 -0
  4. data/app/assets/images/content_types/file_extension_ace.png +0 -0
  5. data/app/assets/images/content_types/file_extension_ai.png +0 -0
  6. data/app/assets/images/content_types/file_extension_aif.png +0 -0
  7. data/app/assets/images/content_types/file_extension_aiff.png +0 -0
  8. data/app/assets/images/content_types/file_extension_amr.png +0 -0
  9. data/app/assets/images/content_types/file_extension_asf.png +0 -0
  10. data/app/assets/images/content_types/file_extension_asx.png +0 -0
  11. data/app/assets/images/content_types/file_extension_bat.png +0 -0
  12. data/app/assets/images/content_types/file_extension_bin.png +0 -0
  13. data/app/assets/images/content_types/file_extension_bmp.png +0 -0
  14. data/app/assets/images/content_types/file_extension_bup.png +0 -0
  15. data/app/assets/images/content_types/file_extension_cab.png +0 -0
  16. data/app/assets/images/content_types/file_extension_cbr.png +0 -0
  17. data/app/assets/images/content_types/file_extension_cda.png +0 -0
  18. data/app/assets/images/content_types/file_extension_cdl.png +0 -0
  19. data/app/assets/images/content_types/file_extension_cdr.png +0 -0
  20. data/app/assets/images/content_types/file_extension_chm.png +0 -0
  21. data/app/assets/images/content_types/file_extension_dat.png +0 -0
  22. data/app/assets/images/content_types/file_extension_divx.png +0 -0
  23. data/app/assets/images/content_types/file_extension_dll.png +0 -0
  24. data/app/assets/images/content_types/file_extension_dmg.png +0 -0
  25. data/app/assets/images/content_types/file_extension_doc.png +0 -0
  26. data/app/assets/images/content_types/file_extension_docx.png +0 -0
  27. data/app/assets/images/content_types/file_extension_dss.png +0 -0
  28. data/app/assets/images/content_types/file_extension_dvf.png +0 -0
  29. data/app/assets/images/content_types/file_extension_dwg.png +0 -0
  30. data/app/assets/images/content_types/file_extension_eml.png +0 -0
  31. data/app/assets/images/content_types/file_extension_eps.png +0 -0
  32. data/app/assets/images/content_types/file_extension_exe.png +0 -0
  33. data/app/assets/images/content_types/file_extension_fla.png +0 -0
  34. data/app/assets/images/content_types/file_extension_flv.png +0 -0
  35. data/app/assets/images/content_types/file_extension_gif.png +0 -0
  36. data/app/assets/images/content_types/file_extension_gz.png +0 -0
  37. data/app/assets/images/content_types/file_extension_hqx.png +0 -0
  38. data/app/assets/images/content_types/file_extension_htm.png +0 -0
  39. data/app/assets/images/content_types/file_extension_html.png +0 -0
  40. data/app/assets/images/content_types/file_extension_ifo.png +0 -0
  41. data/app/assets/images/content_types/file_extension_indd.png +0 -0
  42. data/app/assets/images/content_types/file_extension_iso.png +0 -0
  43. data/app/assets/images/content_types/file_extension_jar.png +0 -0
  44. data/app/assets/images/content_types/file_extension_jpeg.png +0 -0
  45. data/app/assets/images/content_types/file_extension_jpg.png +0 -0
  46. data/app/assets/images/content_types/file_extension_lnk.png +0 -0
  47. data/app/assets/images/content_types/file_extension_log.png +0 -0
  48. data/app/assets/images/content_types/file_extension_m4a.png +0 -0
  49. data/app/assets/images/content_types/file_extension_m4b.png +0 -0
  50. data/app/assets/images/content_types/file_extension_m4p.png +0 -0
  51. data/app/assets/images/content_types/file_extension_m4v.png +0 -0
  52. data/app/assets/images/content_types/file_extension_mcd.png +0 -0
  53. data/app/assets/images/content_types/file_extension_mdb.png +0 -0
  54. data/app/assets/images/content_types/file_extension_mid.png +0 -0
  55. data/app/assets/images/content_types/file_extension_mov.png +0 -0
  56. data/app/assets/images/content_types/file_extension_mp2.png +0 -0
  57. data/app/assets/images/content_types/file_extension_mp4.png +0 -0
  58. data/app/assets/images/content_types/file_extension_mpeg.png +0 -0
  59. data/app/assets/images/content_types/file_extension_mpg.png +0 -0
  60. data/app/assets/images/content_types/file_extension_msi.png +0 -0
  61. data/app/assets/images/content_types/file_extension_mswmm.png +0 -0
  62. data/app/assets/images/content_types/file_extension_ogg.png +0 -0
  63. data/app/assets/images/content_types/file_extension_pdf.png +0 -0
  64. data/app/assets/images/content_types/file_extension_php.png +0 -0
  65. data/app/assets/images/content_types/file_extension_png.png +0 -0
  66. data/app/assets/images/content_types/file_extension_pps.png +0 -0
  67. data/app/assets/images/content_types/file_extension_ps.png +0 -0
  68. data/app/assets/images/content_types/file_extension_psd.png +0 -0
  69. data/app/assets/images/content_types/file_extension_pst.png +0 -0
  70. data/app/assets/images/content_types/file_extension_ptb.png +0 -0
  71. data/app/assets/images/content_types/file_extension_pub.png +0 -0
  72. data/app/assets/images/content_types/file_extension_qbb.png +0 -0
  73. data/app/assets/images/content_types/file_extension_qbw.png +0 -0
  74. data/app/assets/images/content_types/file_extension_qxd.png +0 -0
  75. data/app/assets/images/content_types/file_extension_ram.png +0 -0
  76. data/app/assets/images/content_types/file_extension_rar.png +0 -0
  77. data/app/assets/images/content_types/file_extension_rb.png +0 -0
  78. data/app/assets/images/content_types/file_extension_rm.png +0 -0
  79. data/app/assets/images/content_types/file_extension_rmvb.png +0 -0
  80. data/app/assets/images/content_types/file_extension_rtf.png +0 -0
  81. data/app/assets/images/content_types/file_extension_sea.png +0 -0
  82. data/app/assets/images/content_types/file_extension_ses.png +0 -0
  83. data/app/assets/images/content_types/file_extension_sit.png +0 -0
  84. data/app/assets/images/content_types/file_extension_sitx.png +0 -0
  85. data/app/assets/images/content_types/file_extension_ss.png +0 -0
  86. data/app/assets/images/content_types/file_extension_swf.png +0 -0
  87. data/app/assets/images/content_types/file_extension_tgz.png +0 -0
  88. data/app/assets/images/content_types/file_extension_thm.png +0 -0
  89. data/app/assets/images/content_types/file_extension_tif.png +0 -0
  90. data/app/assets/images/content_types/file_extension_tmp.png +0 -0
  91. data/app/assets/images/content_types/file_extension_torrent.png +0 -0
  92. data/app/assets/images/content_types/file_extension_ttf.png +0 -0
  93. data/app/assets/images/content_types/file_extension_txt.png +0 -0
  94. data/app/assets/images/content_types/file_extension_vcd.png +0 -0
  95. data/app/assets/images/content_types/file_extension_vob.png +0 -0
  96. data/app/assets/images/content_types/file_extension_wav.png +0 -0
  97. data/app/assets/images/content_types/file_extension_wma.png +0 -0
  98. data/app/assets/images/content_types/file_extension_wmv.png +0 -0
  99. data/app/assets/images/content_types/file_extension_wps.png +0 -0
  100. data/app/assets/images/content_types/file_extension_xls.png +0 -0
  101. data/app/assets/images/content_types/file_extension_xpi.png +0 -0
  102. data/app/assets/images/content_types/file_extension_zip.png +0 -0
  103. data/app/assets/images/female.png +0 -0
  104. data/app/assets/images/gear.png +0 -0
  105. data/app/assets/images/male.png +0 -0
  106. data/app/assets/images/new.png +0 -0
  107. data/app/assets/images/rotate_left.png +0 -0
  108. data/app/assets/images/rotate_right.png +0 -0
  109. data/app/assets/javascripts/the_storages/image_crop.js.coffee +69 -0
  110. data/app/assets/javascripts/the_storages/water_mark_switcher.js.coffee +17 -0
  111. data/app/assets/stylesheets/the_storages.css.scss +117 -0
  112. data/app/controllers/concerns/attached_files_actions.rb +37 -0
  113. data/app/controllers/concerns/the_storages_image_processor.rb +20 -0
  114. data/app/helpers/attached_files_list_helper.rb +115 -0
  115. data/app/helpers/file_size_helper.rb +9 -0
  116. data/app/models/concerns/act_as_attached_file.rb +69 -0
  117. data/app/models/concerns/act_as_storage.rb +7 -27
  118. data/app/models/concerns/attachment_processing.rb +46 -0
  119. data/app/models/concerns/has_attached_files.rb +14 -0
  120. data/app/models/concerns/image_manipulation.rb +63 -0
  121. data/app/models/concerns/storage_image_processing.rb +90 -0
  122. data/app/models/concerns/watermark_fu.rb +97 -0
  123. data/app/models/delayed_image_processor.rb +6 -0
  124. data/app/views/the_storages/_form.haml +10 -18
  125. data/app/views/the_storages/_list.haml +5 -39
  126. data/config/initializers/paperclip.rb +39 -0
  127. data/config/locales/en.yml +5 -0
  128. data/config/locales/ru.yml +7 -0
  129. data/config/routes.rb +8 -0
  130. data/db/migrate/20130101010101_attached_files.rb +29 -0
  131. data/db/migrate/20130101010102_change_storages.rb +2 -2
  132. data/fonts.txt +1342 -0
  133. data/lib/generators/the_storages/USAGE +1 -20
  134. data/lib/generators/the_storages/templates/the_storages.rb +10 -0
  135. data/lib/generators/the_storages/the_storages_generator.rb +4 -21
  136. data/lib/the_storages.rb +32 -2
  137. data/lib/the_storages/config.rb +32 -0
  138. data/lib/the_storages/version.rb +1 -1
  139. data/the_storages.gemspec +1 -0
  140. data/vendor/assets/images/Jcrop.gif +0 -0
  141. data/vendor/assets/javascripts/jquery.Jcrop.js +1694 -0
  142. data/vendor/assets/stylesheets/jquery.Jcrop.css +165 -0
  143. metadata +154 -15
  144. data/app/helpers/the_storages_helper.rb +0 -25
  145. data/app/models/uploaded_file.rb +0 -113
  146. data/app/views/the_storages/_new.haml +0 -36
  147. data/db/migrate/20130101010101_uploaded_files.rb +0 -25
  148. data/lib/generators/the_storages/views_generator.rb +0 -43
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,69 @@
1
+ class @ImageCrop
2
+ @setCoords = (coords, img) ->
3
+ $('#x').val coords.x
4
+ $('#y').val coords.y
5
+ $('#w').val coords.w
6
+ $('#h').val coords.h
7
+ $('#img_w').val img.width()
8
+
9
+ @hideCropWindow = ->
10
+ croppped_preview = $('#cropped_main_image_preview')
11
+ preview_holder = croppped_preview.parent()
12
+ $('#main_image_cropping_save').hide()
13
+ $('#x, #y, #w, #h, #img_w').val('')
14
+ preview_holder.hide()
15
+
16
+ @showPreview = (coords, img) ->
17
+ if parseInt(coords.w) > 0
18
+ croppped_preview = $('#cropped_main_image_preview')
19
+ cropped_save = $('#main_image_cropping_save')
20
+ preview_holder = croppped_preview.parent()
21
+
22
+ rx = preview_holder.width() / coords.w
23
+ ry = preview_holder.height() / coords.h
24
+
25
+ iw = $(img).width()
26
+ ih = $(img).height()
27
+
28
+ croppped_preview.css
29
+ width: Math.round(rx * iw) + 'px'
30
+ height: Math.round(ry * ih) + 'px'
31
+ marginLeft: '-' + Math.round(rx * coords.x) + 'px'
32
+ marginTop: '-' + Math.round(ry * coords.y) + 'px'
33
+
34
+ cropped_save.show()
35
+ preview_holder.show()
36
+
37
+ @init = ->
38
+ rlink = $ '.jcrop_run'
39
+ slink = $ '.jcrop_stop'
40
+ holder = rlink.parents('.image_toolbar')
41
+
42
+ $('.cropped_preview_holder').on 'click', '#main_image_cropping_save', (e) ->
43
+ $('#main_image_cropping').submit()
44
+ false
45
+
46
+ rlink.click ->
47
+ $('.base_view', holder).hide()
48
+ $('.crop_view', holder).show()
49
+ false
50
+
51
+ slink.click ->
52
+ $('.base_view', holder).show()
53
+ $('.crop_view', holder).hide()
54
+ false
55
+
56
+ img_selector = '#main_image_jcrop'
57
+ img = $ img_selector
58
+
59
+ img.load ->
60
+ window.main_image_jcrop = $.Jcrop img_selector,
61
+ aspectRatio: 8/6
62
+ onChange: (coords) ->
63
+ ImageCrop.setCoords(coords, img)
64
+ ImageCrop.showPreview(coords, img)
65
+ onSelect: (coords) ->
66
+ ImageCrop.showPreview(coords, img)
67
+
68
+ onRelease: ->
69
+ ImageCrop.hideCropWindow()
@@ -0,0 +1,17 @@
1
+ class @WaterMarkSwitcher
2
+ @init = ->
3
+ $('.watermark_switcher').on 'click', '.wm_on, .wm_off', ->
4
+ link = $ @
5
+ id = link.parents('li').data('node-id')
6
+
7
+ if link.toggleClass('wm_on wm_off').hasClass('wm_on')
8
+ link.html 'Вкл.'
9
+ else
10
+ link.html 'Выкл.'
11
+
12
+ $.ajax
13
+ type: 'POST'
14
+ url: '/attached_files/watermark_switch'
15
+ data:
16
+ id: id
17
+ _method: 'patch'
@@ -0,0 +1,117 @@
1
+ $file_types: (docx 3gp 7z jpg bin ps rmvb vob ses indd mp2 mp4 ram mid html txt torrent jpeg hqx sit mcd rb dat pub png tgz wav bat m4v cdl mpg divx htm default dmg doc pdf dll eps ogg vcd ifo cda dwg aif cab gif wps bup m4b qxd asf jar ttf asx wma rtf dvf amr xls m4a aiff pps tif dss tmp eml log bmp cdr iso sea rar psd ai m4p mpeg wmv qbb mdb zip gz ace mswmm flv swf ss pst lnk fla cbr xpi exe mov ptb qbw php msi rm chm thm sitx);
2
+
3
+ .attached_files_list{
4
+ li{
5
+ margin-bottom: 15px;
6
+ }
7
+ .item{
8
+ overflow: hidden; zoom: 1;
9
+ }
10
+
11
+ .file_block{
12
+ margin: 0 35px 0 130px;
13
+
14
+ h4{
15
+ margin-left: 0;
16
+ margin-bottom: 5px;
17
+ a{
18
+ margin: 0;
19
+ font-weight: bold;
20
+ }
21
+ }
22
+ }
23
+
24
+ .rotate{
25
+ position: absolute;
26
+ top:65px; left:6px;
27
+ width: 16px;
28
+
29
+ a{
30
+ margin: 0;
31
+ display: inline-block;
32
+ height: 16px; width: 16px;
33
+ background-color: transparent;
34
+ background-repeat: no-repeat;
35
+ background-position: center center;
36
+
37
+ &.left{
38
+ background-image: image-url("rotate_left.png");
39
+ }
40
+ &.right{
41
+ background-image: image-url("rotate_right.png");
42
+ }
43
+ }
44
+ }
45
+
46
+ .preview_pic{
47
+ float: left;
48
+ background: white;
49
+ border: 1px solid gray;
50
+ overflow: hidden; zoom: 1;
51
+ height: 90px; width: 90px;
52
+ position: relative;
53
+ /*border-radius: 45px;*/
54
+ a{
55
+ margin: 0px;
56
+ color: #000000;
57
+ display: inline;
58
+ font-size: 10pt;
59
+ font-weight: normal;
60
+ line-height: 100%;
61
+ text-decoration: none;
62
+ }
63
+
64
+ i{
65
+ display: block;
66
+ height: 90px; width: 90px;
67
+ background-color: transparent;
68
+ background-repeat: no-repeat;
69
+ background-position: center center;
70
+ background-image: image-url("content_types/default.jpg");
71
+
72
+
73
+ @each $file_type in $file_types{
74
+ &.f_#{$file_type} {
75
+ background-image: image-url("content_types/file_extension_#{$file_type}.png");
76
+ }
77
+ }
78
+ }
79
+ }
80
+
81
+ h4{
82
+ margin-left: 135px;
83
+ }
84
+
85
+ .url_input{
86
+ margin-bottom:10px;
87
+
88
+ input{
89
+ border: 1px solid lightgray;
90
+ padding: 4px;
91
+ width: 90%;
92
+ font-size: 1.2em;
93
+ }
94
+ }
95
+
96
+ .watermark_switcher{
97
+ margin-bottom:10px;
98
+ font-size: 1.2em;
99
+ color: #333;
100
+ .wm_off{
101
+ color: gray;
102
+ padding: 3px;
103
+ cursor: pointer;
104
+ background: lightgray;
105
+ }
106
+ .wm_on{
107
+ color: #00561f;
108
+ padding: 3px;
109
+ cursor: pointer;
110
+ background: #bdd3b2;
111
+ }
112
+ }
113
+
114
+ .fsize{
115
+ font-size:0.9em;
116
+ }
117
+ }