my_forum 0.0.1.beta43 → 0.0.1.beta44

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: 898dfc20ccc1570159c8b166757647cd1561ac69
4
- data.tar.gz: 3d36e03985b31c140e2c2d32eb92557cd3df6026
3
+ metadata.gz: b9e6b7c0c57f0a4a8bbdcbfd68a8d4897d4d756c
4
+ data.tar.gz: dc665408beac7afd641d6924108c2fd0df5d3e62
5
5
  SHA512:
6
- metadata.gz: 7e251953aa891fef3009d0a77de913a8958962db75616b89a04a780b02373e0cea92a77664b34d2edc464f3ba762da3d5390e548dd6374f16f843ac9c88685ad
7
- data.tar.gz: 286758629f312cb16c798682f04cc5dbaf6b87a168cdd8c93bd19135af5b1851cfa9c3c40dff348280c50870beeb4a1b6e7265d7b97fe675ac8ab3b436cf991c
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
- @topic_posts = @topic.posts.paginate(per_page: Post::PER_PAGE, page: params[:page])
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 edit_user_path(@user)
33
+ redirect_to root_path
36
34
  else
37
35
  render :new
38
36
  end
@@ -22,8 +22,7 @@ module MyForum
22
22
  end
23
23
 
24
24
  def online_users
25
- users_list = User.online.pluck(:login).join(', ')
26
- users_list.blank? ? I18n.t('my_forum.no_online_users') : users_list
25
+ User.online.pluck(:login).join(', ')
27
26
  end
28
27
 
29
28
  def today_was_users
@@ -57,7 +57,8 @@ module MyForum
57
57
  end
58
58
 
59
59
  # Link
60
- text.gsub!(/\[url=(.*?)\](.*?)\[\/url\]/i) { "<a href='#{$1}'>#{$2}</a>" }
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
@@ -1,8 +1,9 @@
1
1
  .container-fluid
2
2
  .row
3
- .col-md-12
4
- #topic_header
5
- = render 'topic_header', topic: @topic
3
+ #topic_header.col-md-9
4
+ = render 'topic_header', topic: @topic
5
+ .col-md-3
6
+ = will_paginate @topic_posts
6
7
  .row
7
8
  .col-md-12
8
9
  #posts
@@ -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'
@@ -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:
@@ -0,0 +1,8 @@
1
+ class AddLatestPostInfoForTopic < ActiveRecord::Migration
2
+ def change
3
+ add_column :my_forum_topics, :latest_post_created_at, :datetime
4
+ add_column :my_forum_topics, :latest_post_login, :string
5
+
6
+
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta43"
2
+ VERSION = "0.0.1.beta44"
3
3
  end
@@ -0,0 +1,12 @@
1
+ MyForum::User Load (0.1ms) SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
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
+ MyForum::User Load (0.1ms) SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
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
+ MyForum::User Load (0.1ms) SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
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
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
8
+  (0.1ms) select sqlite_version(*)
9
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
10
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
+ MyForum::User Load (0.1ms) SELECT "my_forum_users".* FROM "my_forum_users" ORDER BY "my_forum_users"."id" DESC LIMIT 1
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.beta43
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-01-12 00:00:00.000000000 Z
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