Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
a6dfd065
Commit
a6dfd065
authored
Apr 21, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add atom feed for project activity.
parent
72b090b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
8 deletions
+40
-8
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+13
-5
app/views/projects/show.atom.builder
app/views/projects/show.atom.builder
+12
-0
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+12
-0
config/routes.rb
config/routes.rb
+3
-3
No files found.
app/controllers/projects_controller.rb
View file @
a6dfd065
...
@@ -66,8 +66,6 @@ class ProjectsController < ApplicationController
...
@@ -66,8 +66,6 @@ class ProjectsController < ApplicationController
return
return
end
end
limit
=
(
params
[
:limit
]
||
20
).
to_i
@show_star
=
!
(
current_user
&&
current_user
.
starred?
(
@project
))
@show_star
=
!
(
current_user
&&
current_user
.
starred?
(
@project
))
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -85,11 +83,14 @@ class ProjectsController < ApplicationController
...
@@ -85,11 +83,14 @@ class ProjectsController < ApplicationController
end
end
format
.
json
do
format
.
json
do
@events
=
@project
.
events
.
recent
load_events
@events
=
event_filter
.
apply_filter
(
@events
).
with_associations
@events
=
@events
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
pager_json
(
'events/_events'
,
@events
.
count
)
pager_json
(
'events/_events'
,
@events
.
count
)
end
end
format
.
atom
do
load_events
render
layout:
false
end
end
end
end
end
...
@@ -167,6 +168,13 @@ class ProjectsController < ApplicationController
...
@@ -167,6 +168,13 @@ class ProjectsController < ApplicationController
current_user
?
'projects'
:
'public_projects'
current_user
?
'projects'
:
'public_projects'
end
end
def
load_events
@events
=
@project
.
events
.
recent
@events
=
event_filter
.
apply_filter
(
@events
).
with_associations
limit
=
(
params
[
:limit
]
||
20
).
to_i
@events
=
@events
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
end
def
project_params
def
project_params
params
.
require
(
:project
).
permit
(
params
.
require
(
:project
).
permit
(
:name
,
:path
,
:description
,
:issues_tracker
,
:tag_list
,
:name
,
:path
,
:description
,
:issues_tracker
,
:tag_list
,
...
...
app/views/projects/show.atom.builder
0 → 100644
View file @
a6dfd065
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "Project feed - #{@project.name}"
xml.link href: namespace_project_path(@project.namespace, @project, :atom), rel: "self", type: "application/atom+xml"
xml.link href: namespace_project_path(@project.namespace, @project), rel: "alternate", type: "text/html"
xml.id projects_url
xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
@events.each do |event|
event_to_atom(xml, event)
end
end
app/views/projects/show.html.haml
View file @
a6dfd065
=
content_for
:meta_tags
do
-
if
current_user
=
auto_discovery_link_tag
(
:atom
,
namespace_project_path
(
@project
.
namespace
,
@project
,
format: :atom
,
private_token:
current_user
.
private_token
),
title:
"
#{
@group
.
name
}
activity"
)
-
if
current_user
&&
can?
(
current_user
,
:download_code
,
@project
)
-
if
current_user
&&
can?
(
current_user
,
:download_code
,
@project
)
=
render
'shared/no_ssh'
=
render
'shared/no_ssh'
=
render
'shared/no_password'
=
render
'shared/no_password'
...
@@ -39,6 +43,14 @@
...
@@ -39,6 +43,14 @@
%i
.fa.fa-angle-left
%i
.fa.fa-angle-left
%section
.col-md-9
%section
.col-md-9
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
-
if
current_user
%ul
.nav.nav-pills.event_filter.pull-right
%li
=
link_to
namespace_project_path
(
@project
.
namespace
,
@project
,
format: :atom
,
private_token:
current_user
.
private_token
),
title:
"Feed"
,
class:
'rss-btn'
do
%i
.fa.fa-rss
News Feed
=
render
'shared/event_filter'
=
render
'shared/event_filter'
%hr
%hr
.content_list
.content_list
...
...
config/routes.rb
View file @
a6dfd065
...
@@ -236,7 +236,7 @@ Gitlab::Application.routes.draw do
...
@@ -236,7 +236,7 @@ Gitlab::Application.routes.draw do
constraints:
{
username:
/.*/
}
constraints:
{
username:
/.*/
}
get
'/u/:username'
=>
'users#show'
,
as: :user
,
get
'/u/:username'
=>
'users#show'
,
as: :user
,
constraints:
{
username:
/
(?:[^.]|\.(?!atom$))+/
,
format:
/atom
/
}
constraints:
{
username:
/
[a-zA-Z.0-9_\-]+(?<!\.atom)
/
}
#
#
# Dashboard Area
# Dashboard Area
...
@@ -263,7 +263,7 @@ Gitlab::Application.routes.draw do
...
@@ -263,7 +263,7 @@ Gitlab::Application.routes.draw do
#
#
# Groups Area
# Groups Area
#
#
resources
:groups
,
constraints:
{
id:
/
(?:[^.]|\.(?!atom$))+/
,
format:
/atom
/
}
do
resources
:groups
,
constraints:
{
id:
/
[a-zA-Z.0-9_\-]+(?<!\.atom)
/
}
do
member
do
member
do
get
:issues
get
:issues
get
:merge_requests
get
:merge_requests
...
@@ -295,7 +295,7 @@ Gitlab::Application.routes.draw do
...
@@ -295,7 +295,7 @@ Gitlab::Application.routes.draw do
# Project Area
# Project Area
#
#
resources
:namespaces
,
path:
'/'
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
},
only:
[]
do
resources
:namespaces
,
path:
'/'
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
},
only:
[]
do
resources
(
:projects
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
},
except:
resources
(
:projects
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+
(?<!\.atom)
/
},
except:
[
:new
,
:create
,
:index
],
path:
"/"
)
do
[
:new
,
:create
,
:index
],
path:
"/"
)
do
member
do
member
do
put
:transfer
put
:transfer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment