Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0383afc6
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,体验更适合开发者的 AI 搜索 >>
提交
0383afc6
编写于
9月 25, 2015
作者:
S
Stan Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add user preference to view project activity and starred project activity as default dashboard
Closes #2662
上级
6d691810
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
5 deletion
+38
-5
CHANGELOG
CHANGELOG
+1
-0
app/controllers/root_controller.rb
app/controllers/root_controller.rb
+4
-0
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+3
-1
app/models/user.rb
app/models/user.rb
+1
-1
spec/controllers/root_controller_spec.rb
spec/controllers/root_controller_spec.rb
+23
-1
spec/helpers/preferences_helper_spec.rb
spec/helpers/preferences_helper_spec.rb
+6
-2
未找到文件。
CHANGELOG
浏览文件 @
0383afc6
Please view this file on the master branch, on stable branches it's out of date.
v 8.1.0 (unreleased)
- Add user preference to view activities as default dashboard (Stan Hu)
- Fix bug where projects would appear to be stuck in the forked import state (Stan Hu)
- Fix Error 500 in creating merge requests with > 1000 diffs (Stan Hu)
- Show CI status on all pages where commits list is rendered
...
...
app/controllers/root_controller.rb
浏览文件 @
0383afc6
...
...
@@ -22,6 +22,10 @@ class RootController < Dashboard::ProjectsController
when
'stars'
flash
.
keep
redirect_to
starred_dashboard_projects_path
when
'project_activity'
redirect_to
activity_dashboard_path
when
'starred_project_activity'
redirect_to
activity_dashboard_path
(
filter:
'starred'
)
else
return
end
...
...
app/helpers/preferences_helper.rb
浏览文件 @
0383afc6
...
...
@@ -3,7 +3,9 @@ module PreferencesHelper
# Maps `dashboard` values to more user-friendly option text
DASHBOARD_CHOICES
=
{
projects:
'Your Projects (default)'
,
stars:
'Starred Projects'
stars:
'Starred Projects'
,
project_activity:
"Your Projects' Activity"
,
starred_project_activity:
"Starred Projects' Activity"
}.
with_indifferent_access
.
freeze
# Returns an Array usable by a select field for more user-friendly option text
...
...
app/models/user.rb
浏览文件 @
0383afc6
...
...
@@ -172,7 +172,7 @@ class User < ActiveRecord::Base
# User's Dashboard preference
# Note: When adding an option, it MUST go on the end of the array.
enum
dashboard:
[
:projects
,
:stars
]
enum
dashboard:
[
:projects
,
:stars
,
:project_activity
,
:starred_project_activity
]
# User's Project preference
# Note: When adding an option, it MUST go on the end of the array.
...
...
spec/controllers/root_controller_spec.rb
浏览文件 @
0383afc6
...
...
@@ -10,7 +10,7 @@ describe RootController do
allow
(
subject
).
to
receive
(
:current_user
).
and_return
(
user
)
end
context
'who has customized their dashboard setting'
do
context
'who has customized their dashboard setting
for starred projects
'
do
before
do
user
.
update_attribute
(
:dashboard
,
'stars'
)
end
...
...
@@ -21,6 +21,28 @@ describe RootController do
end
end
context
'who has customized their dashboard setting for project activities'
do
before
do
user
.
update_attribute
(
:dashboard
,
'project_activity'
)
end
it
'redirects to the activity list'
do
get
:index
expect
(
response
).
to
redirect_to
activity_dashboard_path
end
end
context
'who has customized their dashboard setting for starred project activities'
do
before
do
user
.
update_attribute
(
:dashboard
,
'starred_project_activity'
)
end
it
'redirects to the activity list'
do
get
:index
expect
(
response
).
to
redirect_to
activity_dashboard_path
(
filter:
'starred'
)
end
end
context
'who uses the default dashboard setting'
do
it
'renders the default dashboard'
do
get
:index
...
...
spec/helpers/preferences_helper_spec.rb
浏览文件 @
0383afc6
...
...
@@ -8,14 +8,18 @@ describe PreferencesHelper do
end
it
'raises an exception when defined choices may be using the wrong key'
do
expect
(
User
).
to
receive
(
:dashboards
).
and_return
(
foo:
'foo'
,
bar:
'bar'
)
dashboards
=
User
.
dashboards
.
dup
dashboards
[
:projects_changed
]
=
dashboards
.
delete
:projects
expect
(
User
).
to
receive
(
:dashboards
).
and_return
(
dashboards
)
expect
{
helper
.
dashboard_choices
}.
to
raise_error
(
KeyError
)
end
it
'provides better option descriptions'
do
expect
(
helper
.
dashboard_choices
).
to
match_array
[
[
'Your Projects (default)'
,
'projects'
],
[
'Starred Projects'
,
'stars'
]
[
'Starred Projects'
,
'stars'
],
[
"Your Projects' Activity"
,
'project_activity'
],
[
"Starred Projects' Activity"
,
'starred_project_activity'
]
]
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录