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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
17af8353
Commit
17af8353
authored
Aug 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add event filter for group and project show pages
parent
4675ff46
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
54 additions
and
42 deletions
+54
-42
app/assets/javascripts/activities.js.coffee
app/assets/javascripts/activities.js.coffee
+31
-0
app/assets/javascripts/dashboard.js.coffee
app/assets/javascripts/dashboard.js.coffee
+0
-27
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+2
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+5
-0
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+0
-5
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+3
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+4
-1
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+1
-1
app/views/dashboard/_activities.html.haml
app/views/dashboard/_activities.html.haml
+1
-6
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+1
-0
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+1
-0
app/views/shared/_event_filter.html.haml
app/views/shared/_event_filter.html.haml
+5
-0
No files found.
app/assets/javascripts/activities.js.coffee
0 → 100644
View file @
17af8353
class
Activities
constructor
:
->
Pager
.
init
20
,
true
$
(
".event_filter_link"
).
bind
"click"
,
(
event
)
=>
event
.
preventDefault
()
@
toggleFilter
(
$
(
event
.
currentTarget
))
@
reloadActivities
()
reloadActivities
:
->
$
(
".content_list"
).
html
''
Pager
.
init
20
,
true
toggleFilter
:
(
sender
)
->
sender
.
parent
().
toggleClass
"inactive"
event_filters
=
$
.
cookie
(
"event_filter"
)
filter
=
sender
.
attr
(
"id"
).
split
(
"_"
)[
0
]
if
event_filters
event_filters
=
event_filters
.
split
(
","
)
else
event_filters
=
new
Array
()
index
=
event_filters
.
indexOf
(
filter
)
if
index
is
-
1
event_filters
.
push
filter
else
event_filters
.
splice
index
,
1
$
.
cookie
"event_filter"
,
event_filters
.
join
(
","
),
{
path
:
'/'
}
@
Activities
=
Activities
app/assets/javascripts/dashboard.js.coffee
View file @
17af8353
class
Dashboard
constructor
:
->
Pager
.
init
20
,
true
@
initSidebarTab
()
$
(
".event_filter_link"
).
bind
"click"
,
(
event
)
=>
event
.
preventDefault
()
@
toggleFilter
(
$
(
event
.
currentTarget
))
@
reloadActivities
()
$
(
".dash-filter"
).
keyup
->
terms
=
$
(
this
).
val
()
uiBox
=
$
(
this
).
parents
(
'.ui-box'
).
first
()
...
...
@@ -24,27 +18,6 @@ class Dashboard
reloadActivities
:
->
$
(
".content_list"
).
html
''
Pager
.
init
20
,
true
toggleFilter
:
(
sender
)
->
sender
.
parent
().
toggleClass
"inactive"
event_filters
=
$
.
cookie
(
"event_filter"
)
filter
=
sender
.
attr
(
"id"
).
split
(
"_"
)[
0
]
if
event_filters
event_filters
=
event_filters
.
split
(
","
)
else
event_filters
=
new
Array
()
index
=
event_filters
.
indexOf
(
filter
)
if
index
is
-
1
event_filters
.
push
filter
else
event_filters
.
splice
index
,
1
$
.
cookie
"event_filter"
,
event_filters
.
join
(
","
),
{
path
:
'/'
}
initSidebarTab
:
->
key
=
"dashboard_sidebar_filter"
...
...
app/assets/javascripts/dispatcher.js.coffee
View file @
17af8353
...
...
@@ -20,10 +20,11 @@ class Dispatcher
Issues
.
init
()
when
'dashboard:show'
new
Dashboard
()
new
Activities
()
when
'projects:commit:show'
new
Commit
()
when
'groups:show'
,
'projects:show'
Pager
.
init
(
20
,
true
)
new
Activities
(
)
when
'projects:new'
,
'projects:edit'
new
Project
()
when
'projects:walls:show'
...
...
app/controllers/application_controller.rb
View file @
17af8353
...
...
@@ -155,4 +155,9 @@ class ApplicationController < ActionController::Base
redirect_to
new_profile_password_path
and
return
end
end
def
event_filter
filters
=
cookies
[
'event_filter'
].
split
(
','
)
if
cookies
[
'event_filter'
].
present?
@event_filter
||=
EventFilter
.
new
(
filters
)
end
end
app/controllers/dashboard_controller.rb
View file @
17af8353
...
...
@@ -66,9 +66,4 @@ class DashboardController < ApplicationController
def
load_projects
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
end
def
event_filter
filters
=
cookies
[
'event_filter'
].
split
(
','
)
if
cookies
[
'event_filter'
].
present?
@event_filter
||=
EventFilter
.
new
(
filters
)
end
end
app/controllers/groups_controller.rb
View file @
17af8353
...
...
@@ -31,7 +31,9 @@ class GroupsController < ApplicationController
end
def
show
@events
=
Event
.
in_projects
(
project_ids
).
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
@events
=
Event
.
in_projects
(
project_ids
)
@events
=
event_filter
.
apply_filter
(
@events
)
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
@last_push
=
current_user
.
recent_push
respond_to
do
|
format
|
...
...
app/controllers/projects_controller.rb
View file @
17af8353
...
...
@@ -55,7 +55,10 @@ class ProjectsController < Projects::ApplicationController
def
show
limit
=
(
params
[
:limit
]
||
20
).
to_i
@events
=
@project
.
events
.
recent
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
@events
=
@project
.
events
.
recent
@events
=
event_filter
.
apply_filter
(
@events
)
@events
=
@events
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
# Ensure project default branch is set if it possible
# Normally it defined on push or during creation
...
...
app/helpers/events_helper.rb
View file @
17af8353
...
...
@@ -28,7 +28,7 @@ module EventsHelper
end
content_tag
:div
,
class:
"filter_icon
#{
inactive
}
"
do
link_to
dashboard_
path
,
class:
'has_tooltip event_filter_link'
,
id:
"
#{
key
}
_event_filter"
,
'data-original-title'
=>
tooltip
do
link_to
request
.
path
,
class:
'has_tooltip event_filter_link'
,
id:
"
#{
key
}
_event_filter"
,
'data-original-title'
=>
tooltip
do
content_tag
:i
,
nil
,
class:
icon_for_event
[
key
]
end
end
...
...
app/views/dashboard/_activities.html.haml
View file @
17af8353
=
render
"events/event_last_push"
,
event:
@last_push
.event_filter
=
event_filter_link
EventFilter
.
push
,
'Push events'
=
event_filter_link
EventFilter
.
merged
,
'Merge events'
=
event_filter_link
EventFilter
.
comments
,
'Comments'
=
event_filter_link
EventFilter
.
team
,
'Team'
=
render
'shared/event_filter'
-
if
@events
.
any?
.content_list
...
...
app/views/groups/show.html.haml
View file @
17af8353
...
...
@@ -6,6 +6,7 @@
%span
.cgray
You will only see events from projects in this group
%hr
=
render
'shared/event_filter'
-
if
@events
.
any?
.content_list
-
else
...
...
app/views/projects/show.html.haml
View file @
17af8353
...
...
@@ -3,6 +3,7 @@
.row
.span9
=
render
"events/event_last_push"
,
event:
@last_push
=
render
'shared/event_filter'
.content_list
.loading.hide
.span3
...
...
app/views/shared/_event_filter.html.haml
0 → 100644
View file @
17af8353
.event_filter
=
event_filter_link
EventFilter
.
push
,
'Push events'
=
event_filter_link
EventFilter
.
merged
,
'Merge events'
=
event_filter_link
EventFilter
.
comments
,
'Comments'
=
event_filter_link
EventFilter
.
team
,
'Team'
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