Commit cadf12c60cc27c5b0b8273c1de4b190a0e88bd7d

Authored by Dmitriy Zaporozhets
1 parent 724ea16c

Merged activities & projects pages

app/assets/stylesheets/common.scss
@@ -925,7 +925,7 @@ p.time { @@ -925,7 +925,7 @@ p.time {
925 } 925 }
926 a:last-child h4 { border:none; } 926 a:last-child h4 { border:none; }
927 927
928 - a.active { 928 + a:hover {
929 h4 { 929 h4 {
930 color:#111; 930 color:#111;
931 border-right:4px solid $styled_border_color; 931 border-right:4px solid $styled_border_color;
app/controllers/dashboard_controller.rb
@@ -34,9 +34,4 @@ class DashboardController < ApplicationController @@ -34,9 +34,4 @@ class DashboardController < ApplicationController
34 format.atom { render :layout => false } 34 format.atom { render :layout => false }
35 end 35 end
36 end 36 end
37 -  
38 - def activities  
39 - @projects = current_user.projects.all  
40 - @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(40)  
41 - end  
42 end 37 end
app/controllers/projects_controller.rb
@@ -13,6 +13,7 @@ class ProjectsController < ApplicationController @@ -13,6 +13,7 @@ class ProjectsController < ApplicationController
13 def index 13 def index
14 @projects = current_user.projects 14 @projects = current_user.projects
15 @projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse 15 @projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse
  16 + @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(40)
16 end 17 end
17 18
18 def new 19 def new
@@ -78,7 +79,6 @@ class ProjectsController < ApplicationController @@ -78,7 +79,6 @@ class ProjectsController < ApplicationController
78 render "projects/empty" 79 render "projects/empty"
79 end 80 end
80 end 81 end
81 - format.js  
82 end 82 end
83 end 83 end
84 84
app/views/dashboard/activities.html.haml
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -- if @events.any?  
2 - %div.dashboard_category  
3 - %h3  
4 - %span.ico.activities  
5 - = link_to "Activities" , "#activities", :id => "activities"  
6 -  
7 - %hr  
8 - = render @events  
9 -- else  
10 - %h3 Nothing here  
app/views/dashboard/index.html.haml
@@ -62,9 +62,6 @@ @@ -62,9 +62,6 @@
62 %h3 62 %h3
63 %span.ico.activities 63 %span.ico.activities
64 = link_to "Activities" , "#activities", :id => "activities" 64 = link_to "Activities" , "#activities", :id => "activities"
65 - %strong.right  
66 - = link_to dashboard_activities_path do  
67 - Visit activities page →  
68 65
69 %hr 66 %hr
70 .row 67 .row
app/views/layouts/_app_menu.html.haml
1 %nav.main_menu 1 %nav.main_menu
2 = render "layouts/const_menu_links" 2 = render "layouts/const_menu_links"
3 = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}" 3 = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}"
4 - = link_to "Activities", dashboard_activities_path, :class => "#{"current" if current_page?(dashboard_activities_path)}"  
5 = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do 4 = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do
6 Issues 5 Issues
7 %span.count= current_user.assigned_issues.opened.count 6 %span.count= current_user.assigned_issues.opened.count
app/views/projects/index.html.haml
1 - if @projects.any? 1 - if @projects.any?
2 .row 2 .row
3 - .span4 3 + .span11
  4 + = render @events
  5 + .span5.right
4 %div.leftbar.ui-box 6 %div.leftbar.ui-box
5 %h5 7 %h5
6 Projects 8 Projects
  9 + %small
  10 + (#{@projects.count})
7 - if current_user.can_create_project? 11 - if current_user.can_create_project?
8 %span.right 12 %span.right
9 = link_to new_project_path, :class => "btn very_small info" do 13 = link_to new_project_path, :class => "btn very_small info" do
10 New Project 14 New Project
11 .content_list 15 .content_list
12 - @projects.each do |project| 16 - @projects.each do |project|
13 - = link_to project_path(project), :remote => true, :class => dom_class(project) do 17 + = link_to project_path(project), :class => dom_class(project) do
14 %h4 18 %h4
15 %span.ico.project 19 %span.ico.project
16 - = truncate(project.name, :length => 22)  
17 - .span12.right  
18 - .show_holder.ui-box.padded  
19 - .loading 20 + = truncate(project.name, :length => 25)
  21 + %span.right
  22 + →
20 23
21 - else 24 - else
22 %h3 Nothing here 25 %h3 Nothing here
@@ -31,20 +34,3 @@ @@ -31,20 +34,3 @@
31 New Project » 34 New Project »
32 - else 35 - else
33 If you will be added to project - it will be displayed here 36 If you will be added to project - it will be displayed here
34 -  
35 -  
36 -:javascript  
37 - $(function(){  
38 - $("a.project").live("ajax:before", function() {  
39 - $(".show_holder").html("<div class='loading'>");  
40 - $('a.project').removeClass("active");  
41 - $(this).addClass("active");  
42 - });  
43 - $('a.project:first-child').trigger("click");  
44 - });  
45 -  
46 -- if @projects.count == @limit  
47 - :javascript  
48 - $(function(){  
49 - Pager.init(#{@limit});  
50 - });  
app/views/projects/show.js.haml
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -- if @project.repo_exists? && @project.has_commits?  
2 - :plain  
3 - $(".show_holder").html("#{escape_javascript(render(:partial => 'projects/show'))}");  
4 -- else  
5 - :plain  
6 - $(".show_holder").html("#{escape_javascript(render(:template => 'projects/empty'))}");  
7 -  
spec/requests/dashboard_spec.rb
@@ -23,18 +23,4 @@ describe &quot;Dashboard&quot; do @@ -23,18 +23,4 @@ describe &quot;Dashboard&quot; do
23 page.should have_content(@project.name) 23 page.should have_content(@project.name)
24 end 24 end
25 end 25 end
26 -  
27 - describe "GET /dashboard/activities" do  
28 - before do  
29 - visit dashboard_activities_path  
30 - end  
31 -  
32 - it "should be on dashboard page" do  
33 - current_path.should == dashboard_activities_path  
34 - end  
35 -  
36 - it "should have projects panel" do  
37 - page.should have_content(@project.name)  
38 - end  
39 - end  
40 end 26 end