OSDN Git Service

Fix MR diff comments. Fix wiki comments loading error
authorrandx <dmitriy.zaporozhets@gmail.com>
Sat, 15 Sep 2012 06:49:21 +0000 (09:49 +0300)
committerrandx <dmitriy.zaporozhets@gmail.com>
Sat, 15 Sep 2012 06:49:21 +0000 (09:49 +0300)
app/assets/stylesheets/sections/notes.scss
app/contexts/notes/load_context.rb
app/models/project.rb
app/models/wiki.rb
app/views/merge_requests/diffs.html.haml

index 2db20f1..148807d 100644 (file)
@@ -14,7 +14,7 @@
   border-top:1px solid #aaa;
 }
 #new-notes-list.reversed {
-  border-bottom:1px solid #aaa;
+  border-bottom:1px solid #ccc;
 }
 
 .issue_notes,
@@ -227,7 +227,7 @@ td .line_note_link {
   }
 }
 
-.note-text { 
+.note-text {
   border: 1px solid #aaa;
   box-shadow:none;
 }
index 6d26e16..f92a780 100644 (file)
@@ -20,7 +20,7 @@ module Notes
                  # this is the only case, where the order is DESC
                  project.common_notes.order("created_at DESC, id DESC").limit(50)
                when "wiki"
-                 project.wikis.reverse.map {|w| w.notes.fresh }.flatten[0..20]
+                 project.wiki_notes.limit(20)
                end
 
       @notes = if after_id
index 4de836c..56d5d79 100644 (file)
@@ -171,6 +171,10 @@ class Project < ActiveRecord::Base
     end
   end
 
+  def wiki_notes
+    Note.where(noteable_id: wikis.map(&:id), noteable_type: 'Wiki', project_id: self.id)
+  end
+
   def project_id
     self.id
   end
index 3c4952c..ebb1ff4 100644 (file)
@@ -28,7 +28,6 @@ class Wiki < ActiveRecord::Base
       end
       new_wiki
     end
-
   end
 end
 # == Schema Information
index 176b19b..a755491 100644 (file)
@@ -1,2 +1,6 @@
 = render "show"
 
+:javascript
+  $(function(){
+    PerLineNotes.init();
+  });