project dashboard updated

This commit is contained in:
Dmitriy Zaporozhets 2011-11-09 01:56:10 +02:00
parent 1d85197b08
commit a44e329222
7 changed files with 62 additions and 139 deletions

View file

@ -443,57 +443,6 @@ input.ssh_project_url {
padding: 10px; padding: 10px;
} }
.recent_message_parent {
img {
padding-right:10px;
}
float: left;
margin: 0 20px 20px 0px;
padding: 5px 0px;;
width: 420px;
&.dash_wall{
border-bottom: 2px solid orange;
span {
background: orange;
color:black;
}
}
&.dash_issue{
border-bottom: 2px solid #ffbbbb;
span {
background: #ffbbbb;
}
}
&.dash_commit{
border-bottom: 2px solid #bbbbff;
span{
background: #bbbbff;
}
}
&.dash_snippet{
border-bottom: 2px solid #bbffbb;
span{
background: #bbffbb;
}
}
span{
border: 1px solid #aaa;
color:black;
padding:1px 4px;
}
h4 {
margin-bottom:3px;
}
}
.commit, .commit,
.message{ .message{
.author { .author {
@ -665,6 +614,8 @@ table.highlighttable pre{
margin-right:15px; margin-right:15px;
} }
} }
.filter .left { margin-right:15px; }
.cgray { color:gray; } .cgray { color:gray; }
.cred { color:#D12F19; } .cred { color:#D12F19; }
@ -721,3 +672,5 @@ body.project-page #notes-list .note span.note-author strong{font-weight: bold; f
border-bottom: 1px solid #DEE2E3; border-bottom: 1px solid #DEE2E3;
} }
} }
.message .note-title p { margin-bottom:0px; }

View file

@ -12,7 +12,7 @@ module DashboardHelper
when "Commit" then project_commit_path(project, :id => note.noteable_id) when "Commit" then project_commit_path(project, :id => note.noteable_id)
else wall_project_path(project) else wall_project_path(project)
end end
else "#" else wall_project_path(project)
end end
rescue rescue
"#" "#"
@ -23,7 +23,7 @@ module DashboardHelper
when "Note" then markdown(object.note) when "Note" then markdown(object.note)
when "Issue" then object.title when "Issue" then object.title
when "Grit::Commit" then object.safe_message when "Grit::Commit" then object.safe_message
else "" else return "Project Wall"
end end
"[#{object.class.name}] #{truncate(sanitize(title, :tags => []), :length => 60)} " "[#{object.class.name}] #{truncate(sanitize(title, :tags => []), :length => 60)} "
end end

View file

@ -23,7 +23,7 @@
.project-box.project-updates.ui-box.ui-box-small.ui-box-big .project-box.project-updates.ui-box.ui-box-small.ui-box-big
%h3= project.name %h3= project.name
.data .data
- project.updates.each do |update| - project.updates(4).each do |update|
%a.project-update{:href => dashboard_feed_path(project, update)} %a.project-update{:href => dashboard_feed_path(project, update)}
= image_tag gravatar_icon(update.author_email), :class => "left", :width => 40 = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
%span.update-title %span.update-title
@ -34,7 +34,5 @@
= time_ago_in_words(update.created_at) = time_ago_in_words(update.created_at)
ago ago
%br %br
/ .project-update
/ .project-updates
/ #news-feed / #news-feed
/ #dashboard-content / #dashboard-content

View file

@ -1,18 +1,33 @@
- @commits.each do |commit| %table
%div.commit %thead
- if commit.author.email %th
= image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" Commits
- else .filter.right
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" = form_tag project_path(@project), :method => :get, :class => "right" do
%p{:style => "margin-bottom: 3px;"} .left
%strong = radio_button_tag :view, "recent", (params[:view] || "recent") == "recent", :onclick => "this.form.submit()", :id => "recent_view"
= link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id) = label_tag "recent_view","Recent"
.left
%span = radio_button_tag :view, "day", params[:view] == "day", :onclick => "this.form.submit()", :id => "day_view"
%span.author = label_tag "day_view","Today"
= commit.author.name.force_encoding("UTF-8") .left
%cite = radio_button_tag :view, "week", params[:view] == "week", :onclick => "this.form.submit()", :id => "week_view"
= time_ago_in_words(commit.committed_date) = label_tag "week_view","Week"
ago - @commits.each do |commit|
%br %tr
%td
%div.commit
- if commit.author.email
= image_tag gravatar_icon(commit.author.email), :class => "left", :width => 40, :style => "padding-right:5px;"
- else
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
%p{:style => "margin-bottom: 3px;"}
%strong
= link_to truncate(commit.safe_message, :length => fixed_mode? ? 40 : 100), project_commit_path(@project, :id => commit.id)
%span
%span.note-author
%strong= commit.author.name.force_encoding("UTF-8")
%cite.cgray
= time_ago_in_words(commit.committed_date)
ago

