rostra 0.1.19 → 0.1.20
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.
- data/app/assets/stylesheets/rostra/application.css +1 -0
- data/app/mailers/rostra/application_mailer.rb +3 -1
- data/app/models/comment.rb +3 -0
- data/app/models/rostra/answer.rb +1 -0
- data/app/models/rostra/question.rb +7 -3
- data/app/views/rostra/application_mailer/notification.html.erb +5 -0
- data/app/views/rostra/application_mailer/notification.text.erb +3 -0
- data/app/views/rostra/questions/index.html.erb +1 -1
- data/lib/rostra/email_notifier.rb +1 -1
- data/lib/rostra/engine.rb +1 -0
- data/lib/rostra/timestamp_observer.rb +15 -0
- data/lib/rostra/version.rb +1 -1
- metadata +3 -2
@@ -1,10 +1,12 @@
|
|
1
1
|
module Rostra
|
2
2
|
class ApplicationMailer < ActionMailer::Base
|
3
|
+
helper 'rostra/base/application'
|
3
4
|
layout Rostra::Config.email_layout
|
4
5
|
|
5
|
-
def notification(user, question)
|
6
|
+
def notification(user, added_content, question)
|
6
7
|
@user = user
|
7
8
|
@question = question
|
9
|
+
@added_content = added_content
|
8
10
|
mail(
|
9
11
|
:to => user.rostra_user_email,
|
10
12
|
:subject => "There's been activity on: #{question.title}",
|
data/app/models/comment.rb
CHANGED
@@ -2,6 +2,7 @@ class Comment < ActiveRecord::Base
|
|
2
2
|
|
3
3
|
include ActsAsCommentable::Comment
|
4
4
|
include Rostra::EmailNotifier
|
5
|
+
include Rostra::TimestampObserver
|
5
6
|
|
6
7
|
belongs_to :commentable, :polymorphic => true
|
7
8
|
belongs_to :user
|
@@ -15,4 +16,6 @@ class Comment < ActiveRecord::Base
|
|
15
16
|
commentable.question if commentable.is_a?(Rostra::Answer)
|
16
17
|
end
|
17
18
|
|
19
|
+
alias_attribute :text, :comment
|
20
|
+
|
18
21
|
end
|
data/app/models/rostra/answer.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module Rostra
|
2
2
|
class Question < ActiveRecord::Base
|
3
|
+
include Rostra::TimestampObserver
|
4
|
+
extend FriendlyId
|
5
|
+
|
3
6
|
belongs_to :user
|
4
7
|
has_many :answers, :dependent => :destroy
|
5
8
|
has_many :question_followings, :dependent => :destroy
|
@@ -10,7 +13,6 @@ module Rostra
|
|
10
13
|
acts_as_taggable
|
11
14
|
acts_as_voteable
|
12
15
|
is_impressionable counter_cache: { unique: true }
|
13
|
-
extend FriendlyId
|
14
16
|
friendly_id :title, use: :slugged
|
15
17
|
|
16
18
|
validates :title, presence: true, uniqueness: true, length: { :minimum => 15 }
|
@@ -33,8 +35,10 @@ module Rostra
|
|
33
35
|
@answer_count = answers.count
|
34
36
|
end
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
+
# The last time the question has had any activity (i.e. commment, answer, etc).
|
39
|
+
#
|
40
|
+
def active_at
|
41
|
+
updated_at || created_at
|
38
42
|
end
|
39
43
|
|
40
44
|
private
|
@@ -1,3 +1,8 @@
|
|
1
1
|
<h3>Hi <%= @user.rostra_user_name %>,</h3>
|
2
2
|
|
3
3
|
<p>Just letting you know there's been recent activity on <%= link_to @question.title, question_url(@question) %></p>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<strong><%= link_to_profile(@added_content.user) %> says:</strong><br />
|
7
|
+
<%= strip_tags(truncate(@added_content.text, length: 500)) %>
|
8
|
+
</p>
|
@@ -39,7 +39,7 @@
|
|
39
39
|
<%= strip_tags(question.details) %>
|
40
40
|
<% end %>
|
41
41
|
</div>
|
42
|
-
<div class="timestamp"
|
42
|
+
<div class="timestamp">active <%= time_ago_in_words(question.active_at) %> ago</div>
|
43
43
|
<%= tag_list(question) %>
|
44
44
|
</div>
|
45
45
|
<div class="clear"></div>
|
data/lib/rostra/engine.rb
CHANGED
data/lib/rostra/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rostra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.20
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Cory Schires
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-15 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -576,6 +576,7 @@ files:
|
|
576
576
|
- lib/rostra/config.rb
|
577
577
|
- lib/rostra/email_notifier.rb
|
578
578
|
- lib/rostra/engine.rb
|
579
|
+
- lib/rostra/timestamp_observer.rb
|
579
580
|
- lib/rostra/version.rb
|
580
581
|
- lib/rostra.rb
|
581
582
|
- lib/tasks/cucumber.rake
|