Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c5280434
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 搜索 >>
提交
c5280434
编写于
10月 01, 2015
作者:
C
Cristian Bica
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow users to select the Files view as default project view
上级
2e8a3e39
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
96 addition
and
52 deletion
+96
-52
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+44
-40
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+4
-1
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+7
-1
app/models/user.rb
app/models/user.rb
+1
-1
app/views/projects/_files.html.haml
app/views/projects/_files.html.haml
+11
-0
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+2
-7
app/views/projects/tree/_blob_item.html.haml
app/views/projects/tree/_blob_item.html.haml
+1
-1
app/views/projects/tree/_tree_item.html.haml
app/views/projects/tree/_tree_item.html.haml
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+25
-0
未找到文件。
app/assets/stylesheets/pages/projects.scss
浏览文件 @
c5280434
.alert_holder
{
margin
:
-16px
;
.alert-link
{
font-weight
:
normal
;
}
...
...
@@ -31,20 +31,20 @@
margin
:
-
$gl-padding
;
padding
:
$gl-padding
;
padding
:
44px
0
17px
0
;
.project-identicon-holder
{
margin-bottom
:
16px
;
.avatar
,
.identicon
{
margin
:
0
auto
;
float
:
none
;
}
.identicon
{
@include
border-radius
(
50%
);
}
}
.project-home-dropdown
{
margin
:
11px
3px
0
;
}
...
...
@@ -86,15 +86,15 @@
top
:
17px
;
margin-bottom
:
44px
;
}
.project-repo-buttons
{
margin-top
:
12px
;
margin-bottom
:
0px
;
.btn
{
@include
bnt-project
;
@include
btn-info
;
.count
{
display
:
inline-block
;
}
...
...
@@ -105,7 +105,7 @@
.split-one
{
display
:
inline-table
;
margin-right
:
12px
;
a
{
margin
:
-1px
!
important
;
}
...
...
@@ -129,10 +129,10 @@
&
.git-protocols
{
padding
:
0
;
border
:
none
;
.input-group-btn
:last-child
>
.btn
{
@include
border-radius-right
(
0
);
border-left
:
1px
solid
#c6cacf
;
margin-left
:
-2px
!
important
;
}
...
...
@@ -141,55 +141,55 @@
}
.projects-search-form
{
.input-group
.form-control
{
height
:
42px
;
}
}
.input-group-btn
{
.btn
{
.btn
{
@include
bnt-project
;
@include
btn-middle
;
&
:hover
{
outline
:
none
;
}
&
:focus
{
outline
:
none
;
}
&
:active
{
outline
:
none
;
}
}
.active
{
@include
box-shadow
(
inset
0
0
4px
rgba
(
0
,
0
,
0
,
0
.12
));
border
:
1px
solid
#c6cacf
!
important
;
background-color
:
#e4e7ed
!
important
;
}
.btn-green
{
@include
btn-green
}
}
.split-repo-buttons
{
display
:
inline-table
;
margin
:
0
12px
0
12px
;
.btn
{
@include
bnt-project
;
@include
btn-info
;
}
.dropdown-toggle
{
margin
:
-5px
;
}
}
}
#notification-form
{
...
...
@@ -202,7 +202,7 @@
.open
>
.dropdown-new.btn
{
@include
box-shadow
(
inset
0
0
4px
rgba
(
0
,
0
,
0
,
0
.12
));
border
:
1px
solid
#c6cacf
!
important
;
background-color
:
#e4e7ed
!
important
;
text-transform
:
uppercase
;
...
...
@@ -214,21 +214,21 @@
.dropdown-menu
{
@include
box-shadow
(
rgba
(
76
,
86
,
103
,
0
.247059
)
0px
0px
1px
0px
,
rgba
(
31
,
37
,
50
,
0
.317647
)
0px
2px
18px
0px
);
@include
border-radius
(
0px
);
border
:
none
;
padding
:
16px
0
;
font-size
:
14px
;
font-weight
:
100
;
li
a
{
color
:
#5f697a
;
line-height
:
30px
;
&
:hover
{
background-color
:
#3084bb
!
important
;
background-color
:
#3084bb
!
important
;
}
}
.fa-fw
{
margin-right
:
8px
;
}
...
...
@@ -370,7 +370,7 @@ table.table.protected-branches-list tr.no-border {
ul
.nav-pills
{
display
:inline-block
;
}
.nav-pills
li
{
display
:inline
;
}
...
...
@@ -378,12 +378,12 @@ table.table.protected-branches-list tr.no-border {
.nav
>
li
>
a
{
@include
btn-info
;
@include
bnt-project
;
background-color
:
transparent
;
border
:
1px
solid
#f7f8fa
;
margin-left
:
12px
;
}
li
{
display
:inline
;
}
...
...
@@ -418,27 +418,27 @@ pre.light-well {
.git-empty
{
margin
:
0
7px
0
7px
;
h5
{
color
:
#5c5d5e
;
}
.light-well
{
@include
border-radius
(
2px
);
color
:
#5b6169
;
font-size
:
13px
;
line-height
:
1
.6em
;
font-size
:
13px
;
line-height
:
1
.6em
;
}
}
.prepend-top-20
{
margin-top
:
20px
;
.btn-remove
{
@include
btn-middle
;
@include
btn-remove
;
float
:
left
!
important
;
}
}
...
...
@@ -446,7 +446,7 @@ pre.light-well {
/*
* Projects list rendered on dashboard and user page
*/
.projects-list
{
@include
basic-list
;
...
...
@@ -507,6 +507,10 @@ pre.light-well {
}
}
.project-show-files
{
padding-top
:
20px
;
}
.inline-form
{
display
:
inline-block
;
}
...
...
app/controllers/projects_controller.rb
浏览文件 @
c5280434
...
...
@@ -89,7 +89,10 @@ class ProjectsController < ApplicationController
if
current_user
@membership
=
@project
.
project_member_by_id
(
current_user
.
id
)
end
@ref
=
"master"
@id
=
"master"
@commit
=
@project
.
repository
.
commit
(
@ref
)
@tree
=
@project
.
repository
.
tree
(
@commit
.
id
)
render
:show
end
else
...
...
app/helpers/preferences_helper.rb
浏览文件 @
c5280434
...
...
@@ -27,7 +27,8 @@ module PreferencesHelper
def
project_view_choices
[
[
'Readme (default)'
,
:readme
],
[
'Activity view'
,
:activity
]
[
'Activity view'
,
:activity
],
[
'Files view'
,
:files
]
]
end
...
...
@@ -43,4 +44,9 @@ module PreferencesHelper
!
current_user
||
current_user
.
project_view
==
'readme'
end
def
current_user_default_project_view
(
current_user
&&
current_user
.
project_view
)
||
'readme'
end
end
app/models/user.rb
浏览文件 @
c5280434
...
...
@@ -176,7 +176,7 @@ class User < ActiveRecord::Base
# User's Project preference
# Note: When adding an option, it MUST go on the end of the array.
enum
project_view:
[
:readme
,
:activity
]
enum
project_view:
[
:readme
,
:activity
,
:files
]
alias_attribute
:private_token
,
:authentication_token
...
...
app/views/projects/_files.html.haml
0 → 100644
浏览文件 @
c5280434
=
render
'projects/last_push'
.tree-ref-holder
=
render
'shared/ref_switcher'
,
destination:
'tree'
,
path:
@path
-
if
can?
current_user
,
:download_code
,
@project
.tree-download-holder
=
render
'projects/repositories/download_archive'
,
ref:
@ref
,
btn_class:
'btn-group pull-right hidden-xs hidden-sm'
,
split_button:
true
#tree-holder
.tree-holder.clearfix
=
render
"projects/tree/tree"
,
tree:
@tree
app/views/projects/show.html.haml
浏览文件 @
c5280434
...
...
@@ -64,13 +64,8 @@
Archived project! Repository is read-only
%section
-
if
prefer_readme?
.project-show-readme
=
render
'projects/readme'
-
else
.project-show-activity
=
render
'projects/activity'
%div
{
class:
"project-show-#{current_user_default_project_view}"
}
=
render
current_user_default_project_view
-
if
current_user
-
access
=
user_max_access_in_project
(
current_user
,
@project
)
...
...
app/views/projects/tree/_blob_item.html.haml
浏览文件 @
c5280434
...
...
@@ -4,5 +4,5 @@
%span
.str-truncated
=
link_to
blob_item
.
name
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@id
||
@commit
.
id
,
blob_item
.
name
))
%td
.tree_time_ago.cgray
=
render
'spinner'
=
render
'
projects/tree/
spinner'
%td
.hidden-xs.tree_commit
app/views/projects/tree/_tree_item.html.haml
浏览文件 @
c5280434
...
...
@@ -5,5 +5,5 @@
-
path
=
flatten_tree
(
tree_item
)
=
link_to
path
,
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@id
||
@commit
.
id
,
path
))
%td
.tree_time_ago.cgray
=
render
'spinner'
=
render
'
projects/tree/
spinner'
%td
.hidden-xs.tree_commit
spec/controllers/projects_controller_spec.rb
浏览文件 @
c5280434
...
...
@@ -21,6 +21,31 @@ describe ProjectsController do
expect
(
response
.
body
).
to
include
(
"content='
#{
content
}
'"
)
end
end
context
"rendering default project view"
do
render_views
it
"shold render the activity view"
,
focus:
true
do
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
user
).
to
receive
(
:project_view
).
and_return
(
'activity'
)
get
:show
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
expect
(
response
).
to
render_template
(
'_activity'
)
end
it
"shold render the readme view"
,
focus:
true
do
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
user
).
to
receive
(
:project_view
).
and_return
(
'readme'
)
get
:show
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
expect
(
response
).
to
render_template
(
'_readme'
)
end
it
"shold render the files view"
,
focus:
true
do
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
user
).
to
receive
(
:project_view
).
and_return
(
'files'
)
get
:show
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
expect
(
response
).
to
render_template
(
'_files'
)
end
end
end
describe
"POST #toggle_star"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录