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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a68e85a7ae96d4689ef3ab6c56affe335882cf0f
4
- data.tar.gz: 47792dcbde12d63235c02a4257931777742e1823
3
+ metadata.gz: 2a5e4586746eb175f9abdee9164cba73afdbf5d2
4
+ data.tar.gz: 49ff149e997cc823e4ebdf231f7b710e3c4b4f7c
5
5
  SHA512:
6
- metadata.gz: 34c5c730348e014f85376364231c51c6941fed5e4b0c51bf041c0bb4340427a3fdc54dd4a693aca8a7f3f5e632df13e19b15c1fc2430bd343a323e73bf5aa132
7
- data.tar.gz: bc03a54520ce87f0454888ec6e61511d99cffcbca412f77392a60b103879b2b040153496956496785793c26bfa2dcb54f1ebc58a30a38f1c6b5bdd4977e1961f
6
+ metadata.gz: 672530495e5d3ed43d6cb93283e56e4a6fa2a6be6ba2cefc593cc49b79c3073e246f1a4c2516a179d10e1f6a808d31886dd3fa3a740a64a26d6795d8fac20b71
7
+ data.tar.gz: 9fe0b3d1e977e15e4e984abb7e2c20c1d637c78566360041891a7b1c7e6e2f164a593853155015e6f0baab388bc24ec3f7d240158a5b28bf40517b296a092b6c
@@ -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 = get_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 get_private_topics
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.nil?
24
- 'Anonymous'
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
- "<a href='/users/#{last_user}'>#{last_user}</a>".html_safe
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
- "<a href='/users/#{topic.user_name}'>#{topic.user_name}</a>".html_safe
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
@@ -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
- <% if @private_topics.any? %>
19
- <div class="currently">
20
- <%= render partial: 'thredded/topics/topic_condensed',
21
- collection: Thredded::UserTopicDecorator.decorate_all(current_user, @private_topics),
22
- as: :topic %>
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>
@@ -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
@@ -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="/users/#{member.to_s}">@#{member.to_s}</a>})
13
+ %Q{<a href="#{member_path}">@#{member}</a>})
12
14
  end
13
15
 
14
16
  content
@@ -1,3 +1,3 @@
1
1
  module Thredded
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
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.3
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-20 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: RedCloth