Commit 3e695acfa2f4035431cb325645b3114d06e43105
1 parent
e3351287
Exists in
master
and in
4 other branches
Notes fixed
Showing
5 changed files
with
29 additions
and
14 deletions
Show diff stats
Gemfile.lock
1 | 1 | GIT |
2 | + remote: https://github.com/ctran/annotate_models.git | |
3 | + revision: be4e26825b521f0b2d86b181e2dff89901aa9b1e | |
4 | + specs: | |
5 | + annotate (2.6.0.beta1) | |
6 | + activerecord (>= 2.3.0) | |
7 | + rake (>= 0.8.7) | |
8 | + | |
9 | +GIT | |
10 | + remote: https://github.com/gitlabhq/raphael-rails.git | |
11 | + revision: cb2c92a040b9b941a5f1aa1ea866cc26e944fe58 | |
12 | + specs: | |
13 | + raphael-rails (2.1.0) | |
14 | + | |
15 | +GIT | |
2 | 16 | remote: https://github.com/gollum/gollum.git |
3 | 17 | revision: 5dcd3c8c8f68158e43ff79861279088ee56d0ebe |
4 | 18 | ref: 5dcd3c8c8f |
... | ... | @@ -15,20 +29,6 @@ GIT |
15 | 29 | stringex (~> 1.5.1) |
16 | 30 | useragent (~> 0.4.16) |
17 | 31 | |
18 | -GIT | |
19 | - remote: https://github.com/ctran/annotate_models.git | |
20 | - revision: be4e26825b521f0b2d86b181e2dff89901aa9b1e | |
21 | - specs: | |
22 | - annotate (2.6.0.beta1) | |
23 | - activerecord (>= 2.3.0) | |
24 | - rake (>= 0.8.7) | |
25 | - | |
26 | -GIT | |
27 | - remote: https://github.com/gitlabhq/raphael-rails.git | |
28 | - revision: cb2c92a040b9b941a5f1aa1ea866cc26e944fe58 | |
29 | - specs: | |
30 | - raphael-rails (2.1.0) | |
31 | - | |
32 | 32 | GEM |
33 | 33 | remote: https://rubygems.org/ |
34 | 34 | specs: | ... | ... |
app/models/event.rb
app/models/note.rb
... | ... | @@ -170,4 +170,10 @@ class Note < ActiveRecord::Base |
170 | 170 | "wall" |
171 | 171 | end |
172 | 172 | end |
173 | + | |
174 | + # FIXME: Hack for polymorphic associations with STI | |
175 | + # For more information wisit http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Polymorphic+Associations | |
176 | + def noteable_type=(sType) | |
177 | + super(sType.to_s.classify.constantize.base_class.to_s) | |
178 | + end | |
173 | 179 | end | ... | ... |
app/models/snippet.rb
... | ... | @@ -20,6 +20,7 @@ class Snippet < ActiveRecord::Base |
20 | 20 | attr_accessible :title, :content, :file_name, :expires_at, :private |
21 | 21 | |
22 | 22 | belongs_to :author, class_name: "User" |
23 | + | |
23 | 24 | has_many :notes, as: :noteable, dependent: :destroy |
24 | 25 | |
25 | 26 | delegate :name, :email, to: :author, prefix: true, allow_nil: true | ... | ... |
app/views/events/event/_note.html.haml
... | ... | @@ -5,6 +5,10 @@ |
5 | 5 | - if event.note_commit? |
6 | 6 | = event.note_target_type |
7 | 7 | = link_to event.note_short_commit_id, project_commit_path(event.project, event.note_commit_id), class: "commit_short_id" |
8 | + - if event.note_project_snippet? | |
9 | + = link_to project_snippet_path(event.project, event.note_target) do | |
10 | + %strong | |
11 | + #{event.note_target_type} ##{truncate event.note_target_id} | |
8 | 12 | - else |
9 | 13 | = link_to [event.project, event.note_target] do |
10 | 14 | %strong | ... | ... |