Dashboard refactoring:

* dashboard should be in dashboard controller not project index
* projects index removed
This commit is contained in:
randx 2012-06-12 23:13:42 +03:00
parent 9ef9c58f55
commit edd81a79c5
15 changed files with 84 additions and 101 deletions

View file

@ -659,6 +659,10 @@ li.note {
width:24px;
vertical-align:top;
}
strong {
line-height:24px;
}
}
.automerge_widget {
@ -741,7 +745,7 @@ li.note {
*/
.event_lp {
@extend .alert-info;
margin-bottom:15px;
margin-bottom:20px;
padding:8px;
border-style: solid;
border-width: 1px;

View file

@ -2,18 +2,17 @@ class DashboardController < ApplicationController
respond_to :html
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
@events = Event.where(:project_id => current_user.projects.map(&:id)).recent.limit(20)
@merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(5)
@last_push = current_user.recent_push
@user = current_user
@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)
@last_push = Event.where(:project_id => @projects.map(&:id)).recent.code_push.limit(1).first
respond_to do |format|
format.html
format.atom { render :layout => false }
end
end
# Get authored or assigned open merge requests

View file

@ -60,8 +60,9 @@ module ApplicationHelper
def search_autocomplete_source
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
default_nav = [
{ :label => "Profile", :url => profile_path },
{ :label => "Keys", :url => keys_path },
{ :label => "Projects", :url => projects_path },
{ :label => "Dashboard", :url => root_path },
{ :label => "Admin", :url => admin_root_path }
]

View file

@ -34,6 +34,13 @@
&rarr;
.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
%h3.nothing_here_message There are no projects you have access to.
%br

View file

@ -0,0 +1,2 @@
:plain
$(".projects .activities").append("#{escape_javascript(render(@events))}");

View file

@ -1,5 +1,5 @@
%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
Issues
%span.count= current_user.assigned_issues.opened.count

View file

@ -1,2 +0,0 @@
:plain
Pager.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}");

View file

@ -2,10 +2,6 @@
.entry
.row
-#.span2
.back_link
= link_to projects_path do
&larr; To projects list
.span7
.form-horizontal
.input-prepend