Commit 48924dfeeafbe965ec06797b10010ebd8a5dcfcd

Authored by gitlabhq
1 parent 59704f48

Wall redesign

app/assets/javascripts/application.js
@@ -16,3 +16,7 @@ $(function(){ @@ -16,3 +16,7 @@ $(function(){
16 $('select#branch').selectmenu({style:'popup', width:200}); 16 $('select#branch').selectmenu({style:'popup', width:200});
17 $('select#tag').selectmenu({style:'popup', width:200}); 17 $('select#tag').selectmenu({style:'popup', width:200});
18 }); 18 });
  19 +
  20 +function updatePage(){
  21 + $.ajax({type: "GET", url: location.href, dataType: "script"});
  22 +}
app/assets/stylesheets/projects.css.scss
@@ -491,8 +491,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td { @@ -491,8 +491,14 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
491 background: white; 491 background: white;
492 } 492 }
493 p { 493 p {
494 - margin-bottom: 3px;  
495 - font-size: 12px; 494 + margin-bottom: 4px;
  495 + font-size: 13px;
  496 + color:#111;
  497 + }
  498 + }
  499 + cite {
  500 + &.ago {
  501 + color:#666;
496 } 502 }
497 } 503 }
498 } 504 }
@@ -515,7 +521,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td { @@ -515,7 +521,7 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
515 } 521 }
516 .note_content { 522 .note_content {
517 float:left; 523 float:left;
518 - width:750px; 524 + width:650px;
519 } 525 }
520 526
521 .issue_notes { 527 .issue_notes {
@@ -605,7 +611,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td { @@ -605,7 +611,9 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
605 } 611 }
606 612
607 } 613 }
608 -.message{ 614 +.commit,
  615 +.message,
  616 +#notes-list{
609 .author { 617 .author {
610 background: #eaeaea; 618 background: #eaeaea;
611 color: #333; 619 color: #333;
@@ -614,3 +622,19 @@ tbody tr:nth-child(2n) td, tbody tr.even td { @@ -614,3 +622,19 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
614 margin-right:5px; 622 margin-right:5px;
615 } 623 }
616 } 624 }
  625 +
  626 +/* Note textare */
  627 +#note_note {
  628 + height:100px;
  629 + width:97%;
  630 + font-size:14px;
  631 +}
  632 +
  633 +.wall_page {
  634 + #note_note {
  635 + height:25px;
  636 + }
  637 + .attach_holder {
  638 + display:none;
  639 + }
  640 +}
app/controllers/projects_controller.rb
@@ -75,7 +75,7 @@ class ProjectsController < ApplicationController @@ -75,7 +75,7 @@ class ProjectsController < ApplicationController
75 y.committed_date <=> x.committed_date 75 y.committed_date <=> x.committed_date
76 end 76 end
77 77
78 - @messages = project.notes.since(@date).limit(40).order("created_at DESC") 78 + @messages = project.notes.since(@date).order("created_at DESC")
79 else 79 else
80 return render "projects/empty" 80 return render "projects/empty"
81 end 81 end
@@ -86,7 +86,14 @@ class ProjectsController &lt; ApplicationController @@ -86,7 +86,14 @@ class ProjectsController &lt; ApplicationController
86 # 86 #
87 87
88 def wall 88 def wall
89 - @notes = @project.common_notes 89 + @date = case params[:view]
  90 + when "week" then Date.today - 7.days
  91 + when "all" then nil
  92 + else Date.today
  93 + end
  94 +
  95 + @notes = @project.common_notes.order("created_at DESC")
  96 + @notes = @notes.since(@date.at_beginning_of_day) if @date
90 @note = Note.new 97 @note = Note.new
91 end 98 end
92 99
app/views/commits/_commits.html.haml
@@ -15,8 +15,8 @@ @@ -15,8 +15,8 @@
15 = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" 15 = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right"
16 = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" 16 = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right"
17 %span 17 %span
18 - %span  
19 - [ #{commit.author} ] 18 + %span.author
  19 + = commit.author
20 = time_ago_in_words(commit.committed_date) 20 = time_ago_in_words(commit.committed_date)
21 ago 21 ago
22 = more_commits_link if @commits.size > 99 22 = more_commits_link if @commits.size > 99
app/views/commits/show.js.haml
1 -:plain 1 +-#:plain
2 $("#side-commit-preview").remove(); 2 $("#side-commit-preview").remove();
3 var side = $("<div id='side-commit-preview'></div>"); 3 var side = $("<div id='side-commit-preview'></div>");
4 side.html("#{escape_javascript(render "commits/show")}"); 4 side.html("#{escape_javascript(render "commits/show")}");
5 $("##{dom_id(@project)}").parent().append(side); 5 $("##{dom_id(@project)}").parent().append(side);
6 $("##{dom_id(@project)}").addClass("span-14"); 6 $("##{dom_id(@project)}").addClass("span-14");
  7 +:plain
  8 + $("#notes-list").html("#{escape_javascript(render(:partial => 'notes/notes_list'))}");
app/views/notes/_form.html.haml
@@ -12,9 +12,9 @@ @@ -12,9 +12,9 @@
12 = f.label :note 12 = f.label :note
13 %cite (255 symbols only) 13 %cite (255 symbols only)
14 %br 14 %br
15 - = f.text_area :note, :style => "width:97%;height:100px", :size => 255 15 + = f.text_area :note, :size => 255
16 16
17 - %div 17 + %div.attach_holder
18 = f.label :attachment 18 = f.label :attachment
19 %cite (less than 10 MB) 19 %cite (less than 10 MB)
20 %br 20 %br
app/views/notes/_notes.html.haml
1 -%ul#notes-list= render "notes/notes_list" 1 +- if controller.action_name == "wall"
  2 + %ul#notes-list= render "notes/notes_list"
2 3
3 -%br  
4 -%br  
5 -- if can? current_user, :write_note, @project  
6 - = render "notes/form" 4 +- else
  5 + %ul#notes-list= render "notes/notes_list"
  6 + %br
  7 + %br
  8 + - if can? current_user, :write_note, @project
  9 + = render "notes/form"
7 10
8 :javascript 11 :javascript
9 $('.delete-note').live('ajax:success', function() { 12 $('.delete-note').live('ajax:success', function() {
@@ -23,7 +26,3 @@ @@ -23,7 +26,3 @@
23 $(function(){ 26 $(function(){
24 var int =self.setInterval("updatePage()", 20000); 27 var int =self.setInterval("updatePage()", 20000);
25 }); 28 });
26 -  
27 - function updatePage(){  
28 - $.ajax({type: "GET", url: location.href, dataType: "script"});  
29 - }  
app/views/notes/_show.html.haml
1 %li{:id => dom_id(note)} 1 %li{:id => dom_id(note)}
2 %div.note_author 2 %div.note_author
3 = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" 3 = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
4 - %div.note_content 4 + %div.note_content.left
5 = simple_format(html_escape(note.note)) 5 = simple_format(html_escape(note.note))
6 - if note.attachment.url 6 - if note.attachment.url
7 Attachment: 7 Attachment:
8 - = link_to note.attachment_identifier, note.attachment.url 8 + = link_to note.attachment_identifier, note.attachment.url, :target => "_blank"
9 %br 9 %br
10 - %span  
11 - %span  
12 - [ #{note.author.name} ]  
13 - &nbsp; 10 + %span.author= note.author.name
  11 + %cite.ago
14 = time_ago_in_words(note.updated_at) 12 = time_ago_in_words(note.updated_at)
15 ago 13 ago
16 - %br 14 + %br
17 - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) 15 - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
18 = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative" 16 = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative"
19 .clear 17 .clear
app/views/notes/create.js.haml
1 - if @note.valid? 1 - if @note.valid?
2 :plain 2 :plain
3 $("#new_note .errors").remove(); 3 $("#new_note .errors").remove();
4 - $("#notes-list").append("#{escape_javascript(render(:partial => 'show', :locals => {:note => @note} ))}"); 4 + updatePage();
5 $('#note_note').val(""); 5 $('#note_note').val("");
6 - else 6 - else
7 :plain 7 :plain
app/views/projects/_recent_commits.html.haml
@@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
9 = link_to truncate_commit_message(commit, 60), project_commit_path(@project, :id => commit.id) 9 = link_to truncate_commit_message(commit, 60), project_commit_path(@project, :id => commit.id)
10 10
11 %span 11 %span
12 - %span  
13 - [ #{commit.author} ] 12 + %span.author
  13 + = commit.author.name.force_encoding("UTF-8")
14 %cite 14 %cite
15 = time_ago_in_words(commit.committed_date) 15 = time_ago_in_words(commit.committed_date)
16 ago 16 ago
app/views/projects/_recent_messages.html.haml
@@ -46,12 +46,6 @@ @@ -46,12 +46,6 @@
46 Attachment: 46 Attachment:
47 = link_to note.attachment_identifier, note.attachment.url 47 = link_to note.attachment_identifier, note.attachment.url
48 %br 48 %br
49 - -#%span  
50 - %span  
51 - [ #{note.author.name} ]  
52 - %cite  
53 - = time_ago_in_words(note.created_at)  
54 - ago  
55 %br 49 %br
56 .append-bottom 50 .append-bottom
57 &nbsp; 51 &nbsp;
app/views/projects/wall.html.haml
  1 +%div.wall_page
  2 + - if can? current_user, :write_note, @project
  3 + = render "notes/form"
  4 + .right
  5 + = form_tag wall_project_path(@project), :method => :get do
  6 + .span-2
  7 + = radio_button_tag :view, "day", (params[:view] || "day") == "day", :onclick => "this.form.submit()", :id => "day_view"
  8 + = label_tag "day_view","Today"
  9 + .span-2
  10 + = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view"
  11 + = label_tag "week_view","Week"
  12 + .span-2
  13 + = radio_button_tag :view, "all", params[:view] == "all", :onclick => "this.form.submit()", :id => "all_view"
  14 + = label_tag "all_view","All"
  15 + .clear
  16 + %br
  17 + %hr
1 = render "notes/notes" 18 = render "notes/notes"
  19 +
  20 +:javascript
  21 + $(function(){
  22 + $("#note_note").live("click", function(){
  23 + $(this).css("height", "100px");
  24 + $('.attach_holder').show();
  25 + });
  26 + });