my_forum 0.0.1.beta26 → 0.0.1.beta27

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: 020ff8affd1ce1d65168d750aaa61b9ae3d57428
4
- data.tar.gz: 0ed70a668baca8ce0c11f49131f52d53bfa8104e
3
+ metadata.gz: 85befe5d26e8e5dd2cdd6c60b72b8603447b9c5d
4
+ data.tar.gz: 0edfd26fa58e9b16ec5cbf13210352d732adb120
5
5
  SHA512:
6
- metadata.gz: d019565ba88c7ce909f34b25bd78d2a10f10fb81ea2effb8669d1048494a3f7277439c2662ebb9654724d54ea7fdf1039bc34949d5f67bf9329eac4ba3663095
7
- data.tar.gz: 07bd3b757f4fa2624a74ba343a02cbd30150ab0c5d21fb831685ddadbf850472f94e34015ac0fda42606d99246592d9c3eb72e9711d61516e7b9e4b2bbd305fb
6
+ metadata.gz: 55a8479d2f36b42a31b41f686c69a9dd17fdb5ce98e65480c156f88a6d7085770f612b8b8077dfe04c1dafb8b97c6d9af425b328ea6ce1bb1fd77d0cc75e0a28
7
+ data.tar.gz: a9583685f8dc25443eddd20846f9e35aed13a0323ce27c0ccdba6d06c4410c5e82783631e490a98d1057bbf555304a6d4dbbe0fbb2d93a6d691db657b41ce441
@@ -12,6 +12,8 @@ module MyForum
12
12
  attachment_ids = []
13
13
 
14
14
  params[:files].each do |uploaded_io|
15
+ next unless Attachment::ALLOWED_FILE_EXTENSIONS.include? File.extname(uploaded_io.original_filename)
16
+
15
17
  file_name = "#{Time.now.to_i}_#{uploaded_io.original_filename}"
16
18
  File.open(File.join(upload_path, file_name), 'wb') do |file|
17
19
  file.write(uploaded_io.read)
@@ -40,5 +40,8 @@ module MyForum
40
40
  forum_time(datetime)
41
41
  end
42
42
 
43
+ def upload_allowed_extensions
44
+ Attachment::ALLOWED_FILE_EXTENSIONS
45
+ end
43
46
  end
44
47
  end
@@ -5,5 +5,7 @@ module MyForum
5
5
 
6
6
  UPLOAD_PATH = File.join(Rails.public_path, 'uploads', 'attachments')
7
7
  URL = File.join('/uploads', 'attachments')
8
+
9
+ ALLOWED_FILE_EXTENSIONS = %w(.jpg .png .gif)
8
10
  end
9
11
  end
@@ -56,6 +56,7 @@
56
56
  %h4.modal-title
57
57
  = t('.add_new_photo')
58
58
  .modal-body
59
+ %p= t('my_forum.attachments.allowed_extensions', ext: upload_allowed_extensions.join(', '))
59
60
  = form_for MyForum::Attachment.new, url: attachments_path, multipart: true, remote: true do |f|
60
61
  = f.file_field 'file[]', multiple: true, id: 'attachment_files'
61
62
 
@@ -83,6 +84,7 @@
83
84
  $('#quick_answer_textarea').append(bbcode_attachments)
84
85
  $('#loaded-content').html('#{t('my_forum.successfull_aploaded')}')
85
86
  $('#add_photo').modal('hide')
87
+ $('#attachment_files').val('')
86
88
  })
87
89
 
88
90
 
@@ -9,6 +9,10 @@ ru:
9
9
  create_new_topic: 'Создать новую тему'
10
10
  reply_for_pm: 'Ответить на сообщение'
11
11
  successfull_aploaded: 'Файлы успешно загружены'
12
+
13
+ attachments:
14
+ allowed_extensions: "Разрешенные расширения файлов: %{ext}"
15
+
12
16
  bbquote:
13
17
  wrote: 'написал'
14
18
 
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta26"
2
+ VERSION = "0.0.1.beta27"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_forum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta26
4
+ version: 0.0.1.beta27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Omelchenko