thredded 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.mkdn +1 -0
- data/app/controllers/thredded/private_topics_controller.rb +4 -5
- data/app/decorators/thredded/topic_decorator.rb +9 -3
- data/app/decorators/thredded/user_topic_decorator.rb +3 -2
- data/app/models/thredded/post.rb +2 -2
- data/app/views/thredded/private_topics/index.html.erb +5 -7
- data/lib/thredded.rb +10 -1
- data/lib/thredded/at_users.rb +3 -1
- data/lib/thredded/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a5e4586746eb175f9abdee9164cba73afdbf5d2
|
4
|
+
data.tar.gz: 49ff149e997cc823e4ebdf231f7b710e3c4b4f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 672530495e5d3ed43d6cb93283e56e4a6fa2a6be6ba2cefc593cc49b79c3073e246f1a4c2516a179d10e1f6a808d31886dd3fa3a740a64a26d6795d8fac20b71
|
7
|
+
data.tar.gz: 9fe0b3d1e977e15e4e984abb7e2c20c1d637c78566360041891a7b1c7e6e2f164a593853155015e6f0baab388bc24ec3f7d240158a5b28bf40517b296a092b6c
|
data/README.mkdn
CHANGED
@@ -15,6 +15,7 @@ Thredded.user_class = 'User'
|
|
15
15
|
Thredded.email_incoming_host = 'incoming.example.com'
|
16
16
|
Thredded.email_from = 'no-reply@example.com'
|
17
17
|
Thredded.email_outgoing_prefix = '[Thredded] '
|
18
|
+
Thredded.user_path = ->(user){ "/path/to/where/you/show/#{user}" }
|
18
19
|
```
|
19
20
|
|
20
21
|
Copy the migrations over to your parent application and migrate:
|
@@ -7,15 +7,13 @@ module Thredded
|
|
7
7
|
error = 'You are not authorized access to this messageboard.'
|
8
8
|
redirect_to default_home, flash: { error: error }
|
9
9
|
else
|
10
|
-
@private_topics =
|
10
|
+
@private_topics = private_topics
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
def new
|
15
15
|
@private_topic = messageboard.private_topics.build
|
16
|
-
@private_topic.posts.build(
|
17
|
-
filter: current_user.try(:post_filter)
|
18
|
-
)
|
16
|
+
@private_topic.posts.build(filter: current_user.try(:post_filter))
|
19
17
|
|
20
18
|
unless can? :create, @private_topic
|
21
19
|
error = 'Sorry, you are not authorized to post on this messageboard.'
|
@@ -31,11 +29,12 @@ module Thredded
|
|
31
29
|
redirect_to messageboard_topics_url(messageboard)
|
32
30
|
end
|
33
31
|
|
34
|
-
def
|
32
|
+
def private_topics
|
35
33
|
PrivateTopic
|
36
34
|
.for_messageboard(messageboard)
|
37
35
|
.including_roles_for(current_user)
|
38
36
|
.for_user(current_user)
|
37
|
+
.order_by_stuck_and_updated_time
|
39
38
|
.on_page(params[:page])
|
40
39
|
end
|
41
40
|
end
|
@@ -10,6 +10,10 @@ module Thredded
|
|
10
10
|
@topic = topic
|
11
11
|
end
|
12
12
|
|
13
|
+
def slug
|
14
|
+
topic.slug.nil? ? topic.id : topic.slug
|
15
|
+
end
|
16
|
+
|
13
17
|
def css_class
|
14
18
|
classes = []
|
15
19
|
classes << 'locked' if locked?
|
@@ -20,10 +24,12 @@ module Thredded
|
|
20
24
|
end
|
21
25
|
|
22
26
|
def last_user_link
|
23
|
-
if last_user.
|
24
|
-
|
27
|
+
if last_user && last_user.valid?
|
28
|
+
last_user_path = Thredded.user_path(last_user)
|
29
|
+
|
30
|
+
"<a href='#{last_user_path}'>#{last_user}</a>".html_safe
|
25
31
|
else
|
26
|
-
|
32
|
+
'Anonymous'
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
@@ -55,8 +55,9 @@ module Thredded
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def user_link
|
58
|
-
if user.valid?
|
59
|
-
|
58
|
+
if topic.user && topic.user.valid?
|
59
|
+
user_path = Thredded.user_path(topic.user)
|
60
|
+
"<a href='#{user_path}'>#{topic.user}</a>".html_safe
|
60
61
|
else
|
61
62
|
'<a href="#">?</a>'.html_safe
|
62
63
|
end
|
data/app/models/thredded/post.rb
CHANGED
@@ -52,7 +52,7 @@ module Thredded
|
|
52
52
|
private
|
53
53
|
|
54
54
|
def modify_parent_posts_counts
|
55
|
-
UserDetail.increment_counter(:posts_count, user_id)
|
55
|
+
Thredded::UserDetail.increment_counter(:posts_count, user_id)
|
56
56
|
topic.last_user = user
|
57
57
|
topic.touch
|
58
58
|
topic.save
|
@@ -65,7 +65,7 @@ module Thredded
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def notify_at_users
|
68
|
-
AtNotifier.new(self).notifications_for_at_users
|
68
|
+
Thredded::AtNotifier.new(self).notifications_for_at_users
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -15,13 +15,11 @@
|
|
15
15
|
</header>
|
16
16
|
|
17
17
|
<section class="topics" id="topics_listing">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
</div>
|
24
|
-
<% end %>
|
18
|
+
<div class="currently">
|
19
|
+
<%= render partial: 'thredded/topics/topic_condensed',
|
20
|
+
collection: Thredded::UserTopicDecorator.decorate_all(current_user, @private_topics),
|
21
|
+
as: :topic %>
|
22
|
+
</div>
|
25
23
|
</section>
|
26
24
|
|
27
25
|
<footer>
|
data/lib/thredded.rb
CHANGED
@@ -23,7 +23,8 @@ module Thredded
|
|
23
23
|
mattr_accessor :user_class,
|
24
24
|
:email_incoming_host,
|
25
25
|
:email_from,
|
26
|
-
:email_outgoing_prefix
|
26
|
+
:email_outgoing_prefix,
|
27
|
+
:user_path
|
27
28
|
|
28
29
|
def self.user_class
|
29
30
|
if @@user_class.is_a?(Class)
|
@@ -38,4 +39,12 @@ module Thredded
|
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
42
|
+
|
43
|
+
def self.user_path(user)
|
44
|
+
if @@user_path.respond_to? :call
|
45
|
+
@@user_path.call(user)
|
46
|
+
else
|
47
|
+
'/'
|
48
|
+
end
|
49
|
+
end
|
41
50
|
end
|
data/lib/thredded/at_users.rb
CHANGED
@@ -7,8 +7,10 @@ module Thredded
|
|
7
7
|
members = messageboard.members_from_list(at_names)
|
8
8
|
|
9
9
|
members.each do |member|
|
10
|
+
member_path = Thredded.user_path(member)
|
11
|
+
|
10
12
|
content.gsub!(/@#{member.to_s}/i,
|
11
|
-
%Q{<a href="
|
13
|
+
%Q{<a href="#{member_path}">@#{member}</a>})
|
12
14
|
end
|
13
15
|
|
14
16
|
content
|
data/lib/thredded/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thredded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: RedCloth
|