Commit 7f6bbf06f8d94f7e3830567167332ca2a42c4573

Authored by Dmitriy Zaporozhets
1 parent 87e0429f

Fix bug getting started message when navigate to personal projects w/o them exist

app/controllers/dashboard_controller.rb
... ... @@ -7,6 +7,8 @@ class DashboardController < ApplicationController
7 7 def index
8 8 @groups = current_user.authorized_groups
9 9  
  10 + @has_authorized_projects = @projects.count > 0
  11 +
10 12 @projects = case params[:scope]
11 13 when 'personal' then
12 14 @projects.personal(current_user)
... ...
app/views/dashboard/_activities.html.haml 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 += render "events/event_last_push", event: @last_push
  2 +
  3 +.event_filter
  4 + = event_filter_link EventFilter.push, 'Push events'
  5 + = event_filter_link EventFilter.merged, 'Merge events'
  6 + = event_filter_link EventFilter.comments, 'Comments'
  7 + = event_filter_link EventFilter.team, 'Team'
  8 +
  9 +- if @events.any?
  10 + .content_list= render @events
  11 +- else
  12 + %p.nothing_here_message Projects activity will be displayed here
  13 +.loading.hide
... ...
app/views/dashboard/_projects.html.haml
... ... @@ -30,4 +30,7 @@
30 30 %span.last_activity
31 31 %strong Last activity:
32 32 %span= project_last_activity(project)
  33 + - if projects.blank?
  34 + %li.wll
  35 + %h3.nothing_here_message There are no projects here.
33 36 .bottom= paginate projects, theme: "gitlab"
... ...
app/views/dashboard/_sidebar.html.haml 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +- if @groups.present?
  2 + = render "groups", groups: @groups
  3 += render "projects", projects: @projects
  4 +%div
  5 + %span.rss-icon
  6 + = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do
  7 + = image_tag "rss_ui.png", title: "feed"
  8 + %strong News Feed
  9 +
  10 +%hr
  11 +.gitlab-promo
  12 + = link_to "Homepage", "http://gitlabhq.com"
  13 + = link_to "Blog", "http://blog.gitlabhq.com"
  14 + = link_to "@gitlabhq", "https://twitter.com/gitlabhq"
... ...
app/views/dashboard/_zero_authorized_projects.html.haml 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +%h3.nothing_here_message
  2 + There are no projects you have access to.
  3 + %br
  4 + - if current_user.can_create_project?
  5 + You can create up to
  6 + = current_user.projects_limit
  7 + projects. Click on button below to add a new one
  8 + .link_holder
  9 + = link_to new_project_path, class: "btn primary" do
  10 + New Project »
  11 + - else
  12 + If you will be added to project - it will be displayed here
... ...
app/views/dashboard/index.html.haml
1   -- if @projects.any?
  1 +- if @has_authorized_projects
2 2 .projects
3 3 .activities.span8
4   - = render "events/event_last_push", event: @last_push
5   -
6   - .event_filter
7   - = event_filter_link EventFilter.push, 'Push events'
8   - = event_filter_link EventFilter.merged, 'Merge events'
9   - = event_filter_link EventFilter.comments, 'Comments'
10   - = event_filter_link EventFilter.team, 'Team'
11   -
12   - - if @events.any?
13   - .content_list= render @events
14   - - else
15   - %p.nothing_here_message Projects activity will be displayed here
16   - .loading.hide
  4 + = render 'activities'
17 5 .side
18   - - if @groups.present?
19   - = render "groups", groups: @groups
20   - = render "projects", projects: @projects
21   - %div
22   - %span.rss-icon
23   - = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do
24   - = image_tag "rss_ui.png", title: "feed"
25   - %strong News Feed
26   -
27   - %hr
28   - .gitlab-promo
29   - = link_to "Homepage", "http://gitlabhq.com"
30   - = link_to "Blog", "http://blog.gitlabhq.com"
31   - = link_to "@gitlabhq", "https://twitter.com/gitlabhq"
32   -
  6 + = render 'sidebar'
33 7  
34 8 - else
35   - %h3.nothing_here_message There are no projects you have access to.
36   - %br
37   - %h4.nothing_here_message
38   - - if current_user.can_create_project?
39   - You can create up to
40   - = current_user.projects_limit
41   - projects. Click on button below to add a new one
42   - .link_holder
43   - = link_to new_project_path, class: "btn primary" do
44   - New Project »
45   - - else
46   - If you will be added to project - it will be displayed here
47   -
48   -
  9 + = render "zero_authorized_projects"
49 10 :javascript
50 11 $(function(){ Pager.init(20); });
... ...