Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
a42d7980
Commit
a42d7980
authored
Oct 16, 2017
by
Annabel Dunstone Gray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add readme only option as project view
parent
30083458
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
14 deletions
+37
-14
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+2
-1
app/models/user.rb
app/models/user.rb
+3
-7
app/views/projects/_readme.html.haml
app/views/projects/_readme.html.haml
+18
-0
changelogs/unreleased/30140-restore-readme-only-preference.yml
...elogs/unreleased/30140-restore-readme-only-preference.yml
+5
-0
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+8
-0
spec/migrations/migrate_user_project_view_spec.rb
spec/migrations/migrate_user_project_view_spec.rb
+1
-6
No files found.
app/helpers/preferences_helper.rb
View file @
a42d7980
...
...
@@ -36,7 +36,8 @@ module PreferencesHelper
def
project_view_choices
[
[
'Files and Readme (default)'
,
:files
],
[
'Activity'
,
:activity
]
[
'Activity'
,
:activity
],
[
'Readme'
,
:readme
]
]
end
...
...
app/models/user.rb
View file @
a42d7980
...
...
@@ -182,13 +182,9 @@ class User < ActiveRecord::Base
enum
dashboard:
[
:projects
,
:stars
,
:project_activity
,
:starred_project_activity
,
:groups
,
:todos
]
# User's Project preference
#
# Note: When adding an option, it MUST go on the end of the hash with a
# number higher than the current max. We cannot move options and/or change
# their numbers.
#
# We skip 0 because this was used by an option that has since been removed.
enum
project_view:
{
activity:
1
,
files:
2
}
# Note: When adding an option, it MUST go on the end of the array.
enum
project_view:
[
:readme
,
:activity
,
:files
]
alias_attribute
:private_token
,
:authentication_token
...
...
app/views/projects/_readme.html.haml
0 → 100644
View file @
a42d7980
-
if
readme
=
@repository
.
readme
%article
.file-holder.readme-holder
{
id:
'readme'
,
class:
(
"limited-width-container"
unless
fluid_layout
)
}
=
render
'projects/blob/viewer'
,
viewer:
readme
.
rich_viewer
,
viewer_url:
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@repository
.
root_ref
,
readme
.
path
),
viewer: :rich
,
format: :json
)
-
else
.row-content-block.second-block.center
%h3
.page-title
This project does not have a README yet
-
if
can?
(
current_user
,
:push_code
,
@project
)
%p
A
%code
README
file contains information about other files in a repository and is commonly
distributed with computer software, forming part of its documentation.
%p
We recommend you to
=
link_to
"add a README"
,
add_special_file_path
(
@project
,
file_name:
'README.md'
),
class:
'underlined-link'
file to the repository and GitLab will render it here instead of this message.
changelogs/unreleased/30140-restore-readme-only-preference.yml
0 → 100644
View file @
a42d7980
---
title
:
Add readme only option as project view
merge_request
:
14900
author
:
type
:
changed
spec/controllers/projects_controller_spec.rb
View file @
a42d7980
...
...
@@ -222,6 +222,14 @@ describe ProjectsController do
get
:show
,
namespace_id:
public_project
.
namespace
,
id:
public_project
expect
(
response
).
to
render_template
(
'_files'
)
end
it
"renders the readme view"
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
,
id:
public_project
expect
(
response
).
to
render_template
(
'_readme'
)
end
end
context
"when the url contains .atom"
do
...
...
spec/migrations/migrate_user_project_view_spec.rb
View file @
a42d7980
...
...
@@ -5,12 +5,7 @@ require Rails.root.join('db', 'post_migrate', '20170406142253_migrate_user_proje
describe
MigrateUserProjectView
,
:truncate
do
let
(
:migration
)
{
described_class
.
new
}
let!
(
:user
)
{
create
(
:user
)
}
before
do
# 0 is the numeric value for the old 'readme' option
user
.
update_column
(
:project_view
,
0
)
end
let!
(
:user
)
{
create
(
:user
,
project_view:
'readme'
)
}
describe
'#up'
do
it
'updates project view setting with new value'
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