Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
97d17cf8
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
97d17cf8
编写于
12月 03, 2012
作者:
A
Alex Denisov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Event filters stores at cookies.
上级
b255c3c4
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
56 addition
and
11 deletion
+56
-11
app/assets/javascripts/dashboard.js
app/assets/javascripts/dashboard.js
+27
-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
+1
-0
features/dashboard/event_filters.feature
features/dashboard/event_filters.feature
+19
-0
features/steps/dashboard/dashboard_event_filters.rb
features/steps/dashboard/dashboard_event_filters.rb
+6
-6
未找到文件。
app/assets/javascripts/dashboard.js
0 → 100644
浏览文件 @
97d17cf8
/**
* Init dashboard page
*
*/
function
dashboardPage
(){
$
(
"
.event_filter_link
"
).
bind
(
'
click
'
,(
function
(){
enableFilter
(
this
.
id
);
}));
}
function
enableFilter
(
sender_id
){
var
event_filters
=
$
.
cookie
(
'
event_filter
'
);
var
filter
=
sender_id
.
split
(
'
_
'
)[
0
];
if
(
!
event_filters
)
{
event_filters
=
new
Array
();
}
else
{
event_filters
=
event_filters
.
split
(
'
,
'
);
}
var
index
=
event_filters
.
indexOf
(
filter
);
if
(
index
==
-
1
)
{
event_filters
.
push
(
filter
);
}
else
{
event_filters
.
splice
(
index
,
1
);
}
$
.
cookie
(
'
event_filter
'
,
event_filters
.
join
(
'
,
'
));
};
app/controllers/dashboard_controller.rb
浏览文件 @
97d17cf8
...
@@ -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
浏览文件 @
97d17cf8
...
@@ -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
'
,
id:
"
#{
key
}
_event_filter"
,
'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
浏览文件 @
97d17cf8
=
javascript_include_tag
'dashboard'
-
if
@has_authorized_projects
-
if
@has_authorized_projects
.projects
.projects
.activities.span8
.activities.span8
...
...
features/dashboard/event_filters.feature
浏览文件 @
97d17cf8
...
@@ -12,20 +12,39 @@ Feature: Event filters
...
@@ -12,20 +12,39 @@ Feature: Event filters
And
I should see new member event
And
I should see new member event
And
I should see merge request event
And
I should see merge request event
@javascript
Scenario
:
I
should see only pushed events
Scenario
:
I
should see only pushed events
When
I click
"push"
event filter
When
I click
"push"
event filter
Then
I should see push event
Then
I should see push event
And
I should not see new member event
And
I should not see new member event
And
I should not see merge request event
And
I should not see merge request event
@javascript
Scenario
:
I
should see only joined events
Scenario
:
I
should see only joined events
When
I click
"team"
event filter
When
I click
"team"
event filter
Then
I should see new member event
Then
I should see new member event
And
I should not see push event
And
I should not see push event
And
I should not see merge request event
And
I should not see merge request event
@javascript
Scenario
:
I
should see only merged events
Scenario
:
I
should see only merged events
When
I click
"merge"
event filter
When
I click
"merge"
event filter
Then
I should see merge request event
Then
I should see merge request event
And
I should not see push event
And
I should not see push event
And
I should not see new member 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
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
浏览文件 @
97d17cf8
...
@@ -4,27 +4,27 @@ class EventFilters < Spinach::FeatureSteps
...
@@ -4,27 +4,27 @@ class EventFilters < Spinach::FeatureSteps
include
SharedProject
include
SharedProject
Then
'I should see push event'
do
Then
'I should see push event'
do
page
.
has_selector?
(
'span.pushed'
).
should
be_true
page
.
should
have_selector
(
'span.pushed'
)
end
end
Then
'I should not see push event'
do
Then
'I should not see push event'
do
page
.
has_selector?
(
'span.pushed'
).
should
be_false
page
.
should_not
have_selector
(
'span.pushed'
)
end
end
Then
'I should see new member event'
do
Then
'I should see new member event'
do
page
.
has_selector?
(
'span.joined'
).
should
be_true
page
.
should
have_selector
(
'span.joined'
)
end
end
And
'I should not see new member event'
do
And
'I should not see new member event'
do
page
.
has_selector?
(
'span.joined'
).
should
be_false
page
.
should_not
have_selector
(
'span.joined'
)
end
end
Then
'I should see merge request event'
do
Then
'I should see merge request event'
do
page
.
has_selector?
(
'span.merged'
).
should
be_true
page
.
should
have_selector
(
'span.merged'
)
end
end
And
'I should not see merge request event'
do
And
'I should not see merge request event'
do
page
.
has_selector?
(
'span.merged'
).
should
be_false
page
.
should_not
have_selector
(
'span.merged'
)
end
end
And
'this project has push event'
do
And
'this project has push event'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录