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
aca0caa8
Commit
aca0caa8
authored
Jan 09, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2534 from AlexDenisov/ajax_activities
Reload activities/events on the dashboard page via ajax
parents
d27cc91e
d7bc1214
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
171 additions
and
7 deletions
+171
-7
app/assets/javascripts/dashboard.js.coffee
app/assets/javascripts/dashboard.js.coffee
+30
-0
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+2
-1
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+1
-4
app/views/dashboard/index.html.haml
app/views/dashboard/index.html.haml
+0
-2
features/dashboard/event_filters.feature
features/dashboard/event_filters.feature
+51
-0
features/steps/dashboard/dashboard_event_filters.rb
features/steps/dashboard/dashboard_event_filters.rb
+87
-0
No files found.
app/assets/javascripts/dashboard.js.coffee
0 → 100644
View file @
aca0caa8
$
->
dashboardPage
()
dashboardPage
=
->
Pager
.
init
20
,
true
$
(
".event_filter_link"
).
bind
"click"
,
(
event
)
->
event
.
preventDefault
()
toggleFilter
$
(
this
)
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
(
","
)
app/controllers/dashboard_controller.rb
View file @
aca0caa8
...
@@ -60,6 +60,7 @@ class DashboardController < ApplicationController
...
@@ -60,6 +60,7 @@ class DashboardController < ApplicationController
end
end
def
event_filter
def
event_filter
@event_filter
||=
EventFilter
.
new
(
params
[
:event_filter
])
filters
=
cookies
[
'event_filter'
].
split
(
','
)
if
cookies
[
'event_filter'
]
@event_filter
||=
EventFilter
.
new
(
filters
)
end
end
end
end
app/helpers/events_helper.rb
View file @
aca0caa8
...
@@ -22,9 +22,6 @@ module EventsHelper
...
@@ -22,9 +22,6 @@ module EventsHelper
def
event_filter_link
key
,
tooltip
def
event_filter_link
key
,
tooltip
key
=
key
.
to_s
key
=
key
.
to_s
filter
=
@event_filter
.
options
key
inactive
=
if
@event_filter
.
active?
key
inactive
=
if
@event_filter
.
active?
key
nil
nil
else
else
...
@@ -32,7 +29,7 @@ module EventsHelper
...
@@ -32,7 +29,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
(
event_filter:
filter
),
class:
'has_tooltip'
,
'data-original-title'
=>
tooltip
do
link_to
dashboard_path
,
class:
'has_tooltip event_filter_link'
,
id:
"
#{
key
}
_event_filter"
,
'data-original-title'
=>
tooltip
do
image_tag
"event_filter_
#{
key
}
.png"
image_tag
"event_filter_
#{
key
}
.png"
end
end
end
end
...
...
app/views/dashboard/index.html.haml
View file @
aca0caa8
...
@@ -7,5 +7,3 @@
...
@@ -7,5 +7,3 @@
-
else
-
else
=
render
"zero_authorized_projects"
=
render
"zero_authorized_projects"
:javascript
$
(
function
(){
Pager
.
init
(
20
,
true
);
});
features/dashboard/event_filters.feature
0 → 100644
View file @
aca0caa8
Feature
:
Event filters
Background
:
Given
I sign in as a user
And
I own a project
And
this project has push event
And
this project has new member event
And
this project has merge request event
And
I visit dashboard page
@javascript
Scenario
:
I
should see all events
Then
I should see push event
And
I should see new member event
And
I should see merge request event
@javascript
Scenario
:
I
should see only pushed events
When
I click
"push"
event filter
Then
I should see push event
And
I should not see new member event
And
I should not see merge request event
@javascript
Scenario
:
I
should see only joined events
When
I click
"team"
event filter
Then
I should see new member event
And
I should not see push event
And
I should not see merge request event
@javascript
Scenario
:
I
should see only merged events
When
I click
"merge"
event filter
Then
I should see merge request event
And
I should not see push event
And
I should not see new member event
@javascript
Scenario
:
I
should see only selected events while page reloaded
When
I click
"push"
event filter
And
I visit dashboard page
Then
I should see push event
And
I should not see new member event
When
I click
"team"
event filter
And
I visit dashboard page
Then
I should see push event
And
I should see new member event
And
I should not see merge request event
When
I click
"push"
event filter
Then
I should not see push event
And
I should see new member event
And
I should not see merge request event
features/steps/dashboard/dashboard_event_filters.rb
0 → 100644
View file @
aca0caa8
class
EventFilters
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
Then
'I should see push event'
do
page
.
should
have_selector
(
'span.pushed'
)
end
Then
'I should not see push event'
do
page
.
should_not
have_selector
(
'span.pushed'
)
end
Then
'I should see new member event'
do
page
.
should
have_selector
(
'span.joined'
)
end
And
'I should not see new member event'
do
page
.
should_not
have_selector
(
'span.joined'
)
end
Then
'I should see merge request event'
do
page
.
should
have_selector
(
'span.merged'
)
end
And
'I should not see merge request event'
do
page
.
should_not
have_selector
(
'span.merged'
)
end
And
'this project has push event'
do
data
=
{
before:
"0000000000000000000000000000000000000000"
,
after:
"0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e"
,
ref:
"refs/heads/new_design"
,
user_id:
@user
.
id
,
user_name:
@user
.
name
,
repository:
{
name:
@project
.
name
,
url:
"localhost/rubinius"
,
description:
""
,
homepage:
"localhost/rubinius"
,
private:
true
}
}
@event
=
Event
.
create
(
project:
@project
,
action:
Event
::
Pushed
,
data:
data
,
author_id:
@user
.
id
)
end
And
'this project has new member event'
do
user
=
create
(
:user
,
{
name:
"John Doe"
})
Event
.
create
(
project:
@project
,
author_id:
user
.
id
,
action:
Event
::
Joined
)
end
And
'this project has merge request event'
do
merge_request
=
create
:merge_request
,
author:
@user
,
project:
@project
Event
.
create
(
project:
@project
,
action:
Event
::
Merged
,
target_id:
merge_request
.
id
,
target_type:
"MergeRequest"
,
author_id:
@user
.
id
)
end
When
'I click "push" event filter'
do
click_link
(
"push_event_filter"
)
end
When
'I click "team" event filter'
do
click_link
(
"team_event_filter"
)
end
When
'I click "merge" event filter'
do
click_link
(
"merged_event_filter"
)
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