Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6a0c0f3f
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,发现更多精彩内容 >>
未验证
提交
6a0c0f3f
编写于
12月 26, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add sorting to public projects page
Signed-off-by:
N
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
上级
8310b458
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
44 addition
and
15 deletion
+44
-15
app/assets/stylesheets/gitlab_bootstrap/forms.scss
app/assets/stylesheets/gitlab_bootstrap/forms.scss
+4
-0
app/contexts/issues/list_context.rb
app/contexts/issues/list_context.rb
+1
-2
app/controllers/public/projects_controller.rb
app/controllers/public/projects_controller.rb
+8
-1
app/views/public/projects/index.html.haml
app/views/public/projects/index.html.haml
+31
-12
未找到文件。
app/assets/stylesheets/gitlab_bootstrap/forms.scss
浏览文件 @
6a0c0f3f
...
@@ -21,6 +21,10 @@ form {
...
@@ -21,6 +21,10 @@ form {
text-align
:
left
;
text-align
:
left
;
}
}
}
}
&
.form-tiny
{
margin
:
0
;
}
}
}
input
.input-xpadding
,
input
.input-xpadding
,
...
...
app/contexts/issues/list_context.rb
浏览文件 @
6a0c0f3f
...
@@ -49,6 +49,5 @@ module Issues
...
@@ -49,6 +49,5 @@ module Issues
else
issues
else
issues
end
end
end
end
end
end
end
end
app/controllers/public/projects_controller.rb
浏览文件 @
6a0c0f3f
...
@@ -8,6 +8,13 @@ class Public::ProjectsController < ApplicationController
...
@@ -8,6 +8,13 @@ class Public::ProjectsController < ApplicationController
def
index
def
index
@projects
=
Project
.
public_or_internal_only
(
current_user
)
@projects
=
Project
.
public_or_internal_only
(
current_user
)
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.path, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
@projects
=
case
params
[
:sort
]
when
'newest'
then
@projects
.
order
(
'created_at DESC'
)
when
'oldest'
then
@projects
.
order
(
'created_at ASC'
)
when
'recently_updated'
then
@projects
.
order
(
'updated_at DESC'
)
when
'last_updated'
then
@projects
.
order
(
'updated_at ASC'
)
else
@projects
.
order
(
"namespaces.path, projects.name ASC"
)
end
@projects
=
@projects
.
includes
(
:namespace
).
page
(
params
[
:page
]).
per
(
20
)
end
end
end
end
app/views/public/projects/index.html.haml
浏览文件 @
6a0c0f3f
.row
%h3
.page-title
.span6
%h3
.page-title
Projects (
#{
@projects
.
total_count
}
)
Projects (
#{
@projects
.
total_count
}
)
.light
.light
You can browse public projects in read-only mode until signed in.
You can browse public projects in read-only mode until signed in.
%hr
.span6
.clearfix
.pull-righ
t
.pull-lef
t
=
form_tag
public_projects_path
,
method: :get
,
class:
'form-inline
'
do
|
f
|
=
form_tag
public_projects_path
,
method: :get
,
class:
'form-inline form-tiny
'
do
|
f
|
.search-holder
.search-holder
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"span3
search-text-input"
,
id:
"projects_search"
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"span4
search-text-input"
,
id:
"projects_search"
=
submit_tag
'Search'
,
class:
"btn btn-primary wide"
=
submit_tag
'Search'
,
class:
"btn btn-primary wide"
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
@sort
-
else
Newest
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
public_projects_path
(
sort:
'newest'
)
do
Newest
=
link_to
public_projects_path
(
sort:
'oldest'
)
do
Oldest
=
link_to
public_projects_path
(
sort:
'recently_updated'
)
do
Recently updated
=
link_to
public_projects_path
(
sort:
'last_updated'
)
do
Last updated
%hr
%hr
.public-projects
.public-projects
%ul
.bordered-list.top-list
%ul
.bordered-list.top-list
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录