Commit 724ea16c348bc61cf7cb3dbe362c6f30cff1b2c7

Authored by Dmitriy Zaporozhets
1 parent d87abbe9

Activities page added. Dashboard few specs. Preparing for 2.3

app/assets/stylesheets/common.scss
@@ -3,7 +3,7 @@ a { @@ -3,7 +3,7 @@ a {
3 color: $link_color; 3 color: $link_color;
4 &:hover { 4 &:hover {
5 text-decoration:none; 5 text-decoration:none;
6 - color: $style_color; 6 + color: $blue_link;
7 } 7 }
8 8
9 &.btn { 9 &.btn {
@@ -838,12 +838,19 @@ p.time { @@ -838,12 +838,19 @@ p.time {
838 width:840px; 838 width:840px;
839 margin:auto; 839 margin:auto;
840 840
841 - .wll {  
842 - padding:5px;  
843 - margin-top:5px; 841 + .dash_project_item {
  842 + margin-bottom:10px;
844 border:none; 843 border:none;
845 &:hover { 844 &:hover {
846 background:none; 845 background:none;
  846 +
  847 + h4 {
  848 + color:#2FA0BB;
  849 + .arrow {
  850 + background:#2FA0BB;
  851 + color:#fff;
  852 + }
  853 + }
847 } 854 }
848 855
849 h4 { 856 h4 {
@@ -988,3 +995,14 @@ p.time { @@ -988,3 +995,14 @@ p.time {
988 .merge_request_status_holder { 995 .merge_request_status_holder {
989 margin-bottom:20px; 996 margin-bottom:20px;
990 } 997 }
  998 +
  999 +.arrow{
  1000 + float: right;
  1001 + background: #E3E5EA;
  1002 + padding: 10px;
  1003 + border-radius: 5px;
  1004 + text-shadow: none;
  1005 + color: #999;
  1006 + line-height: 16px;
  1007 + font-weight:bold;
  1008 +}
app/assets/stylesheets/main.scss
@@ -15,7 +15,7 @@ $app_padding:20px; @@ -15,7 +15,7 @@ $app_padding:20px;
15 $bg_color: #FFF; 15 $bg_color: #FFF;
16 $styled_border_color: #2FA0BB; 16 $styled_border_color: #2FA0BB;
17 $color: "#4BB8D2"; 17 $color: "#4BB8D2";
18 -$blue_link: "#2fa0bb"; 18 +$blue_link: #2fa0bb;
19 19
20 20
21 /** Style colors **/ 21 /** Style colors **/
app/assets/stylesheets/ui_basic.scss
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 color: $link_color; 17 color: $link_color;
18 &:hover { 18 &:hover {
19 text-decoration:none; 19 text-decoration:none;
20 - color: $style_color; 20 + color: $blue_link;
21 } 21 }
22 } 22 }
23 23
app/controllers/dashboard_controller.rb
@@ -34,4 +34,9 @@ class DashboardController < ApplicationController @@ -34,4 +34,9 @@ class DashboardController < ApplicationController
34 format.atom { render :layout => false } 34 format.atom { render :layout => false }
35 end 35 end
36 end 36 end
  37 +
  38 + def activities
  39 + @projects = current_user.projects.all
  40 + @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(40)
  41 + end
37 end 42 end
app/views/dashboard/_events_feed.html.haml
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -= render @events  
2 -  
app/views/dashboard/_issues_feed.html.haml
@@ -3,8 +3,10 @@ @@ -3,8 +3,10 @@
3 = link_to [issue.project, issue] do 3 = link_to [issue.project, issue] do
4 %p 4 %p
5 %strong 5 %strong
6 - %span.label= issue.project.name 6 + %span.pretty_label= issue.project.name
7 – 7 –
8 Issue # 8 Issue #
9 = issue.id 9 = issue.id
10 = truncate issue.title, :length => 50 10 = truncate issue.title, :length => 50
  11 + %span.right.cgray
  12 + = issue.updated_at.stamp("Aug 21, 2011")
app/views/dashboard/_merge_requests_feed.html.haml
@@ -3,8 +3,9 @@ @@ -3,8 +3,9 @@
3 = link_to [merge_request.project, merge_request] do 3 = link_to [merge_request.project, merge_request] do
4 %p 4 %p
5 %strong 5 %strong
6 - %span.label= merge_request.project.name 6 + %span.pretty_label= merge_request.project.name
7 – 7 –
8 - Merge Request #  
9 - = merge_request.id 8 + Merge Request ##{merge_request.id}
10 = truncate merge_request.title, :length => 50 9 = truncate merge_request.title, :length => 50
  10 + %span.right.cgray
  11 + = merge_request.updated_at.stamp("Aug 21, 2011")
app/views/dashboard/_projects_feed.html.haml
1 - projects.first(5).each do |project| 1 - projects.first(5).each do |project|
2 - .wll 2 + %div.dash_project_item
3 = link_to project do 3 = link_to project do
4 %h4 4 %h4
5 %span.ico.project 5 %span.ico.project
@@ -7,3 +7,5 @@ @@ -7,3 +7,5 @@
7 %small 7 %small
8 last activity at 8 last activity at
9 = project.last_activity_date.stamp("Aug 25, 2011") 9 = project.last_activity_date.stamp("Aug 25, 2011")
  10 + %span.right.arrow
  11 + →
app/views/dashboard/activities.html.haml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +- if @events.any?
  2 + %div.dashboard_category
  3 + %h3
  4 + %span.ico.activities
  5 + = link_to "Activities" , "#activities", :id => "activities"
  6 +
  7 + %hr
  8 + = render @events
  9 +- else
  10 + %h3 Nothing here
app/views/dashboard/index.html.haml
@@ -62,7 +62,10 @@ @@ -62,7 +62,10 @@
62 %h3 62 %h3
63 %span.ico.activities 63 %span.ico.activities
64 = link_to "Activities" , "#activities", :id => "activities" 64 = link_to "Activities" , "#activities", :id => "activities"
  65 + %strong.right
  66 + = link_to dashboard_activities_path do
  67 + Visit activities page →
65 68
66 %hr 69 %hr
67 .row 70 .row
68 - .dashboard_block= render "dashboard/events_feed" 71 + .dashboard_block= render @events
app/views/layouts/_app_menu.html.haml
1 %nav.main_menu 1 %nav.main_menu
2 = render "layouts/const_menu_links" 2 = render "layouts/const_menu_links"
3 = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}" 3 = link_to "Projects", projects_path, :class => "#{"current" if current_page?(projects_path)}"
4 - = link_to "Search", search_path, :class => "#{"current" if current_page?(search_path)}" 4 + = link_to "Activities", dashboard_activities_path, :class => "#{"current" if current_page?(dashboard_activities_path)}"
5 = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do 5 = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do
6 Issues 6 Issues
7 %span.count= current_user.assigned_issues.opened.count 7 %span.count= current_user.assigned_issues.opened.count
8 = link_to dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" do 8 = link_to dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" do
9 Requests 9 Requests
10 %span.count= current_user.cared_merge_requests.count 10 %span.count= current_user.cared_merge_requests.count
  11 + = link_to "Search", search_path, :class => "#{"current" if current_page?(search_path)}"
11 = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}" 12 = link_to "Help", help_path, :class => "#{"current" if controller.controller_name == "help"}"
app/views/profile/password.html.haml
1 -%h3 Password  
2 -%hr  
3 -= form_for @user, :url => profile_password_path, :method => :put do |f|  
4 - .data  
5 - .alert-message.block-message.warning  
6 - %p After successfull password update you will be redirected to login page where you should login with new password  
7 - -if @user.errors.any?  
8 - .alert-message.block-message.error  
9 - %ul  
10 - - @user.errors.full_messages.each do |msg|  
11 - %li= msg 1 +.row
  2 + .span8
  3 + %h3 Password
  4 + %hr
  5 + = form_for @user, :url => profile_password_path, :method => :put do |f|
  6 + .data
  7 + .alert-message.block-message.warning
  8 + %p After successfull password update you will be redirected to login page where you should login with new password
  9 + -if @user.errors.any?
  10 + .alert-message.block-message.error
  11 + %ul
  12 + - @user.errors.full_messages.each do |msg|
  13 + %li= msg
  14 +
  15 + .clearfix
  16 + = f.label :password
  17 + .input= f.password_field :password
  18 + .clearfix
  19 + = f.label :password_confirmation
  20 + .input= f.password_field :password_confirmation
  21 + .actions
  22 + = f.submit 'Save', :class => "btn"
12 23
13 - .clearfix  
14 - = f.label :password  
15 - .input= f.password_field :password  
16 - .clearfix  
17 - = f.label :password_confirmation  
18 - .input= f.password_field :password_confirmation  
19 - .actions  
20 - = f.submit 'Save', :class => "btn"  
21 -  
22 -%h3  
23 - Private token  
24 - %span.cred.right  
25 - keep it in secret!  
26 -%hr  
27 -= form_for @user, :url => profile_reset_private_token_path, :method => :put do |f|  
28 - .data  
29 - %p Private token used to access application resources without authentication.  
30 - %p For example its required to access commits feed. 24 + .span7.right
  25 + %h3
  26 + Private token
  27 + %span.cred.right
  28 + keep it in secret!
31 %hr 29 %hr
32 - %p.cgray  
33 - - if current_user.private_token  
34 - = text_field_tag "token", current_user.private_token  
35 - - else  
36 - You don`t have one yet. Click generate to fix it.  
37 - .actions  
38 - - if current_user.private_token  
39 - = f.submit 'Reset', :confirm => "Are you sure?", :class => "btn"  
40 - - else  
41 - = f.submit 'Generate', :class => "btn" 30 + = form_for @user, :url => profile_reset_private_token_path, :method => :put do |f|
  31 + .data
  32 + .alert-message.block-message.warning
  33 + %p Private token used to access application resources without authentication.
  34 + %hr
  35 + %p * required for rss feed
  36 + %p.cgray
  37 + - if current_user.private_token
  38 + = text_field_tag "token", current_user.private_token
  39 + - else
  40 + You don`t have one yet. Click generate to fix it.
  41 + .actions
  42 + - if current_user.private_token
  43 + = f.submit 'Reset', :confirm => "Are you sure?", :class => "btn"
  44 + - else
  45 + = f.submit 'Generate', :class => "btn"
42 46
app/views/projects/_show.html.haml
1 -%h4.title 1 +%h5.title
2 = @project.name 2 = @project.name
3 %br 3 %br
4 %div 4 %div
app/views/projects/empty.html.haml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 %li Visit profile → keys and add public key of every machine you want to use for work with gitlabhq. 6 %li Visit profile → keys and add public key of every machine you want to use for work with gitlabhq.
7 7
8 .alert-message.block-message.error 8 .alert-message.block-message.error
9 - %ul.alert_holder 9 + %ul.unstyled.alert_holder
10 %li You should push repository to proceed. 10 %li You should push repository to proceed.
11 %li After push you will be able to browse code, commits etc. 11 %li After push you will be able to browse code, commits etc.
12 12
app/views/projects/show.html.haml
@@ -21,9 +21,13 @@ @@ -21,9 +21,13 @@
21 = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url" 21 = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url"
22 22
23 - if @project.description.present? 23 - if @project.description.present?
24 - = markdown @project.description 24 + .prettyprint= markdown @project.description
25 - unless @events.blank? 25 - unless @events.blank?
26 - %h5.cgray Recent Activity 26 + %br
  27 + %h5.cgray
  28 + %span.ico.activities
  29 + Recent Activity
  30 + %hr
27 .content_list= render @events 31 .content_list= render @events
28 32
29 33
config/routes.rb
@@ -40,6 +40,7 @@ Gitlab::Application.routes.draw do @@ -40,6 +40,7 @@ Gitlab::Application.routes.draw do
40 get "dashboard", :to => "dashboard#index" 40 get "dashboard", :to => "dashboard#index"
41 get "dashboard/issues", :to => "dashboard#issues" 41 get "dashboard/issues", :to => "dashboard#issues"
42 get "dashboard/merge_requests", :to => "dashboard#merge_requests" 42 get "dashboard/merge_requests", :to => "dashboard#merge_requests"
  43 + get "dashboard/activities", :to => "dashboard#activities"
43 44
44 #get "profile/:id", :to => "profile#show" 45 #get "profile/:id", :to => "profile#show"
45 46
spec/requests/dashboard_spec.rb
1 require 'spec_helper' 1 require 'spec_helper'
2 -__END__  
3 -# Disabled for now  
4 describe "Dashboard" do 2 describe "Dashboard" do
5 before do 3 before do
6 @project = Factory :project 4 @project = Factory :project
@@ -22,19 +20,21 @@ describe "Dashboard" do @@ -22,19 +20,21 @@ describe "Dashboard" do
22 end 20 end
23 21
24 it "should have projects panel" do 22 it "should have projects panel" do
25 - within ".project-list" do  
26 - page.should have_content(@project.name)  
27 - end 23 + page.should have_content(@project.name)
28 end 24 end
  25 + end
29 26
30 - # Temporary disabled cause of travis  
31 - # TODO: fix or rewrite  
32 - #it "should have news feed" do  
33 - #within "#news-feed" do  
34 - #page.should have_content("commit")  
35 - #page.should have_content(@project.commit.author.name)  
36 - #page.should have_content(@project.commit.safe_message)  
37 - #end  
38 - #end 27 + describe "GET /dashboard/activities" do
  28 + before do
  29 + visit dashboard_activities_path
  30 + end
  31 +
  32 + it "should be on dashboard page" do
  33 + current_path.should == dashboard_activities_path
  34 + end
  35 +
  36 + it "should have projects panel" do
  37 + page.should have_content(@project.name)
  38 + end
39 end 39 end
40 end 40 end