Commit 5263dd4297e2ba71c40d74dcfb8511fec68e6620
1 parent
00028702
Exists in
master
and in
4 other branches
Events displayed on project page. \n Fixed theme issue. \n New issue, mr events enabled
Showing
13 changed files
with
153 additions
and
57 deletions
Show diff stats
app/assets/stylesheets/common.scss
@@ -610,6 +610,35 @@ p.time { | @@ -610,6 +610,35 @@ p.time { | ||
610 | .dashboard_category { | 610 | .dashboard_category { |
611 | margin-bottom:30px; | 611 | margin-bottom:30px; |
612 | 612 | ||
613 | + .ico { | ||
614 | + background: url("images.png") no-repeat -85px -77px; | ||
615 | + width: 19px; | ||
616 | + height: 16px; | ||
617 | + float: left; | ||
618 | + position: relative; | ||
619 | + margin-right: 10px; | ||
620 | + top: 8px; | ||
621 | + | ||
622 | + &.project { | ||
623 | + background-position: -37px -77px; | ||
624 | + } | ||
625 | + | ||
626 | + &.activities { | ||
627 | + background-position:-162px -22px; | ||
628 | + } | ||
629 | + &.projects { | ||
630 | + background-position:-209px -21px; | ||
631 | + } | ||
632 | + } | ||
633 | + | ||
634 | + | ||
635 | + h3 a { | ||
636 | + color:#474D57; | ||
637 | + | ||
638 | + &:hover { | ||
639 | + text-decoration:underline; | ||
640 | + } | ||
641 | + } | ||
613 | .dashboard_block { | 642 | .dashboard_block { |
614 | width:700px; | 643 | width:700px; |
615 | margin:auto; | 644 | margin:auto; |
@@ -625,20 +654,6 @@ p.time { | @@ -625,20 +654,6 @@ p.time { | ||
625 | h4 { | 654 | h4 { |
626 | color:#666; | 655 | color:#666; |
627 | } | 656 | } |
628 | - &.event_feed { | ||
629 | - min-height:40px; | ||
630 | - border-bottom:1px solid #eee; | ||
631 | - .avatar { | ||
632 | - width:32px; | ||
633 | - } | ||
634 | - ul { | ||
635 | - margin-left:50px; | ||
636 | - margin-bottom:5px; | ||
637 | - .avatar { | ||
638 | - width:24px; | ||
639 | - } | ||
640 | - } | ||
641 | - } | ||
642 | } | 657 | } |
643 | } | 658 | } |
644 | } | 659 | } |
@@ -651,3 +666,25 @@ p.time { | @@ -651,3 +666,25 @@ p.time { | ||
651 | -webkit-box-shadow: 0 0 5px#888; | 666 | -webkit-box-shadow: 0 0 5px#888; |
652 | box-shadow: 0 0 5px #888; | 667 | box-shadow: 0 0 5px #888; |
653 | } | 668 | } |
669 | + | ||
670 | +.event_feed { | ||
671 | + min-height:40px; | ||
672 | + border-bottom:1px solid #eee; | ||
673 | + .avatar { | ||
674 | + width:32px; | ||
675 | + } | ||
676 | + ul { | ||
677 | + margin-left:50px; | ||
678 | + margin-bottom:5px; | ||
679 | + .avatar { | ||
680 | + width:24px; | ||
681 | + } | ||
682 | + } | ||
683 | + | ||
684 | + padding: 10px 5px; | ||
685 | + border-bottom: 1px solid #eee; | ||
686 | + border-bottom: 1px solid rgba(0, 0, 0, 0.05); | ||
687 | + &:last-child { border:none } | ||
688 | + .wll:hover { background:none } | ||
689 | +} | ||
690 | + |
app/assets/stylesheets/ui_basic.scss
app/assets/stylesheets/ui_mars.scss
@@ -97,14 +97,13 @@ | @@ -97,14 +97,13 @@ | ||
97 | width:16px; | 97 | width:16px; |
98 | height:16px; | 98 | height:16px; |
99 | padding: 5px; | 99 | padding: 5px; |
100 | - border: 1px solid #888; | ||
101 | border-radius: 4px; | 100 | border-radius: 4px; |
102 | margin: 0px; | 101 | margin: 0px; |
103 | background:#474D57 ; | 102 | background:#474D57 ; |
104 | margin-left:20px; | 103 | margin-left:20px; |
105 | margin-top:4px; | 104 | margin-top:4px; |
106 | &:hover { | 105 | &:hover { |
107 | - background:#f7f7f7; | 106 | + background:#555; |
108 | } | 107 | } |
109 | img { | 108 | img { |
110 | width:16px; | 109 | width:16px; |
app/controllers/projects_controller.rb
@@ -68,8 +68,8 @@ class ProjectsController < ApplicationController | @@ -68,8 +68,8 @@ class ProjectsController < ApplicationController | ||
68 | 68 | ||
69 | def show | 69 | def show |
70 | return render "projects/empty" unless @project.repo_exists? && @project.has_commits? | 70 | return render "projects/empty" unless @project.repo_exists? && @project.has_commits? |
71 | - limit = (params[:limit] || 10).to_i | ||
72 | - @activities = @project.activities(limit) | 71 | + limit = (params[:limit] || 20).to_i |
72 | + @events = @project.events.recent.limit(limit) | ||
73 | end | 73 | end |
74 | 74 | ||
75 | def files | 75 | def files |
app/models/event.rb
@@ -21,9 +21,12 @@ class Event < ActiveRecord::Base | @@ -21,9 +21,12 @@ class Event < ActiveRecord::Base | ||
21 | end | 21 | end |
22 | end | 22 | end |
23 | 23 | ||
24 | - # For now only push events enabled for system | 24 | + # Next events currently enabled for system |
25 | + # - push | ||
26 | + # - new issue | ||
27 | + # - merge request | ||
25 | def allowed? | 28 | def allowed? |
26 | - push? | 29 | + push? || new_issue? || new_merge_request? |
27 | end | 30 | end |
28 | 31 | ||
29 | def push? | 32 | def push? |
@@ -49,6 +52,28 @@ class Event < ActiveRecord::Base | @@ -49,6 +52,28 @@ class Event < ActiveRecord::Base | ||
49 | def pusher | 52 | def pusher |
50 | User.find_by_id(data[:user_id]) | 53 | User.find_by_id(data[:user_id]) |
51 | end | 54 | end |
55 | + | ||
56 | + def new_issue? | ||
57 | + target_type == "Issue" && | ||
58 | + action == Created | ||
59 | + end | ||
60 | + | ||
61 | + def new_merge_request? | ||
62 | + target_type == "MergeRequest" && | ||
63 | + action == Created | ||
64 | + end | ||
65 | + | ||
66 | + def issue | ||
67 | + target if target_type == "Issue" | ||
68 | + end | ||
69 | + | ||
70 | + def merge_request | ||
71 | + target if target_type == "MergeRequest" | ||
72 | + end | ||
73 | + | ||
74 | + def author | ||
75 | + target.author | ||
76 | + end | ||
52 | 77 | ||
53 | def commits | 78 | def commits |
54 | @commits ||= data[:commits].map do |commit| | 79 | @commits ||= data[:commits].map do |commit| |
@@ -57,6 +82,9 @@ class Event < ActiveRecord::Base | @@ -57,6 +82,9 @@ class Event < ActiveRecord::Base | ||
57 | end | 82 | end |
58 | 83 | ||
59 | delegate :id, :name, :email, :to => :pusher, :prefix => true, :allow_nil => true | 84 | delegate :id, :name, :email, :to => :pusher, :prefix => true, :allow_nil => true |
85 | + delegate :name, :email, :to => :author, :prefix => true, :allow_nil => true | ||
86 | + delegate :title, :to => :issue, :prefix => true, :allow_nil => true | ||
87 | + delegate :title, :to => :merge_request, :prefix => true, :allow_nil => true | ||
60 | end | 88 | end |
61 | # == Schema Information | 89 | # == Schema Information |
62 | # | 90 | # |
app/views/dashboard/_projects_feed.html.haml
app/views/dashboard/index.html.haml
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | 8 | ||
9 | %div.dashboard_category | 9 | %div.dashboard_category |
10 | %h3 | 10 | %h3 |
11 | + %span.ico.projects | ||
11 | = link_to "Projects" , "#projects", :id => "projects" | 12 | = link_to "Projects" , "#projects", :id => "projects" |
12 | %small | 13 | %small |
13 | ( most recent ) | 14 | ( most recent ) |
@@ -59,6 +60,7 @@ | @@ -59,6 +60,7 @@ | ||
59 | - unless @events.blank? | 60 | - unless @events.blank? |
60 | %div.dashboard_category | 61 | %div.dashboard_category |
61 | %h3 | 62 | %h3 |
63 | + %span.ico.activities | ||
62 | = link_to "Activities" , "#activities", :id => "activities" | 64 | = link_to "Activities" , "#activities", :id => "activities" |
63 | 65 | ||
64 | %hr | 66 | %hr |
app/views/events/_event.html.haml
1 | - if event.allowed? | 1 | - if event.allowed? |
2 | - .wll.event_feed | ||
3 | - - if event.push? | ||
4 | - - if event.new_branch? | ||
5 | - = image_tag gravatar_icon(event.pusher_email), :class => "avatar" | ||
6 | - %strong #{event.pusher_name} | ||
7 | - pushed new branch | ||
8 | - = link_to project_commits_path(event.project, :ref => event.branch_name) do | ||
9 | - %strong= event.branch_name | ||
10 | - at | ||
11 | - %strong= link_to event.project.name, event.project | ||
12 | - %span.cgray | ||
13 | - = time_ago_in_words(event.created_at) | ||
14 | - ago. | ||
15 | - - else | ||
16 | - = image_tag gravatar_icon(event.pusher_email), :class => "avatar" | ||
17 | - %strong #{event.pusher_name} | ||
18 | - pushed to | ||
19 | - = link_to project_commits_path(event.project, :ref => event.branch_name) do | ||
20 | - %strong= event.branch_name | ||
21 | - at | ||
22 | - %strong= link_to event.project.name, event.project | ||
23 | - %span.cgray | ||
24 | - = time_ago_in_words(event.created_at) | ||
25 | - ago. | ||
26 | - - if event.commits.count > 1 | ||
27 | - = link_to compare_project_commits_path(event.project, :from => event.commits.first.prev_commit_id, :to => event.commits.last.id) do | ||
28 | - Compare #{event.commits.first.commit.id[0..8]}...#{event.commits.last.id[0..8]} | ||
29 | - - @project = event.project | ||
30 | - %ul.unstyled | ||
31 | - = render event.commits | ||
32 | - | 2 | + .event_feed |
3 | + - if event.new_issue? | ||
4 | + = render "events/event_new_issue", :event => event | ||
5 | + - if event.new_merge_request? | ||
6 | + = render "events/event_new_merge_request", :event => event | ||
7 | + - elsif event.push? | ||
8 | + = render "events/event_push", :event => event |
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | += image_tag gravatar_icon(event.author_email), :class => "avatar" | ||
2 | +%strong #{event.author_name} | ||
3 | +created new issue | ||
4 | += link_to project_issue_path(event.project, event.issue) do | ||
5 | + %strong= truncate event.issue_title | ||
6 | +at | ||
7 | +%strong= link_to event.project.name, event.project | ||
8 | +%span.cgray | ||
9 | + = time_ago_in_words(event.created_at) | ||
10 | + ago. |
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | += image_tag gravatar_icon(event.author_email), :class => "avatar" | ||
2 | +%strong #{event.author_name} | ||
3 | +requested merge | ||
4 | += link_to project_merge_request_path(event.project, event.merge_request) do | ||
5 | + %strong= truncate event.merge_request_title | ||
6 | +at | ||
7 | +%strong= link_to event.project.name, event.project | ||
8 | +%span.cgray | ||
9 | + = time_ago_in_words(event.created_at) | ||
10 | + ago. | ||
11 | +%br | ||
12 | +%span.label= event.merge_request.source_branch | ||
13 | +→ | ||
14 | +%span.label= event.merge_request.target_branch | ||
15 | + |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +- if event.new_branch? | ||
2 | + = image_tag gravatar_icon(event.pusher_email), :class => "avatar" | ||
3 | + %strong #{event.pusher_name} | ||
4 | + pushed new branch | ||
5 | + = link_to project_commits_path(event.project, :ref => event.branch_name) do | ||
6 | + %strong= event.branch_name | ||
7 | + at | ||
8 | + %strong= link_to event.project.name, event.project | ||
9 | + %span.cgray | ||
10 | + = time_ago_in_words(event.created_at) | ||
11 | + ago. | ||
12 | +- else | ||
13 | + = image_tag gravatar_icon(event.pusher_email), :class => "avatar" | ||
14 | + %strong #{event.pusher_name} | ||
15 | + pushed to | ||
16 | + = link_to project_commits_path(event.project, :ref => event.branch_name) do | ||
17 | + %strong= event.branch_name | ||
18 | + at | ||
19 | + %strong= link_to event.project.name, event.project | ||
20 | + %span.cgray | ||
21 | + = time_ago_in_words(event.created_at) | ||
22 | + ago. | ||
23 | + - if event.commits.count > 1 | ||
24 | + = link_to compare_project_commits_path(event.project, :from => event.commits.first.prev_commit_id, :to => event.commits.last.id) do | ||
25 | + Compare #{event.commits.first.commit.id[0..8]}...#{event.commits.last.id[0..8]} | ||
26 | + - @project = event.project | ||
27 | + %ul.unstyled | ||
28 | + = render event.commits | ||
29 | + | ||
30 | + |
app/views/layouts/admin.html.haml
1 | !!! 5 | 1 | !!! 5 |
2 | %html{ :lang => "en"} | 2 | %html{ :lang => "en"} |
3 | = render "layouts/head" | 3 | = render "layouts/head" |
4 | - %body.ui_basic.admin | 4 | + %body{:class => "#{app_theme} admin"} |
5 | = render "layouts/flash" | 5 | = render "layouts/flash" |
6 | = render "layouts/head_panel", :title => "Admin area" | 6 | = render "layouts/head_panel", :title => "Admin area" |
7 | .container | 7 | .container |
app/views/projects/show.html.haml
@@ -14,9 +14,8 @@ | @@ -14,9 +14,8 @@ | ||
14 | = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url" | 14 | = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url" |
15 | 15 | ||
16 | = simple_format @project.description | 16 | = simple_format @project.description |
17 | -- unless @activities.blank? | ||
18 | - .ui-box | ||
19 | - %h5.cgray Recent Activity | ||
20 | - .content_list= render "feed" | 17 | +- unless @events.blank? |
18 | + %h5.cgray Recent Activity | ||
19 | + .content_list= render @events | ||
21 | 20 | ||
22 | 21 |