BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
c5280434
Commit
c5280434
authored
Oct 01, 2015
by
Cristian Bica
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow users to select the Files view as default project view
parent
2e8a3e39
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
52 deletions
+96
-52
projects.scss
app/assets/stylesheets/pages/projects.scss
+44
-40
projects_controller.rb
app/controllers/projects_controller.rb
+4
-1
preferences_helper.rb
app/helpers/preferences_helper.rb
+7
-1
user.rb
app/models/user.rb
+1
-1
_files.html.haml
app/views/projects/_files.html.haml
+11
-0
show.html.haml
app/views/projects/show.html.haml
+2
-7
_blob_item.html.haml
app/views/projects/tree/_blob_item.html.haml
+1
-1
_tree_item.html.haml
app/views/projects/tree/_tree_item.html.haml
+1
-1
projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+25
-0
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
c5280434
.alert_holder
{
.alert_holder
{
margin
:
-16px
;
margin
:
-16px
;
.alert-link
{
.alert-link
{
font-weight
:
normal
;
font-weight
:
normal
;
}
}
...
@@ -31,20 +31,20 @@
...
@@ -31,20 +31,20 @@
margin
:
-
$gl-padding
;
margin
:
-
$gl-padding
;
padding
:
$gl-padding
;
padding
:
$gl-padding
;
padding
:
44px
0
17px
0
;
padding
:
44px
0
17px
0
;
.project-identicon-holder
{
.project-identicon-holder
{
margin-bottom
:
16px
;
margin-bottom
:
16px
;
.avatar
,
.identicon
{
.avatar
,
.identicon
{
margin
:
0
auto
;
margin
:
0
auto
;
float
:
none
;
float
:
none
;
}
}
.identicon
{
.identicon
{
@include
border-radius
(
50%
);
@include
border-radius
(
50%
);
}
}
}
}
.project-home-dropdown
{
.project-home-dropdown
{
margin
:
11px
3px
0
;
margin
:
11px
3px
0
;
}
}
...
@@ -86,15 +86,15 @@
...
@@ -86,15 +86,15 @@
top
:
17px
;
top
:
17px
;
margin-bottom
:
44px
;
margin-bottom
:
44px
;
}
}
.project-repo-buttons
{
.project-repo-buttons
{
margin-top
:
12px
;
margin-top
:
12px
;
margin-bottom
:
0px
;
margin-bottom
:
0px
;
.btn
{
.btn
{
@include
bnt-project
;
@include
bnt-project
;
@include
btn-info
;
@include
btn-info
;
.count
{
.count
{
display
:
inline-block
;
display
:
inline-block
;
}
}
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
.split-one
{
.split-one
{
display
:
inline-table
;
display
:
inline-table
;
margin-right
:
12px
;
margin-right
:
12px
;
a
{
a
{
margin
:
-1px
!
important
;
margin
:
-1px
!
important
;
}
}
...
@@ -129,10 +129,10 @@
...
@@ -129,10 +129,10 @@
&
.git-protocols
{
&
.git-protocols
{
padding
:
0
;
padding
:
0
;
border
:
none
;
border
:
none
;
.input-group-btn
:last-child
>
.btn
{
.input-group-btn
:last-child
>
.btn
{
@include
border-radius-right
(
0
);
@include
border-radius-right
(
0
);
border-left
:
1px
solid
#c6cacf
;
border-left
:
1px
solid
#c6cacf
;
margin-left
:
-2px
!
important
;
margin-left
:
-2px
!
important
;
}
}
...
@@ -141,55 +141,55 @@
...
@@ -141,55 +141,55 @@
}
}
.projects-search-form
{
.projects-search-form
{
.input-group
.form-control
{
.input-group
.form-control
{
height
:
42px
;
height
:
42px
;
}
}
}
}
.input-group-btn
{
.input-group-btn
{
.btn
{
.btn
{
@include
bnt-project
;
@include
bnt-project
;
@include
btn-middle
;
@include
btn-middle
;
&
:hover
{
&
:hover
{
outline
:
none
;
outline
:
none
;
}
}
&
:focus
{
&
:focus
{
outline
:
none
;
outline
:
none
;
}
}
&
:active
{
&
:active
{
outline
:
none
;
outline
:
none
;
}
}
}
}
.active
{
.active
{
@include
box-shadow
(
inset
0
0
4px
rgba
(
0
,
0
,
0
,
0
.12
));
@include
box-shadow
(
inset
0
0
4px
rgba
(
0
,
0
,
0
,
0
.12
));
border
:
1px
solid
#c6cacf
!
important
;
border
:
1px
solid
#c6cacf
!
important
;
background-color
:
#e4e7ed
!
important
;
background-color
:
#e4e7ed
!
important
;
}
}
.btn-green
{
.btn-green
{
@include
btn-green
@include
btn-green
}
}
}
}
.split-repo-buttons
{
.split-repo-buttons
{
display
:
inline-table
;
display
:
inline-table
;
margin
:
0
12px
0
12px
;
margin
:
0
12px
0
12px
;
.btn
{
.btn
{
@include
bnt-project
;
@include
bnt-project
;
@include
btn-info
;
@include
btn-info
;
}
}
.dropdown-toggle
{
.dropdown-toggle
{
margin
:
-5px
;
margin
:
-5px
;
}
}
}
}
#notification-form
{
#notification-form
{
...
@@ -202,7 +202,7 @@
...
@@ -202,7 +202,7 @@
.open
>
.dropdown-new.btn
{
.open
>
.dropdown-new.btn
{
@include
box-shadow
(
inset
0
0
4px
rgba
(
0
,
0
,
0
,
0
.12
));
@include
box-shadow
(
inset
0
0
4px
rgba
(
0
,
0
,
0
,
0
.12
));
border
:
1px
solid
#c6cacf
!
important
;
border
:
1px
solid
#c6cacf
!
important
;
background-color
:
#e4e7ed
!
important
;
background-color
:
#e4e7ed
!
important
;
text-transform
:
uppercase
;
text-transform
:
uppercase
;
...
@@ -214,21 +214,21 @@
...
@@ -214,21 +214,21 @@
.dropdown-menu
{
.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
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
);
@include
border-radius
(
0px
);
border
:
none
;
border
:
none
;
padding
:
16px
0
;
padding
:
16px
0
;
font-size
:
14px
;
font-size
:
14px
;
font-weight
:
100
;
font-weight
:
100
;
li
a
{
li
a
{
color
:
#5f697a
;
color
:
#5f697a
;
line-height
:
30px
;
line-height
:
30px
;
&
:hover
{
&
:hover
{
background-color
:
#3084bb
!
important
;
background-color
:
#3084bb
!
important
;
}
}
}
}
.fa-fw
{
.fa-fw
{
margin-right
:
8px
;
margin-right
:
8px
;
}
}
...
@@ -370,7 +370,7 @@ table.table.protected-branches-list tr.no-border {
...
@@ -370,7 +370,7 @@ table.table.protected-branches-list tr.no-border {
ul
.nav-pills
{
ul
.nav-pills
{
display
:inline-block
;
display
:inline-block
;
}
}
.nav-pills
li
{
.nav-pills
li
{
display
:inline
;
display
:inline
;
}
}
...
@@ -378,12 +378,12 @@ table.table.protected-branches-list tr.no-border {
...
@@ -378,12 +378,12 @@ table.table.protected-branches-list tr.no-border {
.nav
>
li
>
a
{
.nav
>
li
>
a
{
@include
btn-info
;
@include
btn-info
;
@include
bnt-project
;
@include
bnt-project
;
background-color
:
transparent
;
background-color
:
transparent
;
border
:
1px
solid
#f7f8fa
;
border
:
1px
solid
#f7f8fa
;
margin-left
:
12px
;
margin-left
:
12px
;
}
}
li
{
li
{
display
:inline
;
display
:inline
;
}
}
...
@@ -418,27 +418,27 @@ pre.light-well {
...
@@ -418,27 +418,27 @@ pre.light-well {
.git-empty
{
.git-empty
{
margin
:
0
7px
0
7px
;
margin
:
0
7px
0
7px
;
h5
{
h5
{
color
:
#5c5d5e
;
color
:
#5c5d5e
;
}
}
.light-well
{
.light-well
{
@include
border-radius
(
2px
);
@include
border-radius
(
2px
);
color
:
#5b6169
;
color
:
#5b6169
;
font-size
:
13px
;
font-size
:
13px
;
line-height
:
1
.6em
;
line-height
:
1
.6em
;
}
}
}
}
.prepend-top-20
{
.prepend-top-20
{
margin-top
:
20px
;
margin-top
:
20px
;
.btn-remove
{
.btn-remove
{
@include
btn-middle
;
@include
btn-middle
;
@include
btn-remove
;
@include
btn-remove
;
float
:
left
!
important
;
float
:
left
!
important
;
}
}
}
}
...
@@ -446,7 +446,7 @@ pre.light-well {
...
@@ -446,7 +446,7 @@ pre.light-well {
/*
/*
* Projects list rendered on dashboard and user page
* Projects list rendered on dashboard and user page
*/
*/
.projects-list
{
.projects-list
{
@include
basic-list
;
@include
basic-list
;
...
@@ -507,6 +507,10 @@ pre.light-well {
...
@@ -507,6 +507,10 @@ pre.light-well {
}
}
}
}
.project-show-files
{
padding-top
:
20px
;
}
.inline-form
{
.inline-form
{
display
:
inline-block
;
display
:
inline-block
;
}
}
...
...
app/controllers/projects_controller.rb
View file @
c5280434
...
@@ -89,7 +89,10 @@ class ProjectsController < ApplicationController
...
@@ -89,7 +89,10 @@ class ProjectsController < ApplicationController
if
current_user
if
current_user
@membership
=
@project
.
project_member_by_id
(
current_user
.
id
)
@membership
=
@project
.
project_member_by_id
(
current_user
.
id
)
end
end
@ref
=
"master"
@id
=
"master"
@commit
=
@project
.
repository
.
commit
(
@ref
)
@tree
=
@project
.
repository
.
tree
(
@commit
.
id
)
render
:show
render
:show
end
end
else
else
...
...
app/helpers/preferences_helper.rb
View file @
c5280434
...
@@ -27,7 +27,8 @@ module PreferencesHelper
...
@@ -27,7 +27,8 @@ module PreferencesHelper
def
project_view_choices
def
project_view_choices
[
[
[
'Readme (default)'
,
:readme
],
[
'Readme (default)'
,
:readme
],
[
'Activity view'
,
:activity
]
[
'Activity view'
,
:activity
],
[
'Files view'
,
:files
]
]
]
end
end
...
@@ -43,4 +44,9 @@ module PreferencesHelper
...
@@ -43,4 +44,9 @@ module PreferencesHelper
!
current_user
||
!
current_user
||
current_user
.
project_view
==
'readme'
current_user
.
project_view
==
'readme'
end
end
def
current_user_default_project_view
(
current_user
&&
current_user
.
project_view
)
||
'readme'
end
end
end
app/models/user.rb
View file @
c5280434
...
@@ -176,7 +176,7 @@ class User < ActiveRecord::Base
...
@@ -176,7 +176,7 @@ class User < ActiveRecord::Base
# User's Project preference
# User's Project preference
# Note: When adding an option, it MUST go on the end of the array.
# 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
alias_attribute
:private_token
,
:authentication_token
...
...
app/views/projects/_files.html.haml
0 → 100644
View file @
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
View file @
c5280434
...
@@ -64,13 +64,8 @@
...
@@ -64,13 +64,8 @@
Archived project! Repository is read-only
Archived project! Repository is read-only
%section
%section
-
if
prefer_readme?
%div
{
class:
"project-show-#{current_user_default_project_view}"
}
.project-show-readme
=
render
current_user_default_project_view
=
render
'projects/readme'
-
else
.project-show-activity
=
render
'projects/activity'
-
if
current_user
-
if
current_user
-
access
=
user_max_access_in_project
(
current_user
,
@project
)
-
access
=
user_max_access_in_project
(
current_user
,
@project
)
...
...
app/views/projects/tree/_blob_item.html.haml
View file @
c5280434
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
%span
.str-truncated
%span
.str-truncated
=
link_to
blob_item
.
name
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@id
||
@commit
.
id
,
blob_item
.
name
))
=
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
%td
.tree_time_ago.cgray
=
render
'spinner'
=
render
'
projects/tree/
spinner'
%td
.hidden-xs.tree_commit
%td
.hidden-xs.tree_commit
app/views/projects/tree/_tree_item.html.haml
View file @
c5280434
...
@@ -5,5 +5,5 @@
...
@@ -5,5 +5,5 @@
-
path
=
flatten_tree
(
tree_item
)
-
path
=
flatten_tree
(
tree_item
)
=
link_to
path
,
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@id
||
@commit
.
id
,
path
))
=
link_to
path
,
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@id
||
@commit
.
id
,
path
))
%td
.tree_time_ago.cgray
%td
.tree_time_ago.cgray
=
render
'spinner'
=
render
'
projects/tree/
spinner'
%td
.hidden-xs.tree_commit
%td
.hidden-xs.tree_commit
spec/controllers/projects_controller_spec.rb
View file @
c5280434
...
@@ -21,6 +21,31 @@ describe ProjectsController do
...
@@ -21,6 +21,31 @@ describe ProjectsController do
expect
(
response
.
body
).
to
include
(
"content='
#{
content
}
'"
)
expect
(
response
.
body
).
to
include
(
"content='
#{
content
}
'"
)
end
end
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
end
describe
"POST #toggle_star"
do
describe
"POST #toggle_star"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment