From ca1e3d05796484424057d071b726779537868384 Mon Sep 17 00:00:00 2001 From: gitlabhq Date: Fri, 4 Nov 2011 09:37:38 -0400 Subject: [PATCH] wall login in progress --- app/assets/images/ajax-loader.gif | Bin 6820 -> 4178 bytes app/assets/javascripts/application.js | 4 +- app/assets/javascripts/note.js | 65 +++++++++++++++++++++++ app/assets/stylesheets/projects.css.scss | 45 ++++------------ app/controllers/projects_controller.rb | 14 ++--- app/views/notes/_notes.html.haml | 4 +- app/views/notes/_show.html.haml | 20 ++++--- app/views/notes/create.js.haml | 1 - app/views/projects/wall.html.haml | 20 ++----- app/views/projects/wall.js.haml | 11 +++- 10 files changed, 110 insertions(+), 74 deletions(-) create mode 100644 app/assets/javascripts/note.js diff --git a/app/assets/images/ajax-loader.gif b/app/assets/images/ajax-loader.gif index 0ca7ada960568fff04400cda966fbdcb106abfa2..c97ec6ea9739a68e25637c0aa4adaaea05e3e4ca 100644 GIT binary patch literal 4178 zcmd7Vc~n!^z6bD=GbK4E2`6wsh6Iy8 zZXT|VPGLNN2mA~GA3uHs0N}UZers=UpP8ANot+&R7)VJ;DK9Vo<(FTkr>Eb)e_vW! znv;_=IXT(d+Nx5ioQs-`t|1K=5o2bxw%=l^-o;fU4JoMCYP`2Y<&6;3I%QL1Zq>w9FA$l2jP%EY&tHJ}U*_ftbF*XKVy|EC z`T59S3+S8hKm*TFprw`XCcutaMTNb5RF4TURt1Z}jQ1W~|y1l}D$?xvA#{7ID zd;F5o>mN@bP5YSiF5gZs!P1B1Ur$q~mfKqGj(8DJ&(n&-EB-U*3*-VR z8WFE*Xr_veIG4yIxqp*}2yvNu|@%6s}LY#m{BAG+3o!`hHm z=FCZS7Q~mtZ555&3sY+sb>_3e^~B$7AY!PgGUM=+YyjbKE#hHMDH2X3MN(seUFi}! z1kF#03Ww<^N@vB8Qjm>dxEMFDh0vX#G0O|(Uj=aFJf@bw-$Sg{)UNaFoig0ud){z& zwGu?3o)G-TQ0o2EnKAI?EAV;z?5pYSx3}KB{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`XCXf|3dUqm@!KnB701u!L56&?iU{V=G)w0F&{{1%nbWk{ZqP zjs%2qW23S})GMBit(Sz9$)X4Tr!mk_cs@}Y_iFu25Z5mWLmhsLL{z49hzbXnwYy=Y zG>95_)sGNrK!P})gHq?DiCznqhlB}c=Y&Ahq{|ILi-k(5D}3yW9tzhq`rLoi1f=$? z!!^WHgDPyE;wrc@PzgDZK3zV@5DJ!)m^p3^o2+JmyaKk)DS{U$=fEQ!@7UHdR@ml0 zjYoet6nuW(HyLy5(A!HiWJK=+r_~@pa`A7 zSS`Tmk%2W93px6SSBb!D_9INca zk@Ldr7E1NPQ9WyaQu9^V+n0N5yW>DpvC!0C==bMG?Uir!bvhk$-nbrtxCKB-pHg`oK*3%kAeY zyy1Mxuvc|Q2L_DS;$ekmz+S*|V_0MwpO}i8g5qSDwA8}>MWHmc%i3rsuvr)a266+C z*{Orr_?%;tGVmZ`=#3=dz)&d6LKdpwfXs_fjxEUw6$Dp0Lm_oV(5Aa_$`!;r6rG3e zhQP;^(!2fT8fjfRA+mXoc*n+d>H?oxr_OY=KLfxjfy-~E+lQGKKwIm9cNNb;^A^`J zu@kc3sUuX*FTiCKEsQP)Yz(5!4uAypnHYyawoI`13uvFh5`<5bvjeB$xBj5yiY{Uj;W-o;IP3My6{S#JC%v&}%gLlEu*! zVzq&VhFGRvp=7YpTF$hdp14H{+9bi*`iW=hQV~U<xb-DHJX)2 zg{uchDz8{RSDCYcD!uH%J>v!ry4zzHE~}5xWBuB0Xd}gM$^4AO2expt_@wQr`;fn& z%DCcaot;X?h+ltPPUJ!-EH%t-Q7kk*NWZJ>EjAKYN!zwEVK(HJT=0>##2>OCvp9de i`fP1XuLsY9yzQ3KmuBKoS}^1|Jk6m?fBq5uJ^ur9Yr!Z0 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 86887fdd..23845ea5 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -20,6 +20,6 @@ $(function(){ $('select#tag').selectmenu({style:'popup', width:200}); }); -function updatePage(){ - $.ajax({type: "GET", url: location.href, dataType: "script"}); +function updatePage(data){ + $.ajax({type: "GET", url: location.href, data: data, dataType: "script"}); } diff --git a/app/assets/javascripts/note.js b/app/assets/javascripts/note.js new file mode 100644 index 00000000..71279fc4 --- /dev/null +++ b/app/assets/javascripts/note.js @@ -0,0 +1,65 @@ +var NoteList = { + +first_id: 0, +last_id: 0, +resource_name: null, + +init: + function(resource_name, first_id, last_id) { + this.resource_name = resource_name; + this.first_id = first_id; + this.last_id = last_id; + this.initRefresh(); + this.initLoadMore(); + }, + +getOld: + function() { + $('.loading').show(); + $.ajax({ + type: "GET", + url: location.href, + data: "first_id=" + this.first_id, + complete: function(){ $('.loading').hide()}, + dataType: "script"}); + }, + +append: + function(id, html) { + this.first_id = id; + $("#notes-list").append(html); + this.initLoadMore(); + }, + +prepend: + function(id, html) { + this.last_id = id; + $("#notes-list").prepend(html); + }, + +getNew: + function() { + // refersh notes list + $.ajax({ + type: "GET", + url: location.href, + data: "last_id=" + this.last_id, + dataType: "script"}); + }, + +initRefresh: + function() { + // init timer + var int = setInterval("NoteList.getNew()", 20000); + }, + +initLoadMore: + function() { + $(window).bind('scroll', function(){ + if($(window).scrollTop() == $(document).height() - $(window).height()){ + $(window).unbind('scroll'); + NoteList.getOld(); + } + }); + } +} diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 4e4bcccc..06063b16 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -421,31 +421,6 @@ input.ssh_project_url { list-style:none; margin:0px; padding:0px; - - li { - display:list-item; - padding:8px; - margin:0px; - background: #F7FBFC; - border-top: 1px solid #E2EAEE; - - &:first-child { - border-top: none; - } - &:nth-child(2n+1) { - background: white; - } - p { - margin-bottom: 4px; - font-size: 13px; - color:#111; - } - } - cite { - &.ago { - color:#666; - } - } } .notes_count { @@ -460,14 +435,6 @@ input.ssh_project_url { right: 6px; top: 6px; } -.note_author { - float:left; - width:60px; -} -.note_content { - float:left; - width:650px; -} .issue_notes { .note_content { @@ -556,8 +523,7 @@ input.ssh_project_url { } .commit, -.message, -#notes-list{ +.message{ .author { background: #eaeaea; color: #333; @@ -719,3 +685,12 @@ table.highlighttable pre{ .project-refs-select { width:200px; } + + +body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} +body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} +body.project-page #notes-list .note img{float: left; margin-right: 10px;} +body.project-page #notes-list .note span.note-title{display: block;} +body.project-page #notes-list .note span.note-title{margin-bottom: 10px} +body.project-page #notes-list .note span.note-author{color: #999; font-weight: normal; font-style: italic;} +body.project-page #notes-list .note span.note-author strong{font-weight: bold; font-style: normal;} diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e046add3..067245c4 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -86,13 +86,15 @@ class ProjectsController < ApplicationController def wall @note = Note.new @notes = @project.common_notes.order("created_at DESC") + @notes = @notes.fresh.limit(20) - @notes = case params[:view] - when "week" then @notes.since((Date.today - 7.days).at_beginning_of_day) - when "all" then @notes.all - when "day" then @notes.since(Date.today.at_beginning_of_day) - else @notes.fresh.limit(10) - end + respond_to do |format| + format.html + format.js do + @notes = @notes.where("id > ?", params[:last_id]) if params[:last_id] + @notes = @notes.where("id < ?", params[:first_id]) if params[:first_id] + end + end end # diff --git a/app/views/notes/_notes.html.haml b/app/views/notes/_notes.html.haml index e7cc2360..e33050b0 100644 --- a/app/views/notes/_notes.html.haml +++ b/app/views/notes/_notes.html.haml @@ -20,8 +20,8 @@ $("#submit_note").removeAttr("disabled"); }) -- if ["issues", "projects"].include?(controller.controller_name) +-#- if ["issues", "projects"].include?(controller.controller_name) :javascript $(function(){ - var int =self.setInterval("updatePage()", 20000); + var int =self.setInterval("updatePage('ref=#{params[:ref]}')", 20000); }); diff --git a/app/views/notes/_show.html.haml b/app/views/notes/_show.html.haml index 187d0a3c..164733a5 100644 --- a/app/views/notes/_show.html.haml +++ b/app/views/notes/_show.html.haml @@ -1,17 +1,15 @@ -%li{:id => dom_id(note)} - %div.note_author - = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" - %div.note_content.left +%li{:id => dom_id(note), :class => "note"} + = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" + %div.note-author + %strong= note.author_name + = time_ago_in_words(note.updated_at) + - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) + = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative" + + %div.note-title = markdown(note.note) - if note.attachment.url Attachment: = link_to note.attachment_identifier, note.attachment.url, :target => "_blank" - %br - %span.author= note.author.name - %cite.ago - = time_ago_in_words(note.updated_at) - ago %br - - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) - = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative" .clear diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml index a04130e8..ffc80140 100644 --- a/app/views/notes/create.js.haml +++ b/app/views/notes/create.js.haml @@ -1,7 +1,6 @@ - if @note.valid? :plain $("#new_note .errors").remove(); - updatePage(); $('#note_note').val(""); - else :plain diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml index 63c9613a..2bc3150a 100644 --- a/app/views/projects/wall.html.haml +++ b/app/views/projects/wall.html.haml @@ -1,29 +1,19 @@ %div.wall_page - if can? current_user, :write_note, @project = render "notes/form" - .right - = form_tag wall_project_path(@project), :method => :get do - .span-2 - = radio_button_tag :view, "recent", (params[:view] || "recent") == "recent", :onclick => "this.form.submit()", :id => "recent_view" - = label_tag "recent_view","Recent" - .span-2 - = radio_button_tag :view, "day", params[:view] == "day", :onclick => "this.form.submit()", :id => "day_view" - = label_tag "day_view","Today" - .span-2 - = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view" - = label_tag "week_view","Week" - .span-2 - = radio_button_tag :view, "all", params[:view] == "all", :onclick => "this.form.submit()", :id => "all_view" - = label_tag "all_view","All" .clear - %br %hr = render "notes/notes" +.loading{ :style => "display:none;"} + %center= image_tag "ajax-loader.gif" + :javascript $(function(){ $("#note_note").live("click", function(){ $(this).css("height", "100px"); $('.attach_holder').show(); }); + + NoteList.init("wall", #{@notes.last.id}, #{@notes.first.id}); }); diff --git a/app/views/projects/wall.js.haml b/app/views/projects/wall.js.haml index ae2ff32c..81417800 100644 --- a/app/views/projects/wall.js.haml +++ b/app/views/projects/wall.js.haml @@ -1,2 +1,9 @@ -:plain - $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); +- unless @notes.blank? + + - if params[:last_id] + :plain + NoteList.prepend(#{@notes.first.id}, "#{escape_javascript(render(:partial => 'notes/notes_list'))}"); + + - if params[:first_id] + :plain + NoteList.append(#{@notes.last.id}, "#{escape_javascript(render(:partial => 'notes/notes_list'))}");