summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-18 12:56:02 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-18 15:53:24 -0500
commit6889bb0449e7e28b0c0393c08d09e5fe0f035043 (patch)
tree4512149823e6d69379418dcb14d70024939c9de0
parent67312fceaa69abb2bc88aa62601625e9f6a62270 (diff)
downloadgitlab-ce-dm-fix-readme-project-view.tar.gz
Remove readme project_view optiondm-fix-readme-project-view
-rw-r--r--app/assets/javascripts/dispatcher.js2
-rw-r--r--app/assets/stylesheets/pages/projects.scss22
-rw-r--r--app/models/user.rb9
-rw-r--r--app/views/projects/_readme.html.haml21
-rw-r--r--spec/migrations/migrate_user_project_view_spec.rb7
5 files changed, 15 insertions, 46 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index 283a4fd4912..360a1a237f7 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -261,6 +261,8 @@ const ShortcutsBlob = require('./shortcuts_blob');
new NotificationsForm();
if ($('#tree-slider').length) {
new TreeView();
+ }
+ if ($('.blob-viewer').length) {
new BlobViewer();
}
break;
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index ed4a5474034..33b03951ff4 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -669,28 +669,6 @@ pre.light-well {
}
}
-.project-show-readme {
- .row-content-block {
- background-color: inherit;
- border: none;
- }
-
- .readme-holder {
- padding: $gl-padding 0;
- border-top: 0;
-
- .edit-project-readme {
- z-index: 2;
- position: relative;
- }
-
- .wiki h1 {
- border-bottom: none;
- padding: 0;
- }
- }
-}
-
.git-clone-holder {
width: 380px;
diff --git a/app/models/user.rb b/app/models/user.rb
index c7160a6af14..dcdb7cf7729 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -166,8 +166,13 @@ 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 array.
- enum project_view: [:readme, :activity, :files]
+ #
+ # 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 }
alias_attribute :private_token, :authentication_token
diff --git a/app/views/projects/_readme.html.haml b/app/views/projects/_readme.html.haml
deleted file mode 100644
index cf09d9db6b7..00000000000
--- a/app/views/projects/_readme.html.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-- if readme = @repository.readme
- %article.readme-holder
- .pull-right
- - if can?(current_user, :push_code, @project)
- = link_to icon('pencil'), namespace_project_edit_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.path)), class: 'light edit-project-readme'
-
- = 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.
diff --git a/spec/migrations/migrate_user_project_view_spec.rb b/spec/migrations/migrate_user_project_view_spec.rb
index dacaa834aa9..70f8e0d6082 100644
--- a/spec/migrations/migrate_user_project_view_spec.rb
+++ b/spec/migrations/migrate_user_project_view_spec.rb
@@ -5,7 +5,12 @@ require Rails.root.join('db', 'post_migrate', '20170406142253_migrate_user_proje
describe MigrateUserProjectView do
let(:migration) { described_class.new }
- let!(:user) { create(:user, project_view: 'readme') }
+ let!(:user) { create(:user) }
+
+ before do
+ # 0 is the numeric value for the old 'readme' option
+ user.update_column(:project_view, 0)
+ end
describe '#up' do
it 'updates project view setting with new value' do