my_forum 0.0.1.beta43 → 0.0.1.beta44
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 +4 -4
- data/README.rdoc +1 -34
- data/app/controllers/my_forum/topics_controller.rb +20 -1
- data/app/controllers/my_forum/users_controller.rb +1 -3
- data/app/helpers/my_forum/application_helper.rb +1 -2
- data/app/helpers/my_forum/posts_helper.rb +2 -1
- data/app/views/my_forum/topics/show.haml +4 -3
- data/app/views/my_forum/users/edit.haml +2 -6
- data/config/locales/ru.yml +0 -4
- data/db/migrate/20160122202142_add_latest_post_info_for_topic.rb +8 -0
- data/lib/my_forum/version.rb +1 -1
- data/spec/dummy/log/development.log +12 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e6b7c0c57f0a4a8bbdcbfd68a8d4897d4d756c
|
4
|
+
data.tar.gz: dc665408beac7afd641d6924108c2fd0df5d3e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3a7b6210f0c307546d2cbc5892a35cdb32de3bc0df9eccd3745a585a9f403b01375a0664f7ce809770ccf9acb191961a0b23037174588d8b6ca1df313f792ab
|
7
|
+
data.tar.gz: 1cfbd5122f63ed7eb6208a09bc733002ea2aa34eeba7b598415af3ae7be94bdc3ca5236a5699730d0e31c926b2cf83ac992298e5d3c93a302d2f25102762f4f3
|
data/README.rdoc
CHANGED
@@ -7,41 +7,8 @@ This project rocks and uses MIT-LICENSE.
|
|
7
7
|
INSTALLATION
|
8
8
|
rake my_forum:install:migrations
|
9
9
|
|
10
|
-
|
11
|
-
FAQ
|
12
|
-
Q: how to customize urls
|
13
|
-
A:
|
14
|
-
|
15
|
-
Create, for exmaple, my_forum.rb file in your initialize app folder (your_app/config/initializer/my_forum.rb) and rewrite
|
16
|
-
methids like this -
|
17
|
-
|
18
|
-
MyForum::Forum.class_eval do
|
19
|
-
def to_param
|
20
|
-
"#{id}-something"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
10
|
For using existing User model, use somethink like this:
|
32
11
|
|
33
12
|
Create config/initializers/my_forum.rb with next content:
|
34
13
|
MyForum::Engine.use_custom_user_model = true
|
35
|
-
...
|
36
|
-
|
37
|
-
http://w3facility.org/question/ruby-regex-for-stripping-bbcode/
|
38
|
-
|
39
|
-
gem build my_forum.gemspec
|
40
|
-
|
41
|
-
https://github.com/cpjolicoeur/bb-ruby
|
42
|
-
http://fortawesome.github.io/Font-Awesome/icons/#text-editor
|
43
|
-
|
44
|
-
|
45
|
-
Used plugins:
|
46
|
-
|
47
|
-
http://madapaja.github.io/jquery.selection/
|
14
|
+
...
|
@@ -12,7 +12,10 @@ module MyForum
|
|
12
12
|
def show
|
13
13
|
@topic = Topic.find(params[:id])
|
14
14
|
check_access_permissions(@topic)
|
15
|
-
|
15
|
+
|
16
|
+
user_last_page = get_last_readed_user_page
|
17
|
+
|
18
|
+
@topic_posts = @topic.posts.paginate(per_page: Post::PER_PAGE, page: (params[:page] || user_last_page))
|
16
19
|
@new_post = Post.new #TODO if quick_answer_enabled
|
17
20
|
|
18
21
|
@topic.mark_as_read(current_user, @topic_posts.last)
|
@@ -57,6 +60,22 @@ module MyForum
|
|
57
60
|
|
58
61
|
private
|
59
62
|
|
63
|
+
# TODO development in progress
|
64
|
+
def get_last_readed_user_page
|
65
|
+
return nil unless params[:page].blank? or current_user
|
66
|
+
return nil if
|
67
|
+
user_last_page = nil
|
68
|
+
|
69
|
+
latest_readed_post = LogReadMark.where(user_id: current_user.id, topic_id: @topic.id).first
|
70
|
+
return nil unless latest_readed_post
|
71
|
+
|
72
|
+
page_groups = @topic.posts.pluck(:id).in_groups_of(Post::PER_PAGE)
|
73
|
+
page_groups.each_with_index { |group, page| user_last_page = page and break if group.include?(latest_readed_post.post_id) }
|
74
|
+
user_last_page +=1 if user_last_page
|
75
|
+
|
76
|
+
user_last_page
|
77
|
+
end
|
78
|
+
|
60
79
|
def check_is_admin
|
61
80
|
return unless current_user
|
62
81
|
return unless current_user.is_admin?
|
@@ -21,8 +21,6 @@ module MyForum
|
|
21
21
|
current_user.update(attr => params[:user][attr]) if params[:user][attr]
|
22
22
|
end
|
23
23
|
|
24
|
-
flash[:notice] = t('.successfully_updated')
|
25
|
-
|
26
24
|
redirect_to edit_user_path(current_user)
|
27
25
|
end
|
28
26
|
|
@@ -32,7 +30,7 @@ module MyForum
|
|
32
30
|
@user.user_groups << UserGroup::MEMBER_GROUP
|
33
31
|
@user.save
|
34
32
|
session[:user_id] = @user.id
|
35
|
-
redirect_to
|
33
|
+
redirect_to root_path
|
36
34
|
else
|
37
35
|
render :new
|
38
36
|
end
|
@@ -57,7 +57,8 @@ module MyForum
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# Link
|
60
|
-
text.gsub!(/\[url=(.*?)\](.*?)\[\/url\]/i)
|
60
|
+
text.gsub!(/\[url=(.*?)\](.*?)\[\/url\]/i) { "<a href='#{$1}'>#{$2}</a>" }
|
61
|
+
text.gsub!(/(http:\/\/[\S]+|www:\/\/[\S]+)/) { "<a target=\"_blank\" href=#{$1}>#{$1}</a>"}
|
61
62
|
|
62
63
|
text.html_safe
|
63
64
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
.row
|
4
4
|
.col-md-4
|
5
|
+
|
5
6
|
= errors_for(current_user)
|
6
7
|
|
7
8
|
= form_for current_user, url: user_path(current_user), role: 'form' do |form|
|
@@ -32,9 +33,4 @@
|
|
32
33
|
- additional_info_attrs.each do |attr|
|
33
34
|
.form-group= form.text_field attr, value: current_user.send(attr), class: 'name form-control', placeholder: t("my_forum.additional_info.#{attr.to_s}")
|
34
35
|
|
35
|
-
= form.submit t('.update'), class: 'btn btn-primary btn-sm'
|
36
|
-
|
37
|
-
%br
|
38
|
-
.row
|
39
|
-
.col-md-12.text-center
|
40
|
-
=link_to t('.back_to_the_forum'), root_path, class: 'btn btn-sm btn-success'
|
36
|
+
= form.submit t('.update'), class: 'btn btn-primary btn-sm'
|
data/config/locales/ru.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
ru:
|
2
2
|
today: "Сегодня"
|
3
3
|
my_forum:
|
4
|
-
no_online_users: 'никого нет :('
|
5
4
|
pm:
|
6
5
|
sent: 'Сообщение отправленно'
|
7
6
|
mailer:
|
@@ -143,9 +142,6 @@ ru:
|
|
143
142
|
update: 'Обновить'
|
144
143
|
update_avatar: 'Обновить аватар'
|
145
144
|
edit_additional_info: 'Дополнительная информация'
|
146
|
-
back_to_the_forum: 'Вернуться на форум'
|
147
|
-
update:
|
148
|
-
successfully_updated: 'Данные обновлены'
|
149
145
|
|
150
146
|
|
151
147
|
private_messages:
|
data/lib/my_forum/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
[1m[36mMyForum::User Load (0.1ms)[0m [1mSELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1[0m
|
2
|
+
SQLite3::SQLException: no such table: my_forum_users: SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
|
3
|
+
[1m[36mMyForum::User Load (0.1ms)[0m [1mSELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1[0m
|
4
|
+
SQLite3::SQLException: no such table: my_forum_users: SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
|
5
|
+
[1m[36mMyForum::User Load (0.1ms)[0m [1mSELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1[0m
|
6
|
+
SQLite3::SQLException: no such table: my_forum_users: SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
|
7
|
+
[1m[36m (1.7ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
8
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
9
|
+
[1m[36m (1.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
10
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
11
|
+
[1m[36mMyForum::User Load (0.1ms)[0m [1mSELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1[0m
|
12
|
+
SQLite3::SQLException: no such table: my_forum_users: SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_forum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitaly Omelchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -283,6 +283,7 @@ files:
|
|
283
283
|
- db/migrate/20151220121140_create_my_forum_emoticons.rb
|
284
284
|
- db/migrate/20151221203243_my_forum_rename_user_avatar.rb
|
285
285
|
- db/migrate/20151221205045_my_forum_change_user_avatar.rb
|
286
|
+
- db/migrate/20160122202142_add_latest_post_info_for_topic.rb
|
286
287
|
- lib/my_forum.rb
|
287
288
|
- lib/my_forum/engine.rb
|
288
289
|
- lib/my_forum/version.rb
|
@@ -323,6 +324,7 @@ files:
|
|
323
324
|
- spec/dummy/db/development.sqlite3
|
324
325
|
- spec/dummy/db/schema.rb
|
325
326
|
- spec/dummy/db/test.sqlite3
|
327
|
+
- spec/dummy/log/development.log
|
326
328
|
- spec/dummy/public/404.html
|
327
329
|
- spec/dummy/public/422.html
|
328
330
|
- spec/dummy/public/500.html
|
@@ -393,6 +395,7 @@ test_files:
|
|
393
395
|
- spec/dummy/db/development.sqlite3
|
394
396
|
- spec/dummy/db/schema.rb
|
395
397
|
- spec/dummy/db/test.sqlite3
|
398
|
+
- spec/dummy/log/development.log
|
396
399
|
- spec/dummy/public/404.html
|
397
400
|
- spec/dummy/public/422.html
|
398
401
|
- spec/dummy/public/500.html
|