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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
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
Show 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
class
Dashboard
constructor
:
->
constructor
:
->
Pager
.
init
20
,
true
@
initSidebarTab
()
@
initSidebarTab
()
$
(
".event_filter_link"
).
bind
"click"
,
(
event
)
=>
event
.
preventDefault
()
@
toggleFilter
(
$
(
event
.
currentTarget
))
@
reloadActivities
()
$
(
".dash-filter"
).
keyup
->
$
(
".dash-filter"
).
keyup
->
terms
=
$
(
this
).
val
()
terms
=
$
(
this
).
val
()
uiBox
=
$
(
this
).
parents
(
'.ui-box'
).
first
()
uiBox
=
$
(
this
).
parents
(
'.ui-box'
).
first
()
...
@@ -24,27 +18,6 @@ class Dashboard
...
@@ -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
:
->
initSidebarTab
:
->
key
=
"dashboard_sidebar_filter"
key
=
"dashboard_sidebar_filter"
...
...
app/assets/javascripts/dispatcher.js.coffee
View file @
17af8353
...
@@ -20,10 +20,11 @@ class Dispatcher
...
@@ -20,10 +20,11 @@ class Dispatcher
Issues
.
init
()
Issues
.
init
()
when
'dashboard:show'
when
'dashboard:show'
new
Dashboard
()
new
Dashboard
()
new
Activities
()
when
'projects:commit:show'
when
'projects:commit:show'
new
Commit
()
new
Commit
()
when
'groups:show'
,
'projects:show'
when
'groups:show'
,
'projects:show'
Pager
.
init
(
20
,
true
)
new
Activities
(
)
when
'projects:new'
,
'projects:edit'
when
'projects:new'
,
'projects:edit'
new
Project
()
new
Project
()
when
'projects:walls:show'
when
'projects:walls:show'
...
...
app/controllers/application_controller.rb
View file @
17af8353
...
@@ -155,4 +155,9 @@ class ApplicationController < ActionController::Base
...
@@ -155,4 +155,9 @@ class ApplicationController < ActionController::Base
redirect_to
new_profile_password_path
and
return
redirect_to
new_profile_password_path
and
return
end
end
end
end
def
event_filter
filters
=
cookies
[
'event_filter'
].
split
(
','
)
if
cookies
[
'event_filter'
].
present?
@event_filter
||=
EventFilter
.
new
(
filters
)
end
end
end
app/controllers/dashboard_controller.rb
View file @
17af8353
...
@@ -66,9 +66,4 @@ class DashboardController < ApplicationController
...
@@ -66,9 +66,4 @@ class DashboardController < ApplicationController
def
load_projects
def
load_projects
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
@projects
=
current_user
.
authorized_projects
.
sorted_by_activity
end
end
def
event_filter
filters
=
cookies
[
'event_filter'
].
split
(
','
)
if
cookies
[
'event_filter'
].
present?
@event_filter
||=
EventFilter
.
new
(
filters
)
end
end
end
app/controllers/groups_controller.rb
View file @
17af8353
...
@@ -31,7 +31,9 @@ class GroupsController < ApplicationController
...
@@ -31,7 +31,9 @@ class GroupsController < ApplicationController
end
end
def
show
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
@last_push
=
current_user
.
recent_push
respond_to
do
|
format
|
respond_to
do
|
format
|
...
...
app/controllers/projects_controller.rb
View file @
17af8353
...
@@ -55,7 +55,10 @@ class ProjectsController < Projects::ApplicationController
...
@@ -55,7 +55,10 @@ class ProjectsController < Projects::ApplicationController
def
show
def
show
limit
=
(
params
[
:limit
]
||
20
).
to_i
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
# Ensure project default branch is set if it possible
# Normally it defined on push or during creation
# Normally it defined on push or during creation
...
...
app/helpers/events_helper.rb
View file @
17af8353
...
@@ -28,7 +28,7 @@ module EventsHelper
...
@@ -28,7 +28,7 @@ module EventsHelper
end
end
content_tag
:div
,
class:
"filter_icon
#{
inactive
}
"
do
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
]
content_tag
:i
,
nil
,
class:
icon_for_event
[
key
]
end
end
end
end
...
...
app/views/dashboard/_activities.html.haml
View file @
17af8353
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
=
render
'shared/event_filter'
.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'
-
if
@events
.
any?
-
if
@events
.
any?
.content_list
.content_list
...
...
app/views/groups/show.html.haml
View file @
17af8353
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
%span
.cgray
You will only see events from projects in this group
%span
.cgray
You will only see events from projects in this group
%hr
%hr
=
render
'shared/event_filter'
-
if
@events
.
any?
-
if
@events
.
any?
.content_list
.content_list
-
else
-
else
...
...
app/views/projects/show.html.haml
View file @
17af8353
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
.row
.row
.span9
.span9
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
=
render
'shared/event_filter'
.content_list
.content_list
.loading.hide
.loading.hide
.span3
.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