my_forum 0.0.1.beta32 → 0.0.1.beta33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f30da0c902dc4cd875aafee489523ec8625b2663
4
- data.tar.gz: e15252c800442769c97569021bfd5700100b2c7e
3
+ metadata.gz: 42d3c4effdd86a539eb88301254c27338b41e46c
4
+ data.tar.gz: 6aa22f02793852e3978d20090e4bff5bc22ea810
5
5
  SHA512:
6
- metadata.gz: 78238441523954305ba88332ab7a1bb46274bbcdeb88e48fb8fc9ae0957ea2246428fd44870acfcfd9e609a932d1cc5d9c18913033f5f4d59632e693b74c749f
7
- data.tar.gz: 276fed314891ee8b47bfbb43b3e61f309d87aa29e18ee10ae40636c91714be7a9c03210b5b3d43f0dd586a4ed1d7150029cb980ea6641823fb28e363183db2d4
6
+ metadata.gz: ba7c4fe57317a26cf37ca85ac973dd47c41de8601b5353405536b4e34a3be18fee3619dae762db1611a5ee1bf381dbf7f01fc9619c62314b538e8f23b345e8b9
7
+ data.tar.gz: 327d3b5eea5608aeb07fbb0ea1f1e7796296c7748abe1cb72ae799e68a585ca2612cd44d7a8f3386bc1f08c21facb6d6f1cfcd119ae8b27366e175689a649117
@@ -12,7 +12,7 @@ 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)
15
+ next unless Attachment::ALLOWED_FILE_CONTENT_TYPE.include? uploaded_io.content_type
16
16
 
17
17
  file_name = "#{Time.now.to_i}_#{uploaded_io.original_filename}"
18
18
  File.open(File.join(upload_path, file_name), 'wb') do |file|
@@ -14,9 +14,9 @@ module MyForum
14
14
  process_attachments(post)
15
15
  end
16
16
 
17
- last_page = @topic.posts.count / Post::PER_PAGE
17
+ last_page = (@topic.posts.count.to_f / Post::PER_PAGE).ceil
18
18
  last_page = 1 if last_page == 0
19
- redirect_to forum_topic_path(@forum, @topic, page: last_page)
19
+ redirect_to forum_topic_path(@forum, @topic, page: last_page, go_to_last_post: true)
20
20
  end
21
21
 
22
22
  def destroy
@@ -12,7 +12,7 @@ module MyForum
12
12
  def show
13
13
  @topic = Topic.find(params[:id])
14
14
  check_access_permissions(@topic)
15
- @topic_posts = @topic.posts.paginate(per_page: 16, page: params[:page])
15
+ @topic_posts = @topic.posts.paginate(per_page: Post::PER_PAGE, page: params[:page])
16
16
  @new_post = Post.new #TODO if quick_answer_enabled
17
17
 
18
18
  @topic.mark_as_read(current_user, @topic_posts.last)
@@ -112,7 +112,7 @@ module MyForum
112
112
  end
113
113
 
114
114
  def upload_avatar(avatar_param)
115
- return false unless Avatar::ALLOWED_FILE_EXTENSIONS.include? File.extname(avatar_param.original_filename)
115
+ return false unless Avatar::ALLOWED_FILE_CONTENT_TYPE.include? avatar_param.content_type
116
116
 
117
117
  current_avatar = current_user.avatar
118
118
  upload_path = File.join(Avatar::UPLOAD_PATH, current_user.id.to_s)
@@ -13,7 +13,8 @@ module MyForum
13
13
  text.gsub!(/\[\/img\]/i, '" />')
14
14
 
15
15
  # Youtube
