From e5502790dd13a6fe1d674ea204a73f39ec977e53 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 17 Oct 2011 19:48:10 +0300 Subject: [PATCH] ajax notes load --- app/views/issues/show.js.haml | 2 ++ app/views/notes/_notes.html.haml | 13 +++++++++---- app/views/notes/_notes_list.html.haml | 4 ++++ app/views/projects/wall.js.haml | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 app/views/issues/show.js.haml create mode 100644 app/views/notes/_notes_list.html.haml create mode 100644 app/views/projects/wall.js.haml diff --git a/app/views/issues/show.js.haml b/app/views/issues/show.js.haml new file mode 100644 index 00000000000..5b9a34c0a9c --- /dev/null +++ b/app/views/issues/show.js.haml @@ -0,0 +1,2 @@ +:plain + $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); diff --git a/app/views/notes/_notes.html.haml b/app/views/notes/_notes.html.haml index 9d1d4b941c8..040c2f28053 100644 --- a/app/views/notes/_notes.html.haml +++ b/app/views/notes/_notes.html.haml @@ -1,7 +1,4 @@ -%ul#notes-list - - @notes.each do |note| - - next unless note.author - = render :partial => "notes/show", :locals => {:note => note} +%ul#notes-list= render "notes/notes_list" %br %br @@ -12,4 +9,12 @@ $('.delete-note').live('ajax:success', function() { $(this).closest('li').fadeOut(); }); +- if ["issues", "projects"].include?(controller.controller_name) + :javascript + $(function(){ + var int =self.setInterval("updatePage()", 20000); + }); + function updatePage(){ + $.ajax({type: "GET", url: location.href, dataType: "script"}); + } diff --git a/app/views/notes/_notes_list.html.haml b/app/views/notes/_notes_list.html.haml new file mode 100644 index 00000000000..1e4a6bb2b2f --- /dev/null +++ b/app/views/notes/_notes_list.html.haml @@ -0,0 +1,4 @@ +- @notes.each do |note| + - next unless note.author + = render :partial => "notes/show", :locals => {:note => note} + diff --git a/app/views/projects/wall.js.haml b/app/views/projects/wall.js.haml new file mode 100644 index 00000000000..5b9a34c0a9c --- /dev/null +++ b/app/views/projects/wall.js.haml @@ -0,0 +1,2 @@ +:plain + $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); -- GitLab