Skip to content
Snippets Groups Projects
Commit 5263dd42 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Events displayed on project page. \n Fixed theme issue. \n New issue, mr events enabled

parent 00028702
No related branches found
No related tags found
No related merge requests found
Loading
@@ -610,6 +610,35 @@ p.time {
Loading
@@ -610,6 +610,35 @@ p.time {
.dashboard_category { .dashboard_category {
margin-bottom:30px; margin-bottom:30px;
   
.ico {
background: url("images.png") no-repeat -85px -77px;
width: 19px;
height: 16px;
float: left;
position: relative;
margin-right: 10px;
top: 8px;
&.project {
background-position: -37px -77px;
}
&.activities {
background-position:-162px -22px;
}
&.projects {
background-position:-209px -21px;
}
}
h3 a {
color:#474D57;
&:hover {
text-decoration:underline;
}
}
.dashboard_block { .dashboard_block {
width:700px; width:700px;
margin:auto; margin:auto;
Loading
@@ -625,20 +654,6 @@ p.time {
Loading
@@ -625,20 +654,6 @@ p.time {
h4 { h4 {
color:#666; color:#666;
} }
&.event_feed {
min-height:40px;
border-bottom:1px solid #eee;
.avatar {
width:32px;
}
ul {
margin-left:50px;
margin-bottom:5px;
.avatar {
width:24px;
}
}
}
} }
} }
} }
Loading
@@ -651,3 +666,25 @@ p.time {
Loading
@@ -651,3 +666,25 @@ p.time {
-webkit-box-shadow: 0 0 5px#888; -webkit-box-shadow: 0 0 5px#888;
box-shadow: 0 0 5px #888; box-shadow: 0 0 5px #888;
} }
.event_feed {
min-height:40px;
border-bottom:1px solid #eee;
.avatar {
width:32px;
}
ul {
margin-left:50px;
margin-bottom:5px;
.avatar {
width:24px;
}
}
padding: 10px 5px;
border-bottom: 1px solid #eee;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
&:last-child { border:none }
.wll:hover { background:none }
}
Loading
@@ -70,7 +70,6 @@
Loading
@@ -70,7 +70,6 @@
width:16px; width:16px;
height:16px; height:16px;
padding: 5px; padding: 5px;
border: 1px solid #ccc;
border-radius: 4px; border-radius: 4px;
margin: 0px; margin: 0px;
background: #eee; background: #eee;
Loading
Loading
Loading
@@ -97,14 +97,13 @@
Loading
@@ -97,14 +97,13 @@
width:16px; width:16px;
height:16px; height:16px;
padding: 5px; padding: 5px;
border: 1px solid #888;
border-radius: 4px; border-radius: 4px;
margin: 0px; margin: 0px;
background:#474D57 ; background:#474D57 ;
margin-left:20px; margin-left:20px;
margin-top:4px; margin-top:4px;
&:hover { &:hover {
background:#f7f7f7; background:#555;
} }
img { img {
width:16px; width:16px;
Loading
Loading
Loading
@@ -68,8 +68,8 @@ class ProjectsController < ApplicationController
Loading
@@ -68,8 +68,8 @@ class ProjectsController < ApplicationController
   
def show def show
return render "projects/empty" unless @project.repo_exists? && @project.has_commits? return render "projects/empty" unless @project.repo_exists? && @project.has_commits?
limit = (params[:limit] || 10).to_i limit = (params[:limit] || 20).to_i
@activities = @project.activities(limit) @events = @project.events.recent.limit(limit)
end end
   
def files def files
Loading
Loading
Loading
@@ -21,9 +21,12 @@ class Event < ActiveRecord::Base
Loading
@@ -21,9 +21,12 @@ class Event < ActiveRecord::Base
end end
end end
   
# For now only push events enabled for system # Next events currently enabled for system
# - push
# - new issue
# - merge request
def allowed? def allowed?
push? push? || new_issue? || new_merge_request?
end end
   
def push? def push?
Loading
@@ -49,6 +52,28 @@ class Event < ActiveRecord::Base
Loading
@@ -49,6 +52,28 @@ class Event < ActiveRecord::Base
def pusher def pusher
User.find_by_id(data[:user_id]) User.find_by_id(data[:user_id])
end end
def new_issue?
target_type == "Issue" &&
action == Created
end
def new_merge_request?
target_type == "MergeRequest" &&
action == Created
end
def issue
target if target_type == "Issue"
end
def merge_request
target if target_type == "MergeRequest"
end
def author
target.author
end
def commits def commits
@commits ||= data[:commits].map do |commit| @commits ||= data[:commits].map do |commit|
Loading
@@ -57,6 +82,9 @@ class Event < ActiveRecord::Base
Loading
@@ -57,6 +82,9 @@ class Event < ActiveRecord::Base
end end
   
delegate :id, :name, :email, :to => :pusher, :prefix => true, :allow_nil => true delegate :id, :name, :email, :to => :pusher, :prefix => true, :allow_nil => true
delegate :name, :email, :to => :author, :prefix => true, :allow_nil => true
delegate :title, :to => :issue, :prefix => true, :allow_nil => true
delegate :title, :to => :merge_request, :prefix => true, :allow_nil => true
end end
# == Schema Information # == Schema Information
# #
Loading
Loading
Loading
@@ -2,6 +2,7 @@
Loading
@@ -2,6 +2,7 @@
.wll .wll
= link_to project do = link_to project do
%h4 %h4
%span.ico.project
= project.name = project.name
%small %small
last activity at last activity at
Loading
Loading
Loading
@@ -8,6 +8,7 @@
Loading
@@ -8,6 +8,7 @@
   
%div.dashboard_category %div.dashboard_category
%h3 %h3
%span.ico.projects
= link_to "Projects" , "#projects", :id => "projects" = link_to "Projects" , "#projects", :id => "projects"
%small %small
( most recent ) ( most recent )
Loading
@@ -59,6 +60,7 @@
Loading
@@ -59,6 +60,7 @@
- unless @events.blank? - unless @events.blank?
%div.dashboard_category %div.dashboard_category
%h3 %h3
%span.ico.activities
= link_to "Activities" , "#activities", :id => "activities" = link_to "Activities" , "#activities", :id => "activities"
   
%hr %hr
Loading
Loading
- if event.allowed? - if event.allowed?
.wll.event_feed .event_feed
- if event.push? - if event.new_issue?
- if event.new_branch? = render "events/event_new_issue", :event => event
= image_tag gravatar_icon(event.pusher_email), :class => "avatar" - if event.new_merge_request?
%strong #{event.pusher_name} = render "events/event_new_merge_request", :event => event
pushed new branch - elsif event.push?
= link_to project_commits_path(event.project, :ref => event.branch_name) do = render "events/event_push", :event => event
%strong= event.branch_name
at
%strong= link_to event.project.name, event.project
%span.cgray
= time_ago_in_words(event.created_at)
ago.
- else
= image_tag gravatar_icon(event.pusher_email), :class => "avatar"
%strong #{event.pusher_name}
pushed to
= link_to project_commits_path(event.project, :ref => event.branch_name) do
%strong= event.branch_name
at
%strong= link_to event.project.name, event.project
%span.cgray
= time_ago_in_words(event.created_at)
ago.
- if event.commits.count > 1
= link_to compare_project_commits_path(event.project, :from => event.commits.first.prev_commit_id, :to => event.commits.last.id) do
Compare #{event.commits.first.commit.id[0..8]}...#{event.commits.last.id[0..8]}
- @project = event.project
%ul.unstyled
= render event.commits
= image_tag gravatar_icon(event.author_email), :class => "avatar"
%strong #{event.author_name}
created new issue
= link_to project_issue_path(event.project, event.issue) do
%strong= truncate event.issue_title
at
%strong= link_to event.project.name, event.project
%span.cgray
= time_ago_in_words(event.created_at)
ago.
= image_tag gravatar_icon(event.author_email), :class => "avatar"
%strong #{event.author_name}
requested merge
= link_to project_merge_request_path(event.project, event.merge_request) do
%strong= truncate event.merge_request_title
at
%strong= link_to event.project.name, event.project
%span.cgray
= time_ago_in_words(event.created_at)
ago.
%br
%span.label= event.merge_request.source_branch
&rarr;
%span.label= event.merge_request.target_branch
- if event.new_branch?
= image_tag gravatar_icon(event.pusher_email), :class => "avatar"
%strong #{event.pusher_name}
pushed new branch
= link_to project_commits_path(event.project, :ref => event.branch_name) do
%strong= event.branch_name
at
%strong= link_to event.project.name, event.project
%span.cgray
= time_ago_in_words(event.created_at)
ago.
- else
= image_tag gravatar_icon(event.pusher_email), :class => "avatar"
%strong #{event.pusher_name}
pushed to
= link_to project_commits_path(event.project, :ref => event.branch_name) do
%strong= event.branch_name
at
%strong= link_to event.project.name, event.project
%span.cgray
= time_ago_in_words(event.created_at)
ago.
- if event.commits.count > 1
= link_to compare_project_commits_path(event.project, :from => event.commits.first.prev_commit_id, :to => event.commits.last.id) do
Compare #{event.commits.first.commit.id[0..8]}...#{event.commits.last.id[0..8]}
- @project = event.project
%ul.unstyled
= render event.commits
!!! 5 !!! 5
%html{ :lang => "en"} %html{ :lang => "en"}
= render "layouts/head" = render "layouts/head"
%body.ui_basic.admin %body{:class => "#{app_theme} admin"}
= render "layouts/flash" = render "layouts/flash"
= render "layouts/head_panel", :title => "Admin area" = render "layouts/head_panel", :title => "Admin area"
.container .container
Loading
Loading
Loading
@@ -14,9 +14,8 @@
Loading
@@ -14,9 +14,8 @@
= text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url" = text_field_tag :project_clone, @project.url_to_repo, :class => "xlarge one_click_select git_clone_url"
   
= simple_format @project.description = simple_format @project.description
- unless @activities.blank? - unless @events.blank?
.ui-box %h5.cgray Recent Activity
%h5.cgray Recent Activity .content_list= render @events
.content_list= render "feed"
   
   
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment