my_forum 0.0.1.beta25 → 0.0.1.beta26

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: 450d93bead2bc07e807d09fccfc7b72c2fae13a4
4
- data.tar.gz: 24a6f03d45035b3644d4a666ea79c6dd12180385
3
+ metadata.gz: 020ff8affd1ce1d65168d750aaa61b9ae3d57428
4
+ data.tar.gz: 0ed70a668baca8ce0c11f49131f52d53bfa8104e
5
5
  SHA512:
6
- metadata.gz: f1371af3d9a66b868d1825114ac635dfa336b63915ef8516f72a596bb5dd2360c6c954ca46e421dc7d1ccc6e619c42ed0c04e3218ccf9327d39f878ad3fcb18a
7
- data.tar.gz: 06fd03606e595681df032dd2443b070bb13cfa0de08f42241de6f2a644a39f863298a457100bdd9e2c1d45d7e477b7e6a9cca87eeae380c18f9834ef63e6b5d2
6
+ metadata.gz: d019565ba88c7ce909f34b25bd78d2a10f10fb81ea2effb8669d1048494a3f7277439c2662ebb9654724d54ea7fdf1039bc34949d5f67bf9329eac4ba3663095
7
+ data.tar.gz: 07bd3b757f4fa2624a74ba343a02cbd30150ab0c5d21fb831685ddadbf850472f94e34015ac0fda42606d99246592d9c3eb72e9711d61516e7b9e4b2bbd305fb
@@ -1,3 +1,7 @@
1
+ .new-pm.badge {
2
+ background-color: orange !important;
3
+ }
4
+
1
5
  .new_pm_button {
2
6
  margin-bottom: 14px;
3
7
  }
@@ -9,14 +9,19 @@ module MyForum
9
9
  # Create dir of not exists
10
10
  FileUtils::mkdir_p upload_path
11
11
 
12
- uploaded_io = params[:file]
13
- File.open(File.join(upload_path, uploaded_io.original_filename), 'wb') do |file|
14
- file.write(uploaded_io.read)
15
- end
12
+ attachment_ids = []
13
+
14
+ params[:files].each do |uploaded_io|
15
+ file_name = "#{Time.now.to_i}_#{uploaded_io.original_filename}"
16
+ File.open(File.join(upload_path, file_name), 'wb') do |file|
17
+ file.write(uploaded_io.read)
18
+ end
16
19
 
17
- attachment = Attachment.create(user_id: current_user.id, file_name: uploaded_io.original_filename)
20
+ attachment = Attachment.create(user_id: current_user.id, file_name: file_name)
21
+ attachment_ids.push attachment.id
22
+ end
18
23
 
19
- render json: { success: true, attachment_id: attachment.id }
24
+ render json: { success: true, attachments: attachment_ids }.to_json
20
25
  end
21
26
 
22
27
  end
@@ -18,7 +18,7 @@ module MyForum
18
18
  def new_private_messages_count_bage
19
19
  return unless current_user
20
20
  return if (count = new_pm_count).eql?(0)
21
- content_tag(:span, count, class: 'badge')
21
+ content_tag(:span, count, class: 'new-pm badge')
22
22
  end
23
23
 
24
24
  end
@@ -1,4 +1,5 @@
1
1
  module MyForum
2
2
  class Avatar < Image
3
+ belongs_to :user
3
4
  end
4
5
  end
@@ -9,6 +9,8 @@ module MyForum
9
9
  has_many :user_group_links
10
10
  has_many :user_groups, through: :user_group_links
11
11
 
12
+ has_one :avatar
13
+
12
14
  scope :online, -> { where("updated_at > ?", 10.minutes.ago) }
13
15
  scope :today_visited, -> { where("updated_at > ?", Time.now.beginning_of_day) }
14
16
 
@@ -57,15 +57,16 @@
57
57
  = t('.add_new_photo')
58
58
  .modal-body
59
59
  = form_for MyForum::Attachment.new, url: attachments_path, multipart: true, remote: true do |f|
60
- = f.file_field :file
60
+ = f.file_field 'file[]', multiple: true, id: 'attachment_files'
61
61
 
62
62
  #loaded-content
63
63
 
64
64
  :coffee
65
- $('#attachment_file').change ->
66
- file_data = $('#attachment_file').prop('files')[0]
65
+ $('#attachment_files').change ->
67
66
  form_data = new FormData()
68
- form_data.append('file', file_data)
67
+
68
+ files_count = $('#attachment_files').prop('files').length
69
+ form_data.append('files[]', $('#attachment_files').prop('files')[c]) for c in [0...files_count]
69
70
 
70
71
  $.ajax({
71
72
  url: "#{attachments_path}"
@@ -77,12 +78,14 @@
77
78
  type: 'post',
78
79
  success: (data, textStatus, jqXHR) ->
79
80
  response = $.parseJSON(data)
80
- $('#quick_answer_textarea').append('[attachment=' + response.attachment_id + ']')
81
+ bbcode_attachments = ''
82
+ bbcode_attachments += ('[attachment=' + id + '] \n') for id in response.attachments
83
+ $('#quick_answer_textarea').append(bbcode_attachments)
84
+ $('#loaded-content').html('#{t('my_forum.successfull_aploaded')}')
85
+ $('#add_photo').modal('hide')
81
86
  })
82
87
 
83
88
 
84
89
  .modal-footer
85
90
  %button.btn.btn-default{ type: 'button', aria_label: 'Close', data: { dismiss: 'modal' } }
86
- Close
87
- %button.btn.btn-primary{ type: 'button' }
88
- Save changes
91
+ Close
@@ -1,12 +1,20 @@
1
1
  %h2= t('.edit_profile')
2
2
 
3
- .row.col-md-4
3
+ .row
4
+ .col-md-4
4
5
 
5
- = errors_for(current_user)
6
+ = errors_for(current_user)
6
7
 
7
- = form_for current_user, url: user_path(current_user), role: 'form' do |form|
8
- .form-group= form.text_field :email, class: 'name form-control', placeholder: t('.email')
9
- .form-group= form.password_field :password, value: '', class: 'description form-control', placeholder: t('.current_password')
10
- .form-group= form.text_field :new_password, value: '', class: 'description form-control', placeholder: t('.new_password')
8
+ = form_for current_user, url: user_path(current_user), role: 'form' do |form|
9
+ .form-group= form.text_field :email, class: 'name form-control', placeholder: t('.email')
10
+ .form-group= form.password_field :password, value: '', class: 'description form-control', placeholder: t('.current_password')
11
+ .form-group= form.text_field :new_password, value: '', class: 'description form-control', placeholder: t('.new_password')
11
12
 
12
- = form.submit class: 'btn btn-primary btn-sm'
13
+ = form.submit class: 'btn btn-primary btn-sm'
14
+
15
+ .col-md-4
16
+ .row.col-sm-4
17
+ .thumbnail
18
+ = user_avatar(current_user)
19
+ .row.col-sm-4
20
+ upload
@@ -7,6 +7,8 @@ ru:
7
7
  yesterday: "Вчера в %{hhmm}"
8
8
  create_new_pm: 'Написать личное сообщение'
9
9
  create_new_topic: 'Создать новую тему'
10
+ reply_for_pm: 'Ответить на сообщение'
11
+ successfull_aploaded: 'Файлы успешно загружены'
10
12
  bbquote:
11
13
  wrote: 'написал'
12
14
 
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta25"
2
+ VERSION = "0.0.1.beta26"
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.beta25
4
+ version: 0.0.1.beta26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Omelchenko