Commit edd81a79 authored by randx's avatar randx

Dashboard refactoring:

* dashboard should be in dashboard controller not project index
* projects index removed
parent 9ef9c58f
...@@ -659,6 +659,10 @@ li.note { ...@@ -659,6 +659,10 @@ li.note {
width:24px; width:24px;
vertical-align:top; vertical-align:top;
} }
strong {
line-height:24px;
}
} }
.automerge_widget { .automerge_widget {
...@@ -741,7 +745,7 @@ li.note { ...@@ -741,7 +745,7 @@ li.note {
*/ */
.event_lp { .event_lp {
@extend .alert-info; @extend .alert-info;
margin-bottom:15px; margin-bottom:20px;
padding:8px; padding:8px;
border-style: solid; border-style: solid;
border-width: 1px; border-width: 1px;
......
...@@ -2,18 +2,17 @@ class DashboardController < ApplicationController ...@@ -2,18 +2,17 @@ class DashboardController < ApplicationController
respond_to :html respond_to :html
def index def index
@projects = current_user.projects.all @projects = current_user.projects.includes(:events).order("events.created_at DESC")
@projects = @projects.page(params[:page]).per(40)
@active_projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse
@merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(5) @events = Event.where(:project_id => current_user.projects.map(&:id)).recent.limit(20)
@user = current_user @last_push = current_user.recent_push
@issues = current_user.assigned_issues.opened.order("created_at DESC").limit(5)
@issues = @issues.includes(:author, :project)
@events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20) respond_to do |format|
@last_push = Event.where(:project_id => @projects.map(&:id)).recent.code_push.limit(1).first format.html
format.atom { render :layout => false }
end
end end
# Get authored or assigned open merge requests # Get authored or assigned open merge requests
......
...@@ -60,8 +60,9 @@ module ApplicationHelper ...@@ -60,8 +60,9 @@ module ApplicationHelper
def search_autocomplete_source def search_autocomplete_source
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
default_nav = [ default_nav = [
{ :label => "Profile", :url => profile_path },
{ :label => "Keys", :url => keys_path }, { :label => "Keys", :url => keys_path },
{ :label => "Projects", :url => projects_path }, { :label => "Dashboard", :url => root_path },
{ :label => "Admin", :url => admin_root_path } { :label => "Admin", :url => admin_root_path }
] ]
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
&rarr; &rarr;
.bottom= paginate @projects, :theme => "gitlab" .bottom= paginate @projects, :theme => "gitlab"
%hr
%div
%span.rss-icon
= link_to dashboard_path(:atom, { :private_token => current_user.private_token }) do
= image_tag "rss_ui.png", :title => "feed"
%strong News Feed
- else - else
%h3.nothing_here_message There are no projects you have access to. %h3.nothing_here_message There are no projects you have access to.
%br %br
......
:plain
$(".projects .activities").append("#{escape_javascript(render(@events))}");
%nav.main_menu %nav.main_menu
= link_to "Home", root_path, :class => "home #{"current" if current_page?(projects_path) || current_page?(root_path)}", :title => "Home" = link_to "Home", root_path, :class => "home #{"current" if current_page?(dashboard_path) || current_page?(root_path)}", :title => "Home"
= link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do
Issues Issues
%span.count= current_user.assigned_issues.opened.count %span.count= current_user.assigned_issues.opened.count
......
:plain
Pager.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}");
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
.entry .entry
.row .row
-#.span2
.back_link
= link_to projects_path do
&larr; To projects list
.span7 .span7
.form-horizontal .form-horizontal
.input-prepend .input-prepend
......
...@@ -33,6 +33,10 @@ Gitlab::Application.routes.draw do ...@@ -33,6 +33,10 @@ Gitlab::Application.routes.draw do
end end
get "errors/githost" get "errors/githost"
#
# Profile Area
#
get "profile/password", :to => "profile#password" get "profile/password", :to => "profile#password"
put "profile/password", :to => "profile#password_update" put "profile/password", :to => "profile#password_update"
get "profile/token", :to => "profile#token" get "profile/token", :to => "profile#token"
...@@ -41,10 +45,14 @@ Gitlab::Application.routes.draw do ...@@ -41,10 +45,14 @@ Gitlab::Application.routes.draw do
get "profile/design", :to => "profile#design" get "profile/design", :to => "profile#design"
put "profile/update", :to => "profile#update" put "profile/update", :to => "profile#update"
#
# Dashboard Area
#
get "dashboard", :to => "dashboard#index"
get "dashboard/issues", :to => "dashboard#issues" get "dashboard/issues", :to => "dashboard#issues"
get "dashboard/merge_requests", :to => "dashboard#merge_requests" get "dashboard/merge_requests", :to => "dashboard#merge_requests"
resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create, :index] resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create]
resources :keys resources :keys
devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks } devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks }
...@@ -145,5 +153,5 @@ Gitlab::Application.routes.draw do ...@@ -145,5 +153,5 @@ Gitlab::Application.routes.draw do
end end
resources :notes, :only => [:index, :create, :destroy] resources :notes, :only => [:index, :create, :destroy]
end end
root :to => "projects#index" root :to => "dashboard#index"
end end
require 'spec_helper'
describe "User Dashboard" do
before { login_as :user }
describe "GET /" do
before do
@project = Factory :project, :owner => @user
@project.add_access(@user, :read)
visit dashboard_path
end
it "should be on projects page" do
current_path.should == dashboard_path
end
it "should have link to new project" do
page.should have_content("New Project")
end
it "should have project" do
page.should have_content(@project.name)
end
it "should render projects atom feed via private token" do
logout
visit dashboard_path(:atom, :private_token => @user.private_token)
page.body.should have_selector("feed title")
end
it "should not render projects page via private token" do
logout
visit dashboard_path(:private_token => @user.private_token)
current_path.should == new_user_session_path
end
end
end
...@@ -7,7 +7,7 @@ describe "Last Push widget" do ...@@ -7,7 +7,7 @@ describe "Last Push widget" do
@project = Factory :project, :owner => @user @project = Factory :project, :owner => @user
@project.add_access(@user, :read) @project.add_access(@user, :read)
create_push_event create_push_event
visit projects_path visit dashboard_path
end end
it "should display last push widget with link to merge request page" do it "should display last push widget with link to merge request page" do
......
require 'spec_helper' require 'spec_helper'
describe "Projects" do describe "Projects Security" do
describe "GET /projects" do describe "GET /" do
it { projects_path.should be_allowed_for :admin } it { root_path.should be_allowed_for :admin }
it { projects_path.should be_allowed_for :user } it { root_path.should be_allowed_for :user }
it { projects_path.should be_denied_for :visitor } it { root_path.should be_denied_for :visitor }
end end
describe "GET /projects/new" do describe "GET /projects/new" do
it { projects_path.should be_allowed_for :admin } it { new_project_path.should be_allowed_for :admin }
it { projects_path.should be_allowed_for :user } it { new_project_path.should be_allowed_for :user }
it { projects_path.should be_denied_for :visitor } it { new_project_path.should be_denied_for :visitor }
end end
describe "Project" do describe "Project" do
......
...@@ -3,43 +3,9 @@ require 'spec_helper' ...@@ -3,43 +3,9 @@ require 'spec_helper'
describe "Projects" do describe "Projects" do
before { login_as :user } before { login_as :user }
describe "GET /projects" do
before do
@project = Factory :project, :owner => @user
@project.add_access(@user, :read)
visit projects_path
end
it "should be on projects page" do
current_path.should == projects_path
end
it "should have link to new project" do
page.should have_content("New Project")
end
it "should have project" do
page.should have_content(@project.name)
end
it "should render projects atom feed via private token" do
logout
visit projects_path(:atom, :private_token => @user.private_token)
page.body.should have_selector("feed title")
end
it "should not render projects page via private token" do
logout
visit projects_path(:private_token => @user.private_token)
current_path.should == new_user_session_path
end
end
describe "GET /projects/new" do describe "GET /projects/new" do
before do before do
visit projects_path visit root_path
click_link "New Project" click_link "New Project"
end end
......
__END__
require 'spec_helper'
describe "Top Panel", :js => true do
before { login_as :user }
describe "Search autocomplete" do
before do
visit projects_path
fill_in "search", :with => "Ke"
within ".ui-autocomplete" do
find(:xpath, "//a[.=\"Keys\"]").click
end
end
it "should be on projects page" do
current_path.should == keys_path
end
end
describe "with project" do
before do
@project = Factory :project
@project.add_access(@user, :read)
visit project_path(@project)
fill_in "search", :with => "Commi"
within ".ui-autocomplete" do
find(:xpath, "//a[.=\"#{@project.code} / Commits\"]").click
end
end
it "should be on projects page" do
current_path.should == project_commits_path(@project)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment