From a9639776d7c52ca63c5ca7b86baf300b1a5e87e8 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 4 Nov 2011 00:37:02 +0200 Subject: [PATCH 1/6] fixed/fluid layout switch --- app/assets/stylesheets/style.scss | 2 +- app/controllers/application_controller.rb | 10 +++++ app/helpers/application_helper.rb | 8 ++++ app/views/layouts/_head_panel.html.erb | 51 +++++++++++------------ app/views/layouts/admin.html.haml | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/layouts/profile.html.haml | 2 +- app/views/layouts/project.html.haml | 2 +- 8 files changed, 47 insertions(+), 32 deletions(-) diff --git a/app/assets/stylesheets/style.scss b/app/assets/stylesheets/style.scss index 97be566f..29e6058d 100755 --- a/app/assets/stylesheets/style.scss +++ b/app/assets/stylesheets/style.scss @@ -292,7 +292,7 @@ body.login-page{background-color: #f1f1f1; padding-top: 10%} /* General */ #container{background-color: white; overflow: hidden;} -/*#container{margin: auto; width: 980px; border: 1px solid rgba(0,0,0,.22); border-top: 0; box-shadow: 0 0 0px 4px rgba(0,0,0,.04)}*/ +body.collapsed #container{margin: auto; width: 980px; border: 1px solid rgba(0,0,0,.22); border-top: 0; box-shadow: 0 0 0px 4px rgba(0,0,0,.04)} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6d0edace..070def96 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base before_filter :authenticate_user! + before_filter :view_style + protect_from_forgery helper_method :abilities, :can? @@ -73,4 +75,12 @@ class ApplicationController < ActionController::Base def require_non_empty_project redirect_to @project unless @project.repo_exists? end + + def view_style + if params[:view_style] == "collapsed" + cookies[:view_style] = "collapsed" + elsif params[:view_style] == "fluid" + cookies[:view_style] = "" + end + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3aa40c99..70984804 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,6 +4,14 @@ module ApplicationHelper "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email)}?s=40&d=identicon" end + def body_class(default_class = nil) + main = content_for(:body_class).blank? ? + default_class : + content_for(:body_class) + + [main, cookies[:view_style]].join(" ") + end + def commit_name(project, commit) if project.commit.id == commit.id "master" diff --git a/app/views/layouts/_head_panel.html.erb b/app/views/layouts/_head_panel.html.erb index a64aa3b5..6db1d389 100644 --- a/app/views/layouts/_head_panel.html.erb +++ b/app/views/layouts/_head_panel.html.erb @@ -1,19 +1,29 @@
-

- GITLAB

-
- - <% if current_user %> <%= javascript_tag do %> $(function() { diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 8df7881c..e02dbe04 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -9,7 +9,7 @@ = javascript_tag do REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; - %body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} #container = render :partial => "layouts/flash" = render :partial => "layouts/head_panel" diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index eedbf116..030f1999 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -13,7 +13,7 @@ = javascript_tag do REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; - %body{ :class => yield(:body_class), :id => yield(:boyd_id)} + %body{ :class => body_class, :id => yield(:boyd_id)} #container = render :partial => "layouts/flash" = render :partial => "layouts/head_panel" diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index a33d9d5d..2fd30dcd 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -9,7 +9,7 @@ = javascript_tag do REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; - %body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} #container = render :partial => "layouts/flash" = render :partial => "layouts/head_panel" diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index f8d8221a..ee6581ec 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -9,7 +9,7 @@ = javascript_tag do REQ_URI = "#{request.env["REQUEST_URI"]}"; REQ_REFFER = "#{request.env["HTTP_REFERER"]}"; - %body{ :class => content_for?(:body_class) ? yield(:body_class) : 'project-page', :id => yield(:boyd_id)} + %body{ :class => body_class('project-page'), :id => yield(:boyd_id)} #container = render :partial => "layouts/flash" = render :partial => "layouts/head_panel" From 687290a00d71540ae809ae9ef172771ce7c46778 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 4 Nov 2011 09:46:58 +0200 Subject: [PATCH 2/6] fixed brach switch --- app/views/commits/index.html.haml | 2 +- app/views/projects/_refs.html.haml | 2 +- app/views/projects/_tree.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/commits/index.html.haml b/app/views/commits/index.html.haml index 7999b94c..b9650145 100644 --- a/app/views/commits/index.html.haml +++ b/app/views/commits/index.html.haml @@ -12,7 +12,7 @@ \/ %a{:href => "#"}= params[:path].split("/").join(" / ") -.right= render "projects/refs" +.right= render :partial => "projects/refs", :locals => { :destination => project_commits_path(@project) } %div{:id => dom_id(@project)} = render "commits" diff --git a/app/views/projects/_refs.html.haml b/app/views/projects/_refs.html.haml index f7712d3d..60b17c7f 100644 --- a/app/views/projects/_refs.html.haml +++ b/app/views/projects/_refs.html.haml @@ -1,4 +1,4 @@ -= form_tag project_commits_path(@project), :method => :get, :class => "project-refs-form" do += form_tag destination, :method => :get, :class => "project-refs-form" do = select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select" diff --git a/app/views/projects/_tree.html.haml b/app/views/projects/_tree.html.haml index f70bbb7a..8fdf72f0 100644 --- a/app/views/projects/_tree.html.haml +++ b/app/views/projects/_tree.html.haml @@ -17,7 +17,7 @@ \/ = link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true   - .right= render "projects/refs" + .right= render :partial => "projects/refs", :locals => { :destination => tree_project_path(@project) } .clear #tree-content-holder From ca1e3d05796484424057d071b726779537868384 Mon Sep 17 00:00:00 2001 From: gitlabhq Date: Fri, 4 Nov 2011 09:37:38 -0400 Subject: [PATCH 3/6] 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 zcmZ?wbhEHbRA5kG_{zZW|Nnmm28Lh1ejPb-}@xSg>Hhn>TOPty_2J&K)~DyRfjZgoK2enwk|WR=j)n&dbXy zCntx8hlhcI;oP}%Cr+HWapQ)Lj!s-$oSdATkB`rW4I3D!3Kaiy`?-b$J39ur8tEA@ zGcqtRDE^ajE=o--Nlj5G&n(GMNX$yC$jMJk(aX$B%V$vh$->FSz`&pbat0_67})+h zG!%HKh*`+E7oJq{6FTC!+*pHamJjDqp}Ar0tgIs5H31s^3#V9#Xo#>DZFIWWb3NW6 zLQ!Ap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u`wodZPVoFuyFjb`02(%Tc5ulPJX&~ro5v~{KD4> zkA>xSMfj=xG-bZ(@3!uNP^F#nll_$&6QU~1I61DJ|IqQzVaYe|Bj1HY7#Z5i8(1$~ zY`K?veeRT*p}+7ZlqmwBVr5|@M-nulh*mAj9Z za^AGb*{J!d+Vhu}9QrTLTU~OsZO_IzD&3}vSD$g0EB!SJ^wEszmY8B%=_0EXpA*<* z%FNCbUhGg65W$)%&&ED|qJC6`4QsXbwCR;>6HS){RL$2}$iB2NdEPqRHJb`oZr#kp zp0{3cV<$WF(uBQ=OO+-|bWLYH>Z`$eQi5Z8_mp$d92ZxKvR-A{al?`2c85I6={=9c zpG=9Qo4m@mRiaF~cXnl>jY58@5X`;8! zH*I&dw*I%Jn1L4w0Xsm{hI696lOD}ihK08iGTM43TQG-K)%NI?Rk3lzn6r7L zh|FwsZd)+5N}FX_1{>@8d2E{(wL32jo!jBFE+>#_TgSph$Ch|ZJm6DlK69)3*>gVY z%l5}lxVC54eg=+ZOb_l}*>y_zHuKA8Ws4l;*=F8(CewDooaOR2iRphCY$dojc&4)i zGjmN**5Hh1v|{x+C}6Na>agx2IXjc!hPbKSGXIUPb(AO0cb$;wu?W%=vQRlRgQJ+K ziOHhaPNZRpI!~xUKG)TXP0KDW_L#g$FlusWdo6QS6z44C`7Irxs{&#?45s+aF|G)D zGX095pJ7bDR7h7w{O-Jk_vUqIEm*O)mjCIp&J&a091Y+U-6njz_@eiL1j`R=t3}>B z^9cU6<6dF(^syMrqFZk#MH;O?R8@H4kmN1-7Y$p4rmYLedOhvx8qa0l<~;r)!kFKt zk!2=b=5koF;?TK(6yH~8Rc+nR@+uVXto0T#tT+49WKp(VS+sEC2lv8;&k~E3+PN~) z7Mu ?", 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'))}"); From 8a23682fc5212918c931888bb7b468d167d19c33 Mon Sep 17 00:00:00 2001 From: gitlabhq Date: Fri, 4 Nov 2011 11:46:51 -0400 Subject: [PATCH 4/6] refactored too --- app/assets/stylesheets/projects.css.scss | 2 +- app/controllers/commits_controller.rb | 11 +++++++---- app/controllers/issues_controller.rb | 10 +++++++++- app/views/commits/show.js.haml | 9 +-------- app/views/issues/show.html.haml | 13 +++++++++++- app/views/issues/show.js.haml | 3 +-- app/views/notes/_load.js.haml | 10 ++++++++++ app/views/notes/_notes.html.haml | 25 ++++++++++++------------ app/views/notes/create.js.haml | 1 + app/views/projects/wall.html.haml | 15 +------------- app/views/projects/wall.js.haml | 10 +--------- 11 files changed, 56 insertions(+), 53 deletions(-) create mode 100644 app/views/notes/_load.js.haml diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 06063b16..ba18bfa0 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -540,7 +540,7 @@ input.ssh_project_url { font-size:14px; } -.wall_page { +#new_note { #note_note { height:25px; } diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index 79b97ed7..f6af56f8 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -28,12 +28,15 @@ class CommitsController < ApplicationController def show @commit = project.repo.commits(params[:id]).first - @notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit") + @notes = project.notes.where(:noteable_id => @commit.id, :noteable_type => "Commit").order("created_at DESC").limit(20) @note = @project.notes.new(:noteable_id => @commit.id, :noteable_type => "Commit") - respond_to do |format| - format.html # show.html.erb - format.js + 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 end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 71c559a1..b6fd85b8 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -35,8 +35,16 @@ class IssuesController < ApplicationController end def show - @notes = @issue.notes.order("created_at ASC") + @notes = @issue.notes.order("created_at DESC").limit(20) @note = @project.notes.new(:noteable => @issue) + + 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 def create diff --git a/app/views/commits/show.js.haml b/app/views/commits/show.js.haml index 9831bb29..ee31c0b8 100644 --- a/app/views/commits/show.js.haml +++ b/app/views/commits/show.js.haml @@ -1,8 +1 @@ --#:plain - $("#side-commit-preview").remove(); - var side = $("
"); - side.html("#{escape_javascript(render "commits/show")}"); - $("##{dom_id(@project)}").parent().append(side); - $("##{dom_id(@project)}").addClass("span-14"); -:plain - $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); += render "notes/load" diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 371a8033..669784ba 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -1,8 +1,10 @@ %h2 = "Issue ##{@issue.id} - #{html_escape(@issue.title)}" .left.width-65p - -#= simple_format html_escape(@issue.content) .issue_notes= render "notes/notes" + + .loading{ :style => "display:none;"} + %center= image_tag "ajax-loader.gif" .right.width-30p .span-8 - if @issue.closed @@ -55,3 +57,12 @@ .right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}" .clear +: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/issues/show.js.haml b/app/views/issues/show.js.haml index ae2ff32c..ee31c0b8 100644 --- a/app/views/issues/show.js.haml +++ b/app/views/issues/show.js.haml @@ -1,2 +1 @@ -:plain - $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}"); += render "notes/load" diff --git a/app/views/notes/_load.js.haml b/app/views/notes/_load.js.haml new file mode 100644 index 00000000..f560f0bd --- /dev/null +++ b/app/views/notes/_load.js.haml @@ -0,0 +1,10 @@ +- 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'))}"); + diff --git a/app/views/notes/_notes.html.haml b/app/views/notes/_notes.html.haml index e33050b0..4a5c3aab 100644 --- a/app/views/notes/_notes.html.haml +++ b/app/views/notes/_notes.html.haml @@ -1,12 +1,8 @@ -- if controller.action_name == "wall" - %ul#notes-list= render "notes/notes_list" - -- else - %ul#notes-list= render "notes/notes_list" - %br - %br - - if can? current_user, :write_note, @project - = render "notes/form" +- if can? current_user, :write_note, @project + = render "notes/form" +.clear +%hr +%ul#notes-list= render "notes/notes_list" :javascript $('.delete-note').live('ajax:success', function() { @@ -20,8 +16,11 @@ $("#submit_note").removeAttr("disabled"); }) --#- if ["issues", "projects"].include?(controller.controller_name) - :javascript - $(function(){ - var int =self.setInterval("updatePage('ref=#{params[:ref]}')", 20000); + $(function(){ + $("#note_note").live("click", function(){ + $(this).css("height", "100px"); + $('.attach_holder').show(); }); + + NoteList.init("wall", #{@notes.last.try(:id) || 0}, #{@notes.first.try(:id) || 0}); + }); diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml index ffc80140..cf804493 100644 --- a/app/views/notes/create.js.haml +++ b/app/views/notes/create.js.haml @@ -2,6 +2,7 @@ :plain $("#new_note .errors").remove(); $('#note_note').val(""); + NoteList.prepend(#{@note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => @note})}"); - else :plain $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml index 2bc3150a..4f0ec41e 100644 --- a/app/views/projects/wall.html.haml +++ b/app/views/projects/wall.html.haml @@ -1,19 +1,6 @@ %div.wall_page - - if can? current_user, :write_note, @project - = render "notes/form" - .clear - %hr -= render "notes/notes" + = 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 81417800..ee31c0b8 100644 --- a/app/views/projects/wall.js.haml +++ b/app/views/projects/wall.js.haml @@ -1,9 +1 @@ -- 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'))}"); += render "notes/load" From 2ed5211dad88dc0b0cccb1104ed2180192609950 Mon Sep 17 00:00:00 2001 From: gitlabhq Date: Fri, 4 Nov 2011 11:59:00 -0400 Subject: [PATCH 5/6] fixes --- app/views/issues/show.html.haml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 669784ba..7321f635 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -56,13 +56,3 @@ = link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "lbutton positive", :remote => true .right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{@issue.id}" .clear - -:javascript - $(function(){ - $("#note_note").live("click", function(){ - $(this).css("height", "100px"); - $('.attach_holder').show(); - }); - - NoteList.init("wall", #{@notes.last.id}, #{@notes.first.id}); - }); From 0b0e0225adfc83ed951118b3c3e82167add9fd03 Mon Sep 17 00:00:00 2001 From: gitlabhq Date: Fri, 4 Nov 2011 12:20:52 -0400 Subject: [PATCH 6/6] css fixes --- app/assets/stylesheets/projects.css.scss | 1 - app/views/issues/show.html.haml | 4 ---- app/views/notes/_show.html.haml | 4 +++- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index ba18bfa0..766138ee 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -686,7 +686,6 @@ table.highlighttable pre{ 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;} diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 7321f635..8267a850 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -7,10 +7,6 @@ %center= image_tag "ajax-loader.gif" .right.width-30p .span-8 - - if @issue.closed - %center.success Closed - - else - %center.error Open %table.round-borders %tr %td Title: diff --git a/app/views/notes/_show.html.haml b/app/views/notes/_show.html.haml index 164733a5..5d766291 100644 --- a/app/views/notes/_show.html.haml +++ b/app/views/notes/_show.html.haml @@ -2,7 +2,9 @@ = 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) + %cite + = time_ago_in_words(note.updated_at) + ago - 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"