OSDN Git Service

Added dashboard page. Projects page not root from now
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 28 Feb 2012 20:59:36 +0000 (22:59 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Tue, 28 Feb 2012 20:59:36 +0000 (22:59 +0200)
16 files changed:
app/assets/images/Gear-UI.PNG [deleted file]
app/assets/images/admin.PNG [new file with mode: 0644]
app/assets/stylesheets/common.scss
app/assets/stylesheets/ui_basic.scss
app/controllers/dashboard_controller.rb
app/views/dashboard/_projects_feed.html.haml
app/views/dashboard/index.html.haml
app/views/dashboard/issues.html.haml
app/views/dashboard/merge_requests.html.haml
app/views/layouts/_app_menu.html.haml
app/views/layouts/_const_menu_links.html.haml
app/views/layouts/_head_panel.html.haml
app/views/layouts/application.html.haml
app/views/projects/_tile.html.haml
app/views/projects/index.html.haml
config/routes.rb

diff --git a/app/assets/images/Gear-UI.PNG b/app/assets/images/Gear-UI.PNG
deleted file mode 100644 (file)
index 7720f0e..0000000
Binary files a/app/assets/images/Gear-UI.PNG and /dev/null differ
diff --git a/app/assets/images/admin.PNG b/app/assets/images/admin.PNG
new file mode 100644 (file)
index 0000000..73ff1df
Binary files /dev/null and b/app/assets/images/admin.PNG differ
index 6021236..e1acae4 100644 (file)
@@ -40,6 +40,7 @@ a {
 .cred { color:#D12F19; }
 .cgreen { color:#44aa22; }
 .cblack { color:#111; }
+.cwhite { color:#fff !important }
 
 /** COMMON STYLES **/
 .left {
@@ -75,6 +76,10 @@ a {
 .no-borders { 
   border:none;
 }
+table.no-borders { 
+  border:none;
+  tr, td { border:none }
+}
 .no-padding { 
   padding:0 !important;
 }
@@ -433,7 +438,7 @@ input.git_clone_url {
 }
 
 .project_list_url { 
-  width:270px;
+  width:250px;
   background:#fff !important;
 }
 
@@ -441,7 +446,7 @@ input.git_clone_url {
   @include shade;
   @include round-borders-all(4px);
   margin-bottom:20px;
-  width:338px;
+  width:298px;
   float:left;
   margin-left:20px;
   border: 1px solid #DDD;
@@ -600,3 +605,24 @@ p.time {
   font-size: 90%;
   margin: 30px 3px 3px 2px;
 }
+
+
+.dashboard_category { 
+  margin-bottom:30px;
+
+  .dashboard_block { 
+    width:700px;
+    margin:auto;
+
+    .wll { 
+      border:none;
+      &:hover { 
+        background:none;
+      }
+
+      h4 {
+        color:#666;
+      }
+    }
+  }
+}
index 22630bc..b01e4d1 100644 (file)
           text-shadow: 0 1px 1px #FFF;
         }
 
-        img { 
-          float: left;
-          position: relative;
-          top: -9px;
-          width:46px;
+        &.home {
+          img { 
+            float: left;
+            position: relative;
+            top: -9px;
+            width:46px;
+
+          }
+        }
+        &.admin_link { 
+          width:16px;
+          height:16px;
+          padding: 5px;
+          border: 1px solid #ccc;
+          border-radius: 4px;
+          margin: 0px;
+          background: #eee;
+          margin-left:20px;
+          &:hover { 
+            background:#f7f7f7;
+          }
+          img { 
+            width:16px;
+          }
         }
       }
     }
index 6a8fd1c..ade8bee 100644 (file)
@@ -3,7 +3,14 @@ class DashboardController < ApplicationController
 
   def index
     @projects = current_user.projects.all
+
     @active_projects = @projects.select(&:repo_exists?).select(&:last_activity_date_cached).sort_by(&:last_activity_date_cached).reverse
+
+    @merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(10)
+
+    @user   = current_user
+    @issues = current_user.assigned_issues.opened.order("created_at DESC").limit(10)
+    @issues = @issues.includes(:author, :project)
   end
 
   # Get authored or assigned open merge requests
index 8171f59..228efa0 100644 (file)
@@ -1,17 +1,8 @@
-- @active_projects.first(3).each do |project|
-  = link_to project do 
-    %h4= project.name
-  - project.updates(3).each do |update|
-    %a.project-update{:href => dashboard_feed_path(project, update)}
-      = image_tag gravatar_icon(update.author_email), :class => "avatar", :width => 32
-      %div
-        = dashboard_feed_title(update)
-      %span.update-author
-        %strong= update.author_name
-        authored
-        = time_ago_in_words(update.created_at)
-        ago
-      .right
-        - klass = update.class.to_s.split("::").last.downcase
-        %span.tag{ :class => klass }= klass
-
+- @active_projects.first(10).each do |project|
+  .wll
+    = link_to project do 
+      %h4
+        = project.name
+        %small
+          last activity at 
+          = project.last_activity_date_cached.stamp("Aug 25, 2011")
index 3eba2f4..9d7cf6c 100644 (file)
@@ -1,3 +1,56 @@
-%h3 Activities
-%hr
-.news-feed= render "dashboard/projects_feed"
+- if current_user.require_ssh_key?
+  .alert-message.warning
+    %p  
+      You wont be able to pull/push project code unless you  
+      = link_to new_key_path, :class => "vlink" do 
+        add new key
+      to your profile
+
+%div.dashboard_category
+  %h3
+    Projects
+    %small
+      ( most recent )
+
+  %strong.right
+    = link_to projects_path do 
+      Projects list &rarr; 
+  %hr
+  .row
+    .dashboard_block
+      .row
+        .span9= render "dashboard/projects_feed"
+        .span3.right
+          - if current_user.can_create_project?
+            .alert-message.block-message.warning
+              You can create up to
+              = current_user.projects_limit
+              projects. Click on link below to add a new one
+              .link_holder
+                = link_to new_project_path, :class => "" do 
+                  New Project ยป 
+
+
+- unless @merge_requests.blank?
+  %div.dashboard_category
+    %h3
+      Merge Requests
+      %small ( authored or assigned to you )
+    %strong.right
+      = link_to dashboard_merge_requests_path do 
+        Vist merge requests page &rarr; 
+    %hr
+    .row
+      .dashboard_block= render "dashboard/merge_requests_feed"
+
+- unless @issues.blank?
+  %div.dashboard_category
+    %h3
+      Issues
+      %small ( assigned to you )
+    %strong.right
+      = link_to dashboard_merge_requests_path do 
+        Vist issues page &rarr; 
+    %hr
+    .row
+      .dashboard_block= render "dashboard/issues_feed"
index 6db447f..b9c467a 100644 (file)
@@ -2,5 +2,5 @@
   Issues
   %small ( assigned to you )
 
-%hr
-= render "dashboard/issues_feed"
+%br
+.ui-box= render "dashboard/issues_feed"
index 91dd690..ec1c233 100644 (file)
@@ -2,5 +2,5 @@
   Merge Requests
   %small ( authored or assigned to you )
 
-%hr
-= render "dashboard/merge_requests_feed"
+%br
+.ui-box= render "dashboard/merge_requests_feed"
index c42bb3e..27d9b45 100644 (file)
@@ -1,6 +1,6 @@
 %nav.main_menu
   = render "layouts/const_menu_links"
-  -#= link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path) || current_page?(root_path)}"
+  = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}"
   = link_to "Issues", dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide"
   = link_to "Requests", dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide"
   = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}"
index c0b971c..ffd028e 100644 (file)
@@ -1 +1 @@
-= 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"
index 1b62ecf..e0cc4ab 100644 (file)
@@ -5,7 +5,11 @@
       %div.app_logo
         = link_to root_path, :class => "home", :title => "Home" do 
           = image_tag "logo_tr.png", :width => 50
-          %h1 GITLAB
+          %h1 
+            GITLAB
+
+        = link_to admin_projects_path, :class => "admin_link", :title => "Admin area" do 
+          = image_tag "admin.PNG", :width => 16
 
       %h1.project_name= title
       .search= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input"
index f35d3fc..8a1739f 100644 (file)
@@ -7,6 +7,4 @@
     .container
       = render :partial => "layouts/app_menu"
       .content
-        .row
-          .span12= yield
-          .sidebar= render "layouts/projects_side"
+        = yield
index 6b48930..e49aa07 100644 (file)
@@ -1,4 +1,4 @@
-- @projects.in_groups_of(2, false) do |projects|
+- @projects.in_groups_of(3, false) do |projects|
   .row
     - projects.each_with_index do |project, i|
       %div.project_tile
index 32c4685..3838c33 100644 (file)
@@ -1,6 +1,10 @@
 %h3
   Projects
   %small= "( #{current_user.projects.count} )"
+  - if current_user.can_create_project?
+    %span.right
+      = link_to new_project_path, :class => "btn small" do 
+        New Project
 %hr
 - unless @projects.empty?
   %div.content_list= render "tile"
index 0f38009..77c2038 100644 (file)
@@ -123,5 +123,5 @@ Gitlab::Application.routes.draw do
     end
     resources :notes, :only => [:index, :create, :destroy]
   end
-  root :to => "projects#index"
+  root :to => "dashboard#index"
 end