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 3 color: $link_color;
4 4 &:hover {
5 5 text-decoration:none;
6   - color: $style_color;
  6 + color: $blue_link;
7 7 }
8 8  
9 9 &.btn {
... ... @@ -838,12 +838,19 @@ p.time {
838 838 width:840px;
839 839 margin:auto;
840 840  
841   - .wll {
842   - padding:5px;
843   - margin-top:5px;
  841 + .dash_project_item {
  842 + margin-bottom:10px;
844 843 border:none;
845 844 &:hover {
846 845 background:none;
  846 +
  847 + h4 {
  848 + color:#2FA0BB;
  849 + .arrow {
  850 + background:#2FA0BB;
  851 + color:#fff;
  852 + }
  853 + }
847 854 }
848 855  
849 856 h4 {
... ... @@ -988,3 +995,14 @@ p.time {
988 995 .merge_request_status_holder {
989 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 15 $bg_color: #FFF;
16 16 $styled_border_color: #2FA0BB;
17 17 $color: "#4BB8D2";
18   -$blue_link: "#2fa0bb";
  18 +$blue_link: #2fa0bb;
19 19  
20 20  
21 21 /** Style colors **/
... ...
app/assets/stylesheets/ui_basic.scss
... ... @@ -17,7 +17,7 @@
17 17 color: $link_color;
18 18 &:hover {
19 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 34 format.atom { render :layout => false }
35 35 end
36 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 42 end
... ...
app/views/dashboard/_events_feed.html.haml
... ... @@ -1,2 +0,0 @@
1   -= render @events
2   -
app/views/dashboard/_issues_feed.html.haml
... ... @@ -3,8 +3,10 @@
3 3 = link_to [issue.project, issue] do
4 4 %p
5 5 %strong
6   - %span.label= issue.project.name
  6 + %span.pretty_label= issue.project.name
7 7 –
8 8 Issue #
9 9 = issue.id
10 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 3 = link_to [merge_request.project, merge_request] do
4 4 %p
5 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 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 1 - projects.first(5).each do |project|
2   - .wll
  2 + %div.dash_project_item
3 3 = link_to project do
4 4 %h4
5 5 %span.ico.project
... ... @@ -7,3 +7,5 @@
7 7 %small
8 8 last activity at
9 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 @@
  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 62 %h3
63 63 %span.ico.activities
64 64 = link_to "Activities" , "#activities", :id => "activities"
  65 + %strong.right
  66 + = link_to dashboard_activities_path do
  67 + Visit activities page →
65 68  
66 69 %hr
67 70 .row
68   - .dashboard_block= render "dashboard/events_feed"
  71 + .dashboard_block= render @events
... ...
app/views/layouts/_app_menu.html.haml
1 1 %nav.main_menu
2 2 = render "layouts/const_menu_links"
3 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 5 = link_to dashboard_issues_path, :class => "#{"current" if current_page?(dashboard_issues_path)}", :id => "issues_slide" do
6 6 Issues
7 7 %span.count= current_user.assigned_issues.opened.count
8 8 = link_to dashboard_merge_requests_path, :class => "#{"current" if current_page?(dashboard_merge_requests_path)}", :id => "merge_requests_slide" do
9 9 Requests
10 10 %span.count= current_user.cared_merge_requests.count
  11 + = link_to "Search", search_path, :class => "#{"current" if current_page?(search_path)}"
11 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 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 2 = @project.name
3 3 %br
4 4 %div
... ...
app/views/projects/empty.html.haml
... ... @@ -6,7 +6,7 @@
6 6 %li Visit profile → keys and add public key of every machine you want to use for work with gitlabhq.
7 7  
8 8 .alert-message.block-message.error
9   - %ul.alert_holder
  9 + %ul.unstyled.alert_holder
10 10 %li You should push repository to proceed.
11 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 21 = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url"
22 22  
23 23 - if @project.description.present?
24   - = markdown @project.description
  24 + .prettyprint= markdown @project.description
25 25 - unless @events.blank?
26   - %h5.cgray Recent Activity
  26 + %br
  27 + %h5.cgray
  28 + %span.ico.activities
  29 + Recent Activity
  30 + %hr
27 31 .content_list= render @events
28 32  
29 33  
... ...
config/routes.rb
... ... @@ -40,6 +40,7 @@ Gitlab::Application.routes.draw do
40 40 get "dashboard", :to => "dashboard#index"
41 41 get "dashboard/issues", :to => "dashboard#issues"
42 42 get "dashboard/merge_requests", :to => "dashboard#merge_requests"
  43 + get "dashboard/activities", :to => "dashboard#activities"
43 44  
44 45 #get "profile/:id", :to => "profile#show"
45 46  
... ...
spec/requests/dashboard_spec.rb
1 1 require 'spec_helper'
2   -__END__
3   -# Disabled for now
4 2 describe "Dashboard" do
5 3 before do
6 4 @project = Factory :project
... ... @@ -22,19 +20,21 @@ describe "Dashboard" do
22 20 end
23 21  
24 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 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 39 end
40 40 end
... ...