Commit 376bec26de89c3d287560e5fe755deeaffc68d67

Authored by Dmitriy Zaporozhets
1 parent 34e15801

Added dashboard page. Projects page not root from now

app/assets/images/Gear-UI.PNG

940 Bytes

app/assets/images/admin.PNG 0 → 100644

556 Bytes

app/assets/stylesheets/common.scss
... ... @@ -40,6 +40,7 @@ a {
40 40 .cred { color:#D12F19; }
41 41 .cgreen { color:#44aa22; }
42 42 .cblack { color:#111; }
  43 +.cwhite { color:#fff !important }
43 44  
44 45 /** COMMON STYLES **/
45 46 .left {
... ... @@ -75,6 +76,10 @@ a {
75 76 .no-borders {
76 77 border:none;
77 78 }
  79 +table.no-borders {
  80 + border:none;
  81 + tr, td { border:none }
  82 +}
78 83 .no-padding {
79 84 padding:0 !important;
80 85 }
... ... @@ -433,7 +438,7 @@ input.git_clone_url {
433 438 }
434 439  
435 440 .project_list_url {
436   - width:270px;
  441 + width:250px;
437 442 background:#fff !important;
438 443 }
439 444  
... ... @@ -441,7 +446,7 @@ input.git_clone_url {
441 446 @include shade;
442 447 @include round-borders-all(4px);
443 448 margin-bottom:20px;
444   - width:338px;
  449 + width:298px;
445 450 float:left;
446 451 margin-left:20px;
447 452 border: 1px solid #DDD;
... ... @@ -600,3 +605,24 @@ p.time {
600 605 font-size: 90%;
601 606 margin: 30px 3px 3px 2px;
602 607 }
  608 +
  609 +
  610 +.dashboard_category {
  611 + margin-bottom:30px;
  612 +
  613 + .dashboard_block {
  614 + width:700px;
  615 + margin:auto;
  616 +
  617 + .wll {
  618 + border:none;
  619 + &:hover {
  620 + background:none;
  621 + }
  622 +
  623 + h4 {
  624 + color:#666;
  625 + }
  626 + }
  627 + }
  628 +}
... ...
app/assets/stylesheets/ui_basic.scss
... ... @@ -57,11 +57,30 @@
57 57 text-shadow: 0 1px 1px #FFF;
58 58 }
59 59  
60   - img {
61   - float: left;
62   - position: relative;
63   - top: -9px;
64   - width:46px;
  60 + &.home {
  61 + img {
  62 + float: left;
  63 + position: relative;
  64 + top: -9px;
  65 + width:46px;
  66 +
  67 + }
  68 + }
  69 + &.admin_link {
  70 + width:16px;
  71 + height:16px;
  72 + padding: 5px;
  73 + border: 1px solid #ccc;
  74 + border-radius: 4px;
  75 + margin: 0px;
  76 + background: #eee;
  77 + margin-left:20px;
  78 + &:hover {
  79 + background:#f7f7f7;
  80 + }
  81 + img {
  82 + width:16px;
  83 + }
65 84 }
66 85 }
67 86 }
... ...
app/controllers/dashboard_controller.rb
... ... @@ -3,7 +3,14 @@ class DashboardController < ApplicationController
3 3  
4 4 def index
5 5 @projects = current_user.projects.all
  6 +
6 7 @active_projects = @projects.select(&:repo_exists?).select(&:last_activity_date_cached).sort_by(&:last_activity_date_cached).reverse
  8 +
  9 + @merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(10)
  10 +
  11 + @user = current_user
  12 + @issues = current_user.assigned_issues.opened.order("created_at DESC").limit(10)
  13 + @issues = @issues.includes(:author, :project)
7 14 end
8 15  
9 16 # Get authored or assigned open merge requests
... ...
app/views/dashboard/_projects_feed.html.haml
1   -- @active_projects.first(3).each do |project|
2   - = link_to project do
3   - %h4= project.name
4   - - project.updates(3).each do |update|
5   - %a.project-update{:href => dashboard_feed_path(project, update)}
6   - = image_tag gravatar_icon(update.author_email), :class => "avatar", :width => 32
7   - %div
8   - = dashboard_feed_title(update)
9   - %span.update-author
10   - %strong= update.author_name
11   - authored
12   - = time_ago_in_words(update.created_at)
13   - ago
14   - .right
15   - - klass = update.class.to_s.split("::").last.downcase
16   - %span.tag{ :class => klass }= klass
17   -
  1 +- @active_projects.first(10).each do |project|
  2 + .wll
  3 + = link_to project do
  4 + %h4
  5 + = project.name
  6 + %small
  7 + last activity at
  8 + = project.last_activity_date_cached.stamp("Aug 25, 2011")
... ...
app/views/dashboard/index.html.haml
1   -%h3 Activities
2   -%hr
3   -.news-feed= render "dashboard/projects_feed"
  1 +- if current_user.require_ssh_key?
  2 + .alert-message.warning
  3 + %p
  4 + You wont be able to pull/push project code unless you
  5 + = link_to new_key_path, :class => "vlink" do
  6 + add new key
  7 + to your profile
  8 +
  9 +%div.dashboard_category
  10 + %h3
  11 + Projects
  12 + %small
  13 + ( most recent )
  14 +
  15 + %strong.right
  16 + = link_to projects_path do
  17 + Projects list →
  18 + %hr
  19 + .row
  20 + .dashboard_block
  21 + .row
  22 + .span9= render "dashboard/projects_feed"
  23 + .span3.right
  24 + - if current_user.can_create_project?
  25 + .alert-message.block-message.warning
  26 + You can create up to
  27 + = current_user.projects_limit
  28 + projects. Click on link below to add a new one
  29 + .link_holder
  30 + = link_to new_project_path, :class => "" do
  31 + New Project »
  32 +
  33 +
  34 +- unless @merge_requests.blank?
  35 + %div.dashboard_category
  36 + %h3
  37 + Merge Requests
  38 + %small ( authored or assigned to you )
  39 + %strong.right
  40 + = link_to dashboard_merge_requests_path do
  41 + Vist merge requests page →
  42 + %hr
  43 + .row
  44 + .dashboard_block= render "dashboard/merge_requests_feed"
  45 +
  46 +- unless @issues.blank?
  47 + %div.dashboard_category
  48 + %h3
  49 + Issues
  50 + %small ( assigned to you )
  51 + %strong.right
  52 + = link_to dashboard_merge_requests_path do
  53 + Vist issues page →
  54 + %hr
  55 + .row
  56 + .dashboard_block= render "dashboard/issues_feed"
... ...
app/views/dashboard/issues.html.haml
... ... @@ -2,5 +2,5 @@
2 2 Issues
3 3 %small ( assigned to you )
4 4  
5   -%hr
6   -= render "dashboard/issues_feed"
  5 +%br
  6 +.ui-box= render "dashboard/issues_feed"
... ...
app/views/dashboard/merge_requests.html.haml
... ... @@ -2,5 +2,5 @@
2 2 Merge Requests
3 3 %small ( authored or assigned to you )
4 4  
5   -%hr
6   -= render "dashboard/merge_requests_feed"
  5 +%br
  6 +.ui-box= render "dashboard/merge_requests_feed"
... ...
app/views/layouts/_app_menu.html.haml
1 1 %nav.main_menu
2 2 = render "layouts/const_menu_links"
3   - -#= link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path) || current_page?(root_path)}"
  3 + = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}"
4 4 = link_to "Issues", dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
5 5 = link_to "Requests", dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
6 6 = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}"
... ...
app/views/layouts/_const_menu_links.html.haml
1   -= link_to "Home", root_path, :class => "home #{"current" if current_page?(projects_path) || current_page?(root_path)}", :title => "Home"
  1 += link_to "Home", root_path, :class => "home #{"current" if current_page?(dashboard_path) || current_page?(root_path)}", :title => "Home"
... ...
app/views/layouts/_head_panel.html.haml
... ... @@ -5,7 +5,11 @@
5 5 %div.app_logo
6 6 = link_to root_path, :class => "home", :title => "Home" do
7 7 = image_tag "logo_tr.png", :width => 50
8   - %h1 GITLAB
  8 + %h1
  9 + GITLAB
  10 +
  11 + = link_to admin_projects_path, :class => "admin_link", :title => "Admin area" do
  12 + = image_tag "admin.PNG", :width => 16
9 13  
10 14 %h1.project_name= title
11 15 .search= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input"
... ...
app/views/layouts/application.html.haml
... ... @@ -7,6 +7,4 @@
7 7 .container
8 8 = render :partial => "layouts/app_menu"
9 9 .content
10   - .row
11   - .span12= yield
12   - .sidebar= render "layouts/projects_side"
  10 + = yield
... ...
app/views/projects/_tile.html.haml
1   -- @projects.in_groups_of(2, false) do |projects|
  1 +- @projects.in_groups_of(3, false) do |projects|
2 2 .row
3 3 - projects.each_with_index do |project, i|
4 4 %div.project_tile
... ...
app/views/projects/index.html.haml
1 1 %h3
2 2 Projects
3 3 %small= "( #{current_user.projects.count} )"
  4 + - if current_user.can_create_project?
  5 + %span.right
  6 + = link_to new_project_path, :class => "btn small" do
  7 + New Project
4 8 %hr
5 9 - unless @projects.empty?
6 10 %div.content_list= render "tile"
... ...
config/routes.rb
... ... @@ -123,5 +123,5 @@ Gitlab::Application.routes.draw do
123 123 end
124 124 resources :notes, :only => [:index, :create, :destroy]
125 125 end
126   - root :to => "projects#index"
  126 + root :to => "dashboard#index"
127 127 end
... ...