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 +4 -4
- data/app/assets/stylesheets/my_forum/private_messages.css.scss +4 -0
- data/app/controllers/my_forum/attachments_controller.rb +11 -6
- data/app/helpers/my_forum/private_messages_helper.rb +1 -1
- data/app/models/my_forum/avatar.rb +1 -0
- data/app/models/my_forum/user.rb +2 -0
- data/app/views/my_forum/topics/_quick_answer.haml +11 -8
- data/app/views/my_forum/users/edit.haml +15 -7
- data/config/locales/ru.yml +2 -0
- data/lib/my_forum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 020ff8affd1ce1d65168d750aaa61b9ae3d57428
|
4
|
+
data.tar.gz: 0ed70a668baca8ce0c11f49131f52d53bfa8104e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d019565ba88c7ce909f34b25bd78d2a10f10fb81ea2effb8669d1048494a3f7277439c2662ebb9654724d54ea7fdf1039bc34949d5f67bf9329eac4ba3663095
|
7
|
+
data.tar.gz: 07bd3b757f4fa2624a74ba343a02cbd30150ab0c5d21fb831685ddadbf850472f94e34015ac0fda42606d99246592d9c3eb72e9711d61516e7b9e4b2bbd305fb
|
@@ -9,14 +9,19 @@ module MyForum
|
|
9
9
|
# Create dir of not exists
|
10
10
|
FileUtils::mkdir_p upload_path
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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,
|
24
|
+
render json: { success: true, attachments: attachment_ids }.to_json
|
20
25
|
end
|
21
26
|
|
22
27
|
end
|
data/app/models/my_forum/user.rb
CHANGED
@@ -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 :
|
60
|
+
= f.file_field 'file[]', multiple: true, id: 'attachment_files'
|
61
61
|
|
62
62
|
#loaded-content
|
63
63
|
|
64
64
|
:coffee
|
65
|
-
$('#
|
66
|
-
file_data = $('#attachment_file').prop('files')[0]
|
65
|
+
$('#attachment_files').change ->
|
67
66
|
form_data = new FormData()
|
68
|
-
|
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
|
-
|
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
|
3
|
+
.row
|
4
|
+
.col-md-4
|
4
5
|
|
5
|
-
|
6
|
+
= errors_for(current_user)
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
data/config/locales/ru.yml
CHANGED
data/lib/my_forum/version.rb
CHANGED