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
8b489ba7
Commit
8b489ba7
authored
Nov 06, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/dashboard_event_filters' of dev.gitlabhq.com:gitlabhq
parents
ba567c8d
949233aa
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
134 additions
and
3 deletions
+134
-3
app/assets/images/event_filter_comments.png
app/assets/images/event_filter_comments.png
+0
-0
app/assets/images/event_filter_merged.png
app/assets/images/event_filter_merged.png
+0
-0
app/assets/images/event_filter_push.png
app/assets/images/event_filter_push.png
+0
-0
app/assets/images/event_filter_team.png
app/assets/images/event_filter_team.png
+0
-0
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+3
-0
app/assets/stylesheets/sections/events.scss
app/assets/stylesheets/sections/events.scss
+26
-0
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+10
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+18
-0
app/views/dashboard/index.html.haml
app/views/dashboard/index.html.haml
+8
-1
lib/event_filter.rb
lib/event_filter.rb
+68
-0
No files found.
app/assets/images/event_filter_comments.png
0 → 100644
View file @
8b489ba7
750 Bytes
app/assets/images/event_filter_merged.png
0 → 100644
View file @
8b489ba7
463 Bytes
app/assets/images/event_filter_push.png
0 → 100644
View file @
8b489ba7
632 Bytes
app/assets/images/event_filter_team.png
0 → 100644
View file @
8b489ba7
1.31 KB
app/assets/javascripts/main.js.coffee
View file @
8b489ba7
...
@@ -27,6 +27,9 @@ $ ->
...
@@ -27,6 +27,9 @@ $ ->
# Initialize chosen selects
# Initialize chosen selects
$
(
'select.chosen'
).
chosen
()
$
(
'select.chosen'
).
chosen
()
# Initialize tooltips
$
(
'.has_tooltip'
).
tooltip
()
# Disable form buttons while a form is submitting
# Disable form buttons while a form is submitting
$
(
'body'
).
on
'ajax:complete, ajax:beforeSend, submit'
,
'form'
,
(
e
)
->
$
(
'body'
).
on
'ajax:complete, ajax:beforeSend, submit'
,
'form'
,
(
e
)
->
buttons
=
$
(
'[type="submit"]'
,
@
)
buttons
=
$
(
'[type="submit"]'
,
@
)
...
...
app/assets/stylesheets/sections/events.scss
View file @
8b489ba7
...
@@ -115,3 +115,29 @@
...
@@ -115,3 +115,29 @@
margin
:
-3px
;
margin
:
-3px
;
}
}
}
}
/**
* Event filter
*
*/
.event_filter
{
position
:
absolute
;
width
:
40px
;
margin-left
:
-50px
;
.filter_icon
{
float
:
left
;
border-left
:
3px
solid
#4bc
;
padding
:
7px
;
background
:
#f9f9f9
;
margin-bottom
:
10px
;
img
{
width
:
20px
;
}
&
.inactive
{
border-left
:
3px
solid
#EEE
;
opacity
:
0
.5
;
}
}
}
app/controllers/dashboard_controller.rb
View file @
8b489ba7
class
DashboardController
<
ApplicationController
class
DashboardController
<
ApplicationController
respond_to
:html
respond_to
:html
before_filter
:event_filter
,
only: :index
def
index
def
index
@groups
=
Group
.
where
(
id:
current_user
.
projects
.
pluck
(
:group_id
))
@groups
=
Group
.
where
(
id:
current_user
.
projects
.
pluck
(
:group_id
))
@projects
=
current_user
.
projects_with_events
@projects
=
current_user
.
projects_with_events
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@events
=
Event
.
in_projects
(
current_user
.
project_ids
).
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
@events
=
Event
.
in_projects
(
current_user
.
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
|
...
@@ -34,4 +39,8 @@ class DashboardController < ApplicationController
...
@@ -34,4 +39,8 @@ class DashboardController < ApplicationController
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
end
end
end
end
def
event_filter
@event_filter
||=
EventFilter
.
new
(
params
[
:event_filter
])
end
end
end
app/helpers/application_helper.rb
View file @
8b489ba7
...
@@ -36,7 +36,7 @@ module ApplicationHelper
...
@@ -36,7 +36,7 @@ module ApplicationHelper
else
else
gravatar_prefix
=
request
.
ssl?
?
"https://secure"
:
"http://www"
gravatar_prefix
=
request
.
ssl?
?
"https://secure"
:
"http://www"
user_email
.
strip!
user_email
.
strip!
"
#{
gravatar_prefix
}
.gravatar.com/avatar/
#{
Digest
::
MD5
.
hexdigest
(
user_email
.
downcase
)
}
?s=
#{
size
}
&d=
identicon
"
"
#{
gravatar_prefix
}
.gravatar.com/avatar/
#{
Digest
::
MD5
.
hexdigest
(
user_email
.
downcase
)
}
?s=
#{
size
}
&d=
mm
"
end
end
end
end
...
...
app/helpers/events_helper.rb
View file @
8b489ba7
...
@@ -33,4 +33,22 @@ module EventsHelper
...
@@ -33,4 +33,22 @@ module EventsHelper
image_tag
event_image_path
image_tag
event_image_path
end
end
end
end
def
event_filter_link
key
,
tooltip
key
=
key
.
to_s
filter
=
@event_filter
.
options
key
inactive
=
if
@event_filter
.
active?
key
nil
else
'inactive'
end
content_tag
:div
,
class:
"filter_icon
#{
inactive
}
"
do
link_to
dashboard_path
(
event_filter:
filter
),
class:
'has_tooltip'
,
'data-original-title'
=>
tooltip
do
image_tag
"event_filter_
#{
key
}
.png"
end
end
end
end
end
app/views/dashboard/index.html.haml
View file @
8b489ba7
...
@@ -3,10 +3,17 @@
...
@@ -3,10 +3,17 @@
.activities.span8
.activities.span8
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
=
render
'shared/no_ssh'
=
render
'shared/no_ssh'
.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
=
render
@events
.content_list
=
render
@events
-
else
-
else
%
h4
.nothing_here_message
Projects activity will be displayed here
%
p
.nothing_here_message
Projects activity will be displayed here
.loading.hide
.loading.hide
.side
.side
-
if
@groups
.
present?
-
if
@groups
.
present?
...
...
lib/event_filter.rb
0 → 100644
View file @
8b489ba7
class
EventFilter
attr_accessor
:params
class
<<
self
def
default_filter
%w{ push issues merge_requests team}
end
def
push
'push'
end
def
merged
'merged'
end
def
comments
'comments'
end
def
team
'team'
end
end
def
initialize
params
@params
=
if
params
params
.
dup
else
[]
#EventFilter.default_filter
end
end
def
apply_filter
events
return
events
unless
params
.
present?
filter
=
params
.
dup
actions
=
[]
actions
<<
Event
::
Pushed
if
filter
.
include?
'push'
actions
<<
Event
::
Merged
if
filter
.
include?
'merged'
if
filter
.
include?
'team'
actions
<<
Event
::
Joined
actions
<<
Event
::
Left
end
actions
<<
Event
::
Commented
if
filter
.
include?
'comments'
events
=
events
.
where
(
action:
actions
)
end
def
options
key
filter
=
params
.
dup
if
filter
.
include?
key
filter
.
delete
key
else
filter
<<
key
end
filter
end
def
active?
key
params
.
include?
key
end
end
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