View file

@ -3,50 +3,25 @@
- parent = load_note_parent(id, type, @project) - parent = load_note_parent(id, type, @project)
- next unless parent - next unless parent
- case type %table
- when "Issue" %thead
- css_class = "dash_issue" %th
- issue = parent %div{ :class => "recent_message_parent"}
- item_code = issue.author.email = link_to(truncate(dashboard_feed_title(parent), :length => fixed_mode? ? 40 : 100 ), dashboard_feed_path(@project, parent))
- link_item_name = truncate(issue.title, :length => 50) - notes.sort {|x,y| y.updated_at <=> x.updated_at }.each do |note|
- link_to_item = project_issue_path(@project, issue) %tr
- when "Snippet" %td
- css_class = "dash_snippet" %div.message
- item_code = parent.author.email = image_tag gravatar_icon(note.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
- link_item_name = parent.title %div.note-author
- link_to_item = project_snippet_path(@project, parent) %strong= note.author_name
- when "Commit" %cite.cgray
- css_class = "dash_commit" = time_ago_in_words(note.updated_at)
- commit = parent ago
- item_code = commit.author.email %div.note-title
- link_item_name = truncate(commit.safe_message, :length => 50) = link_to markdown(truncate(note.note, :length => fixed_mode? ? 40 : 100)), dashboard_feed_path(@project, parent) + "#note_#{note.id}"
- link_to_item = project_commit_path(@project, :id => commit.id) - if note.attachment.url
- else %br
- css_class = "dash_wall" Attachment:
- item_code = @project.name = link_to note.attachment_identifier, note.attachment.url
- link_item_name = "Project Wall" %br
- link_to_item = wall_project_path(@project)
%div{ :class => "recent_message_parent #{css_class}"}
= image_tag gravatar_icon(item_code), :class => "left", :width => 40
%h4
= link_to(link_item_name, link_to_item)
%span
= type
.clear
- notes.sort {|x,y| x.updated_at <=> y.updated_at }.each do |note|
%div.message
= image_tag gravatar_icon(note.author.email), :class => "left", :width => 24, :style => "padding-right:5px;"
%p{:style => "margin-bottom: 3px;"}
%span.author
= note.author.name
= link_to markdown(truncate(note.note, :length => 200)), link_to_item + "#note_#{note.id}"
- if note.attachment.url
%br
Attachment:
= link_to note.attachment_identifier, note.attachment.url
%br
%br
.append-bottom
&nbsp;
.clear

View file

@ -1,28 +1,11 @@
%div
%h2.left History
.right
= form_tag 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"
.clear
%hr
.left.width-49p .left.width-49p
%h3 Commits
=render "projects/recent_commits" =render "projects/recent_commits"
.right.width-49p .right.width-49p
%h3 Talk
=render "projects/recent_messages" =render "projects/recent_messages"
:javascript :javascript
function updateDashboard(){ function updateDashboard(){
$('#content-container').load("#{escape_javascript(project_path(@project))} #content-container>*"); $('.project-content').load("#{escape_javascript(project_path(@project))} .project-content>*");
} }
setInterval("updateDashboard()", 300000); setInterval("updateDashboard()", 300000);

View file

@ -158,7 +158,6 @@ describe "Issues" do
it "should have valid show page for issue" do it "should have valid show page for issue" do
page.should have_content @issue.title page.should have_content @issue.title
page.should have_content @user.name page.should have_content @user.name
page.should have_content "today"
end end
end end