Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c38b9a2f
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 搜索 >>
提交
c38b9a2f
编写于
11月 30, 2012
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Filter projects on dashboard
上级
a03f3189
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
0 deletion
+46
-0
app/assets/stylesheets/gitlab_bootstrap/common.scss
app/assets/stylesheets/gitlab_bootstrap/common.scss
+14
-0
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+9
-0
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+13
-0
app/models/project.rb
app/models/project.rb
+2
-0
app/views/dashboard/_projects.html.haml
app/views/dashboard/_projects.html.haml
+8
-0
未找到文件。
app/assets/stylesheets/gitlab_bootstrap/common.scss
浏览文件 @
c38b9a2f
...
...
@@ -100,3 +100,17 @@ input[type='search'].search-text-input {
}
fieldset
legend
{
font-size
:
17px
;
}
ul
.nav.nav-projects-tabs
{
@extend
.nav-tabs
;
padding-left
:
8px
;
li
{
a
{
padding
:
4px
20px
;
margin-top
:
2px
;
border-color
:
#DDD
;
}
}
}
app/controllers/dashboard_controller.rb
浏览文件 @
c38b9a2f
...
...
@@ -7,6 +7,15 @@ class DashboardController < ApplicationController
def
index
@groups
=
current_user
.
authorized_groups
@projects
=
case
params
[
:scope
]
when
'personal'
then
@projects
.
personal
(
current_user
)
when
'joined'
then
@projects
.
joined
(
current_user
)
else
@projects
end
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
@events
=
Event
.
in_projects
(
current_user
.
project_ids
)
...
...
app/helpers/tab_helper.rb
浏览文件 @
c38b9a2f
...
...
@@ -84,4 +84,17 @@ module TabHelper
'active'
end
end
# Use nav_tab for save controller/action but different params
def
nav_tab
key
,
value
,
&
block
o
=
{}
o
[
:class
]
=
""
o
[
:class
]
<<
" active"
if
params
[
key
]
==
value
if
block_given?
content_tag
(
:li
,
capture
(
&
block
),
o
)
else
content_tag
(
:li
,
nil
,
o
)
end
end
end
app/models/project.rb
浏览文件 @
c38b9a2f
...
...
@@ -74,6 +74,8 @@ class Project < ActiveRecord::Base
scope
:without_user
,
->
(
user
)
{
where
(
"id NOT IN (:ids)"
,
ids:
user
.
projects
.
map
(
&
:id
)
)
}
scope
:not_in_group
,
->
(
group
)
{
where
(
"id NOT IN (:ids)"
,
ids:
group
.
project_ids
)
}
scope
:sorted_by_activity
,
->
()
{
order
(
"(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC"
)
}
scope
:personal
,
->
(
user
)
{
where
(
namespace_id:
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
class
<<
self
def
authorized_for
user
...
...
app/views/dashboard/_projects.html.haml
浏览文件 @
c38b9a2f
...
...
@@ -8,6 +8,14 @@
=
link_to
new_project_path
,
class:
"btn very_small info"
do
%i
.icon-plus
New Project
%ul
.nav.nav-projects-tabs
=
nav_tab
:scope
,
nil
do
=
link_to
"All"
,
dashboard_path
=
nav_tab
:scope
,
'personal'
do
=
link_to
"Personal"
,
dashboard_path
(
scope:
'personal'
)
=
nav_tab
:scope
,
'joined'
do
=
link_to
"Joined"
,
dashboard_path
(
scope:
'joined'
)
%ul
.unstyled
-
projects
.
each
do
|
project
|
%li
.wll
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录