16
- text.gsub!(/(http|www)(.*youtu*.+\/)(watch\?(.+)?v=|embed\/watch\?|\/)(?<video_code>[a-z1-9]+)[?!\s]/i) do |match|
16
+ #[?!\s]
17
+ text.gsub!(/(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?(?<video_code>[\w-]{10,})/i) do |match|
17
18
  "<iframe width='560' height='315' src='https://www.youtube.com/embed/#{$~[:video_code]}' frameborder='0' allowfullscreen></iframe>"
18
19
  end
19
20
 
@@ -6,6 +6,7 @@ module MyForum
6
6
  UPLOAD_PATH = File.join(Rails.public_path, 'uploads', 'attachments')
7
7
  URL = File.join('/uploads', 'attachments')
8
8
 
9
- ALLOWED_FILE_EXTENSIONS = %w(.jpg .jpeg .png .gif)
9
+ ALLOWED_FILE_EXTENSIONS = %w(.jpg .jpeg .png .gif)
10
+ ALLOWED_FILE_CONTENT_TYPE = %w(image/jpeg image/png image/gif)
10
11
  end
11
12
  end
@@ -5,6 +5,7 @@ module MyForum
5
5
  UPLOAD_PATH = File.join(Rails.public_path, 'uploads', 'avatars')
6
6
  URL = File.join('/uploads', 'avatars')
7
7
 
8
- ALLOWED_FILE_EXTENSIONS = %w(.jpg .jpeg .png .gif)
8
+ ALLOWED_FILE_EXTENSIONS = %w(.jpg .jpeg .png .gif)
9
+ ALLOWED_FILE_CONTENT_TYPE = %w(image/jpeg image/png image/gif)
9
10
  end
10
11
  end
@@ -7,4 +7,4 @@
7
7
  = reply_pm_button(@pm)
8
8
 
9
9
  %h3= @pm.subject
10
- = format_bbcode @pm.body
10
+ = sanitize format_bbcode @pm.body
@@ -1,22 +1,22 @@
1
1
  .profile-popover
2
2
  .row
3
- .col-sm-5
4
- = t('my_forum.profile_popover.posts_count')
5
- .col-sm-4
6
- = user.posts_count
3
+ .col-sm-5= t('my_forum.profile_popover.posts_count')
4
+ .col-sm-4= user.posts_count
7
5
 
8
6
  .row
9
- .col-sm-5
10
- = t('my_forum.profile_popover.registered_at')
11
- .col-sm-4
12
- = time(user.created_at)
7
+ .col-sm-5= t('my_forum.profile_popover.registered_at')
8
+ .col-sm-4= time(user.created_at)
13
9
 
14
10
  .row
15
- .col-sm-5
16
- = t('my_forum.profile_popover.status')
11
+ .col-sm-5= t('my_forum.profile_popover.status')
17
12
  .col-sm-4
18
- = is_online_user?(user.login) ? t('my_forum.profile_popover.online') : t('my_forum.profile_popover.offline')
13
+ - is_online = is_online_user?(user.login)
14
+ = is_online ? t('my_forum.profile_popover.online') : t('my_forum.profile_popover.offline')
15
+
16
+ - unless
17
+ .row
18
+ .col-sm-5= t('my_forum.profile_popover.last_online')
19
+ .col-sm-4= time(user.updated_at)
19
20
 
20
21
  .row.pm
21
- .col-sm-12
22
- = link_to t('my_forum.profile_popover.write_pm'), new_private_message_path(to: user.login), class: 'btn btn-xs btn-warning'
22
+ .col-sm-12= link_to t('my_forum.profile_popover.write_pm'), new_private_message_path(to: user.login), class: 'btn btn-xs btn-warning'
@@ -13,7 +13,7 @@
13
13
  .box
14
14
  = render partial: 'post', collection: @topic_posts
15
15
 
16
- .row
16
+ .row{ id: 'pagination' }
17
17
  = will_paginate @topic_posts
18
18
 
19
19
  - if is_admin?
@@ -56,9 +56,4 @@
56
56
  setTimeout (-> $(_this).popover("hide") if !$(".popover:hover").length ), 300
57
57
  )
58
58
 
59
-
60
- container = $('body')
61
- scroll_to = $('post_number_' + "#{params[:show_post]}")
62
- scroll_to = 'post_number_' + "#{params[:show_post]}"
63
-
64
- $('body').scrollTo(scroll_to)
59
+ $('body').scrollTo('#pagination')
@@ -10,6 +10,7 @@ ru:
10
10
  status: 'Текущий статус:'
11
11
  online: 'на форуме'
12
12
  offline: 'не на форуме'
13
+ last_online: 'Был на форуме'
13
14
  write_pm: 'Написать ЛС'
14
15
 
15
16
  today: "Сегодня в %{hhmm}"
@@ -6,8 +6,8 @@ module MyForum
6
6
  require 'bootstrap-sass'
7
7
 
8
8
  config.after_initialize do
9
- ActionView::Base.sanitized_allowed_tags = %w(strong em a img br p i pre div span)
10
- ActionView::Base.sanitized_allowed_attributes = %w(href title class src)
9
+ ActionView::Base.sanitized_allowed_tags = %w(strong em a img br p i pre div span iframe)
10
+ ActionView::Base.sanitized_allowed_attributes = %w(href title class src width height)
11
11
  end
12
12
 
13
13
  config.generators do |g|
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta32"
2
+ VERSION = "0.0.1.beta33"
3
3
  end
@@ -11,12 +11,12 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20151012095554) do
14
+ ActiveRecord::Schema.define(version: 20151221205045) do
15
15
 
16
16
  create_table "my_forum_categories", force: :cascade do |t|
17
17
  t.string "name"
18
- t.datetime "created_at"
19
- t.datetime "updated_at"
18
+ t.datetime "created_at", null: false
19
+ t.datetime "updated_at", null: false
20
20
  end
21
21
 
22
22
  create_table "my_forum_category_permissions", force: :cascade do |t|
@@ -26,14 +26,22 @@ ActiveRecord::Schema.define(version: 20151012095554) do
26
26
  t.datetime "updated_at", null: false
27
27
  end
28
28
 
29
+ create_table "my_forum_emoticons", force: :cascade do |t|
30
+ t.string "file_name"
31
+ t.string "code"
32
+ t.boolean "is_active", default: true
33
+ t.datetime "created_at", null: false
34
+ t.datetime "updated_at", null: false
35
+ end
36
+
29
37
  create_table "my_forum_forums", force: :cascade do |t|
