summaryrefslogtreecommitdiff
path: root/help/app/models
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-11-16 15:43:12 -0800
committerjessib <jessib@leap.se>2012-11-16 15:43:12 -0800
commit341da14b031c3c27e687c82f479624217c1dbddd (patch)
treee97b617b0dec8c88c01f150c0cc489d6ff56196d /help/app/models
parent18a67ffdc21e44e21363f863b1a31d74b98ee3eb (diff)
Rough start to modeling tickets view after the issues view in github (so something like https://github.com/spree/spree/issues ), using bootstrap for display.
Still want to use pjax, and have more functionality to add: searching, sorting, pagination, etc..
Diffstat (limited to 'help/app/models')
-rw-r--r--help/app/models/ticket.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb
index dc2f51b..3b66fe4 100644
--- a/help/app/models/ticket.rb
+++ b/help/app/models/ticket.rb
@@ -83,6 +83,19 @@ class Ticket < CouchRest::Model::Base
#save
end
+ def commenters
+ commenters = []
+ self.comments.each do |comment|
+ if comment.posted_by
+ user = User.find(comment.posted_by)
+ commenters << user.login if user and !commenters.include?(user.login)
+ else
+ commenters << 'unauthenticated user' if !commenters.include?('unauthenticated user') #todo don't hardcode string 'unauthenticated user'
+ end
+ end
+ commenters.join(', ')
+ end
+
def comments_attributes=(attributes)
if attributes # could be empty as we will empty if nothing was typed in
comment = TicketComment.new(attributes.values.first) #TicketComment.new(attributes)