diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 461dd51b570..1fcadbfefba 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -7,6 +7,8 @@ class DashboardController < ApplicationController def index @groups = current_user.authorized_groups + @has_authorized_projects = @projects.count > 0 + @projects = case params[:scope] when 'personal' then @projects.personal(current_user) diff --git a/app/views/dashboard/_activities.html.haml b/app/views/dashboard/_activities.html.haml new file mode 100644 index 00000000000..c63ef24fca5 --- /dev/null +++ b/app/views/dashboard/_activities.html.haml @@ -0,0 +1,13 @@ += render "events/event_last_push", event: @last_push + +.event_filter + = event_filter_link EventFilter.push, 'Push events' + = event_filter_link EventFilter.merged, 'Merge events' + = event_filter_link EventFilter.comments, 'Comments' + = event_filter_link EventFilter.team, 'Team' + +- if @events.any? + .content_list= render @events +- else + %p.nothing_here_message Projects activity will be displayed here +.loading.hide diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml index fac0a074691..d92983ff6a5 100644 --- a/app/views/dashboard/_projects.html.haml +++ b/app/views/dashboard/_projects.html.haml @@ -30,4 +30,7 @@ %span.last_activity %strong Last activity: %span= project_last_activity(project) + - if projects.blank? + %li.wll + %h3.nothing_here_message There are no projects here. .bottom= paginate projects, theme: "gitlab" diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml new file mode 100644 index 00000000000..ca57cd30732 --- /dev/null +++ b/app/views/dashboard/_sidebar.html.haml @@ -0,0 +1,14 @@ +- if @groups.present? + = render "groups", groups: @groups += render "projects", projects: @projects +%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 + +%hr +.gitlab-promo + = link_to "Homepage", "http://gitlabhq.com" + = link_to "Blog", "http://blog.gitlabhq.com" + = link_to "@gitlabhq", "https://twitter.com/gitlabhq" diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml new file mode 100644 index 00000000000..d1676ed11fa --- /dev/null +++ b/app/views/dashboard/_zero_authorized_projects.html.haml @@ -0,0 +1,12 @@ +%h3.nothing_here_message + There are no projects you have access to. + %br + - if current_user.can_create_project? + You can create up to + = current_user.projects_limit + projects. Click on button below to add a new one + .link_holder + = link_to new_project_path, class: "btn primary" do + New Project » + - else + If you will be added to project - it will be displayed here diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index 6b360dc1fef..0b4c4844a7f 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -1,50 +1,11 @@ -- if @projects.any? +- if @has_authorized_projects .projects .activities.span8 - = render "events/event_last_push", event: @last_push - - .event_filter - = event_filter_link EventFilter.push, 'Push events' - = event_filter_link EventFilter.merged, 'Merge events' - = event_filter_link EventFilter.comments, 'Comments' - = event_filter_link EventFilter.team, 'Team' - - - if @events.any? - .content_list= render @events - - else - %p.nothing_here_message Projects activity will be displayed here - .loading.hide + = render 'activities' .side - - if @groups.present? - = render "groups", groups: @groups - = render "projects", projects: @projects - %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 - - %hr - .gitlab-promo - = link_to "Homepage", "http://gitlabhq.com" - = link_to "Blog", "http://blog.gitlabhq.com" - = link_to "@gitlabhq", "https://twitter.com/gitlabhq" - + = render 'sidebar' - else - %h3.nothing_here_message There are no projects you have access to. - %br - %h4.nothing_here_message - - if current_user.can_create_project? - You can create up to - = current_user.projects_limit - projects. Click on button below to add a new one - .link_holder - = link_to new_project_path, class: "btn primary" do - New Project » - - else - If you will be added to project - it will be displayed here - - + = render "zero_authorized_projects" :javascript $(function(){ Pager.init(20); });