30
38
  t.integer "category_id"
31
39
  t.string "name"
32
40
  t.string "description"
33
41
  t.integer "topics_count"
34
42
  t.integer "posts_count"
35
- t.datetime "created_at"
36
- t.datetime "updated_at"
43
+ t.datetime "created_at", null: false
44
+ t.datetime "updated_at", null: false
37
45
  end
38
46
 
39
47
  create_table "my_forum_images", force: :cascade do |t|
@@ -50,22 +58,25 @@ ActiveRecord::Schema.define(version: 20151012095554) do
50
58
  t.integer "user_id"
51
59
  t.integer "topic_id"
52
60
  t.integer "post_id"
53
- t.datetime "created_at"
54
- t.datetime "updated_at"
61
+ t.datetime "created_at", null: false
62
+ t.datetime "updated_at", null: false
55
63
  end
56
64
 
57
65
  create_table "my_forum_posts", force: :cascade do |t|
58
66
  t.integer "user_id"
59
67
  t.integer "topic_id"
60
68
  t.integer "forum_id"
61
- t.text "text"
62
- t.datetime "created_at"
63
- t.datetime "updated_at"
69
+ t.text "text", limit: 4294967295
70
+ t.datetime "created_at", null: false
71
+ t.datetime "updated_at", null: false
72
+ t.boolean "is_deleted", default: false
64
73
  end
65
74
 
66
75
  create_table "my_forum_private_messages", force: :cascade do |t|
67
76
  t.integer "sender_id"
77
+ t.string "sender_login"
68
78
  t.integer "recipient_id"
79
+ t.string "recipient_login"
69
80
  t.boolean "sender_deleted", default: false
70
81
  t.boolean "recipient_deleted", default: false
71
82
  t.boolean "unread", default: true
@@ -79,8 +90,8 @@ ActiveRecord::Schema.define(version: 20151012095554) do
79
90
  t.string "name"
80
91
  t.string "color"
81
92
  t.text "rights"
82
- t.datetime "created_at"
83
- t.datetime "updated_at"
93
+ t.datetime "created_at", null: false
94
+ t.datetime "updated_at", null: false
84
95
  end
85
96
 
86
97
  create_table "my_forum_topics", force: :cascade do |t|
@@ -94,44 +105,54 @@ ActiveRecord::Schema.define(version: 20151012095554) do
94
105
  t.boolean "pinned", default: false
95
106
  t.boolean "closed", default: false
96
107
  t.boolean "deleted", default: false
97
- t.datetime "created_at"
98
- t.datetime "updated_at"
108
+ t.datetime "created_at", null: false
109
+ t.datetime "updated_at", null: false
110
+ t.boolean "is_deleted", default: false
99
111
  end
100
112
 
101
113
  create_table "my_forum_user_group_links", force: :cascade do |t|
102
114
  t.integer "user_id"
103
115
  t.integer "user_group_id"
104
- t.datetime "created_at"
105
- t.datetime "updated_at"
116
+ t.datetime "created_at", null: false
117
+ t.datetime "updated_at", null: false
106
118
  end
107
119
 
108
120
  create_table "my_forum_user_groups", force: :cascade do |t|
109
121
  t.string "name"
110
122
  t.string "html_color"
111
123
  t.boolean "default", default: false
112
- t.datetime "created_at"
113
- t.datetime "updated_at"
124
+ t.datetime "created_at", null: false
125
+ t.datetime "updated_at", null: false
114
126
  end
115
127
 
116
128
  create_table "my_forum_user_roles", force: :cascade do |t|
117
129
  t.integer "user_id"
118
130
  t.integer "role_id"
119
- t.datetime "created_at"
120
- t.datetime "updated_at"
131
+ t.datetime "created_at", null: false
132
+ t.datetime "updated_at", null: false
121
133
  end
122
134
 
123
135
  create_table "my_forum_users", force: :cascade do |t|
124
136
  t.string "login"
125
137
  t.string "password"
126
138
  t.string "salt"
139
+ t.string "real_name"
140
+ t.integer "gender"
141
+ t.date "birthdate"
142
+ t.text "signature"
143
+ t.text "avatar_url"
144
+ t.string "location"
145
+ t.string "user_ip"
146
+ t.text "additional_info"
127
147
  t.string "email"
128
148
  t.integer "posts_count"
149
+ t.boolean "activated", default: false
129
150
  t.boolean "is_admin", default: false
130
151
  t.boolean "is_moderator", default: false
131
152
  t.boolean "is_deleted", default: false
132
153
  t.boolean "permanently_banned", default: false
133
- t.datetime "created_at"
134
- t.datetime "updated_at"
154
+ t.datetime "created_at", null: false
155
+ t.datetime "updated_at", null: false
135
156
  t.datetime "last_logged_in"
136
157
  end
137
158
 
Binary file