summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee1
-rw-r--r--app/assets/javascripts/pager.js.coffee2
-rw-r--r--app/assets/stylesheets/generic/sidebar.scss15
-rw-r--r--app/assets/stylesheets/themes/gitlab-theme.scss1
-rw-r--r--app/controllers/profiles/preferences_controller.rb1
-rw-r--r--app/helpers/preferences_helper.rb12
-rw-r--r--app/helpers/projects_helper.rb10
-rw-r--r--app/models/user.rb4
-rw-r--r--app/views/profiles/preferences/show.html.haml8
-rw-r--r--app/views/projects/_activity.html.haml15
-rw-r--r--app/views/projects/_home_panel.html.haml2
-rw-r--r--app/views/projects/_readme.html.haml24
-rw-r--r--app/views/projects/activity.html.haml13
-rw-r--r--app/views/projects/buttons/_dropdown.html.haml31
-rw-r--r--app/views/projects/show.html.haml27
-rw-r--r--app/views/shared/_field.html.haml4
-rw-r--r--db/migrate/20150713160110_add_project_view_to_users.rb5
-rw-r--r--db/schema.rb3
-rw-r--r--doc/gitlab-basics/create-your-ssh-keys.md2
-rw-r--r--doc/profile/preferences.md6
20 files changed, 125 insertions, 61 deletions
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index 8ceaef81a07..2ab148bc296 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -63,7 +63,6 @@ class Dispatcher
when 'projects:commits:show'
shortcut_handler = new ShortcutsNavigation()
when 'projects:activity'
- new Activities()
shortcut_handler = new ShortcutsNavigation()
when 'projects:show'
shortcut_handler = new ShortcutsNavigation()
diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee
index fe83dc0410e..d639303aed3 100644
--- a/app/assets/javascripts/pager.js.coffee
+++ b/app/assets/javascripts/pager.js.coffee
@@ -12,7 +12,7 @@
@loading.show()
$.ajax
type: "GET"
- url: location.href
+ url: $(".content_list").data('href') || location.href
data: "limit=" + @limit + "&offset=" + @offset
complete: =>
@loading.hide()
diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss
index f3950cef6bc..4e9daa5ea34 100644
--- a/app/assets/stylesheets/generic/sidebar.scss
+++ b/app/assets/stylesheets/generic/sidebar.scss
@@ -2,6 +2,8 @@
.sidebar-wrapper {
position: fixed;
top: 0;
+ bottom: 0;
+ overflow-y: scroll;
left: 0;
height: 100%;
transition-duration: .3s;
@@ -21,8 +23,9 @@
}
.nav-sidebar {
+ margin-top: 29 + $header-height;
+ margin-bottom: 50px;
transition-duration: .3s;
- margin: 0;
list-style: none;
overflow: hidden;
@@ -39,7 +42,7 @@
}
a {
- padding: 7px 15px;
+ padding: 8px 15px;
font-size: 13px;
line-height: 18px;
color: $gray;
@@ -88,9 +91,6 @@
width: $sidebar_width;
.nav-sidebar {
- margin-top: 29px;
- position: fixed;
- top: $header-height;
width: $sidebar_width;
}
@@ -114,9 +114,6 @@
width: $sidebar_collapsed_width;
.nav-sidebar {
- margin-top: 29px;
- position: fixed;
- top: $header-height;
width: $sidebar_collapsed_width;
li a {
@@ -178,7 +175,7 @@
}
.sidebar-user {
- position: absolute;
+ position: fixed;
bottom: 0;
width: $sidebar_width;
padding: 10px;
diff --git a/app/assets/stylesheets/themes/gitlab-theme.scss b/app/assets/stylesheets/themes/gitlab-theme.scss
index dc47b108100..e5325bbdc74 100644
--- a/app/assets/stylesheets/themes/gitlab-theme.scss
+++ b/app/assets/stylesheets/themes/gitlab-theme.scss
@@ -38,6 +38,7 @@
border-right: 1px solid $color-darker;
.sidebar-user {
+ background: $color-darker;
color: $color-light;
&:hover {
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb
index 538b09ca54d..f83b4abd1e2 100644
--- a/app/controllers/profiles/preferences_controller.rb
+++ b/app/controllers/profiles/preferences_controller.rb
@@ -32,6 +32,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController
params.require(:user).permit(
:color_scheme_id,
:dashboard,
+ :project_view,
:theme_id
)
end
diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb
index bceff4fd52e..ea774e28ecf 100644
--- a/app/helpers/preferences_helper.rb
+++ b/app/helpers/preferences_helper.rb
@@ -42,6 +42,13 @@ module PreferencesHelper
end
end
+ def project_view_choices
+ [
+ ['Readme (default)', :readme],
+ ['Activity view', :activity]
+ ]
+ end
+
def user_application_theme
theme = Gitlab::Themes.by_id(current_user.try(:theme_id))
theme.css_class
@@ -50,4 +57,9 @@ module PreferencesHelper
def user_color_scheme_class
COLOR_SCHEMES[current_user.try(:color_scheme_id)] if defined?(current_user)
end
+
+ def prefer_readme?
+ !current_user ||
+ current_user.project_view == 'readme'
+ end
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index aa15398cbed..78f24dbd7ef 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -248,16 +248,6 @@ module ProjectsHelper
end
end
- def service_field_value(type, value)
- return value unless type == 'password'
-
- if value.present?
- "***********"
- else
- nil
- end
- end
-
def user_max_access_in_project(user, project)
level = project.team.max_member_access(user)
diff --git a/app/models/user.rb b/app/models/user.rb
index 317257a2500..fb330ff7185 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -177,6 +177,10 @@ class User < ActiveRecord::Base
# Note: When adding an option, it MUST go on the end of the array.
enum dashboard: [:projects, :stars]
+ # User's Project preference
+ # Note: When adding an option, it MUST go on the end of the array.
+ enum project_view: [:readme, :activity]
+
alias_attribute :private_token, :authentication_token
delegate :path, to: :namespace, allow_nil: true, prefix: true
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
index aa99280fde6..1134317ee06 100644
--- a/app/views/profiles/preferences/show.html.haml
+++ b/app/views/profiles/preferences/show.html.haml
@@ -38,5 +38,13 @@
= link_to('(?)', help_page_path('profile', 'preferences') + '#default-dashboard', target: '_blank')
.col-sm-10
= f.select :dashboard, dashboard_choices, {}, class: 'form-control'
+ .form-group
+ = f.label :project_view, class: 'control-label' do
+ Project view
+ = link_to('(?)', help_page_path('profile', 'preferences') + '#default-project-view', target: '_blank')
+ .col-sm-10
+ = f.select :project_view, project_view_choices, {}, class: 'form-control'
+ .help-block
+ Choose what content you want to see when visit project page
.panel-footer
= f.submit 'Save', class: 'btn btn-save'
diff --git a/app/views/projects/_activity.html.haml b/app/views/projects/_activity.html.haml
new file mode 100644
index 00000000000..ee02b7f6a6c
--- /dev/null
+++ b/app/views/projects/_activity.html.haml
@@ -0,0 +1,15 @@
+= render 'projects/last_push'
+.hidden-xs
+ - if current_user
+ %ul.nav.nav-pills.event_filter.pull-right
+ %li
+ = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do
+ %i.fa.fa-rss
+
+ = render 'shared/event_filter'
+ %hr
+.content_list{:"data-href" => activity_project_path(@project)}
+= spinner
+
+:coffeescript
+ new Activities()
diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml
index 95c84c96c41..7b6b4b35c8d 100644
--- a/app/views/projects/_home_panel.html.haml
+++ b/app/views/projects/_home_panel.html.haml
@@ -23,4 +23,6 @@
= link_to archive_namespace_project_repository_path(@project.namespace, @project, ref: @ref, format: 'zip'), class: 'btn', rel: 'nofollow' do
%i.fa.fa-download
+ = render 'projects/buttons/dropdown'
+
= render "shared/clone_panel"
diff --git a/app/views/projects/_readme.html.haml b/app/views/projects/_readme.html.haml
new file mode 100644
index 00000000000..5038edb95ed
--- /dev/null
+++ b/app/views/projects/_readme.html.haml
@@ -0,0 +1,24 @@
+- if readme = @repository.readme
+ %article.readme-holder#README
+ .clearfix
+ .pull-right
+ &nbsp;
+ - if can?(current_user, :push_code, @project)
+ = link_to namespace_project_edit_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do
+ %i.fa.fa-pencil
+ .wiki
+ = cache(readme_cache_key) do
+ = render_readme(readme)
+- else
+ %h3.page-title
+ This project does not have README yet
+ - if can?(current_user, :push_code, @project)
+ %p.slead
+ A
+ %code README
+ file contains information about other files in a repository and is commonly
+ distributed with computer software, forming part of its documentation.
+ %br
+ We recommend you to
+ = link_to "add README", new_readme_path, class: 'underlined-link'
+ file to the repository and GitLab will render it here instead of this message.
diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml
index b486cd4ded4..65674913bb0 100644
--- a/app/views/projects/activity.html.haml
+++ b/app/views/projects/activity.html.haml
@@ -1,12 +1 @@
-= render 'projects/last_push'
-.hidden-xs
- - if current_user
- %ul.nav.nav-pills.event_filter.pull-right
- %li
- = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), title: "Feed", class: 'rss-btn' do
- %i.fa.fa-rss
-
- = render 'shared/event_filter'
- %hr
-.content_list
-= spinner
+= render 'projects/activity'
diff --git a/app/views/projects/buttons/_dropdown.html.haml b/app/views/projects/buttons/_dropdown.html.haml
new file mode 100644
index 00000000000..99c2ed62545
--- /dev/null
+++ b/app/views/projects/buttons/_dropdown.html.haml
@@ -0,0 +1,31 @@
+- if current_user
+ %span.dropdown
+ %a.dropdown-toggle.btn.btn-new{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-plus
+ %ul.dropdown-menu
+ - if @project.issues_enabled && can?(current_user, :create_issue, @project)
+ %li
+ = link_to url_for_new_issue, title: "New Issue" do
+ New issue
+ - if @project.merge_requests_enabled && can?(current_user, :create_merge_request, @project)
+ %li
+ = link_to new_namespace_project_merge_request_path(@project.namespace, @project), title: "New Merge Request" do
+ New merge request
+ - if @project.snippets_enabled && can?(current_user, :create_snippet, @project)
+ %li
+ = link_to new_namespace_project_snippet_path(@project.namespace, @project), title: "New Snippet" do
+ New snippet
+ - if can?(current_user, :admin_project_member, @project)
+ %li
+ = link_to namespace_project_project_members_path(@project.namespace, @project), title: "New project member" do
+ New project member
+ - if can? current_user, :push_code, @project
+ %li.divider
+ %li
+ = link_to new_namespace_project_branch_path(@project.namespace, @project) do
+ New git branch
+ %li
+ = link_to new_namespace_project_tag_path(@project.namespace, @project) do
+ New git tag
+
+
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 5c2ac484ceb..98d9053eb1d 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -41,31 +41,10 @@
%hr
%section
- - if readme = @repository.readme
- %article.readme-holder#README
- .clearfix
- .pull-right
- &nbsp;
- - if can?(current_user, :push_code, @project)
- = link_to namespace_project_edit_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do
- %i.fa.fa-pencil
- .wiki
- = cache(readme_cache_key) do
- = render_readme(readme)
+ - if prefer_readme?
+ = render 'projects/readme'
- else
- %h3.page-title
- This project does not have README yet
- - if can?(current_user, :push_code, @project)
- %p.slead
- A
- %code README
- file contains information about other files in a repository and is commonly
- distributed with computer software, forming part of its documentation.
- %br
- We recommend you to
- = link_to "add README", new_readme_path, class: 'underlined-link'
- file to the repository and GitLab will render it here instead of this message.
-
+ = render 'projects/activity'
- if current_user
diff --git a/app/views/shared/_field.html.haml b/app/views/shared/_field.html.haml
index 30d37dceb30..45ec49280d2 100644
--- a/app/views/shared/_field.html.haml
+++ b/app/views/shared/_field.html.haml
@@ -1,6 +1,6 @@
- name = field[:name]
- title = field[:title] || name.humanize
-- value = service_field_value(field[:type], @service.send(name))
+- value = @service.send(name)
- type = field[:type]
- placeholder = field[:placeholder]
- choices = field[:choices]
@@ -19,6 +19,6 @@
- elsif type == 'select'
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
- = form.password_field name, placeholder: value, class: 'form-control'
+ = form.password_field name, value: value, class: 'form-control'
- if help
%span.help-block= help
diff --git a/db/migrate/20150713160110_add_project_view_to_users.rb b/db/migrate/20150713160110_add_project_view_to_users.rb
new file mode 100644
index 00000000000..fe3d206df89
--- /dev/null
+++ b/db/migrate/20150713160110_add_project_view_to_users.rb
@@ -0,0 +1,5 @@
+class AddProjectViewToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :project_view, :integer, default: 0
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index fb0982b10fd..d6c34a77ee6 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20150620233230) do
+ActiveRecord::Schema.define(version: 20150713160110) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -517,6 +517,7 @@ ActiveRecord::Schema.define(version: 20150620233230) do
t.text "otp_backup_codes"
t.string "public_email", default: "", null: false
t.integer "dashboard", default: 0
+ t.integer "project_view", default: 0
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
diff --git a/doc/gitlab-basics/create-your-ssh-keys.md b/doc/gitlab-basics/create-your-ssh-keys.md
index cb699588cac..e1acc2bd65b 100644
--- a/doc/gitlab-basics/create-your-ssh-keys.md
+++ b/doc/gitlab-basics/create-your-ssh-keys.md
@@ -28,7 +28,7 @@ You need to connect your computer to your GitLab account through SSH Keys. They
## To generate an SSH Key on your commandline
-* Go to your [commandline](start-using-git.md) and follow the [instructions](../ssh/README.md) to generate it
+* Go to your [commandline](start-using-git.md) and follow the [instructions](https://gitlab.com/help/ssh/README) to generate it
* Copy the SSH Key that your commandline created and paste it on the "Key" box on the GitLab page. The title will be added automatically
diff --git a/doc/profile/preferences.md b/doc/profile/preferences.md
index ce5f1936782..f17bbe8f2aa 100644
--- a/doc/profile/preferences.md
+++ b/doc/profile/preferences.md
@@ -30,3 +30,9 @@ will be. Setting it to **Starred Projects** will make that Dashboard view the
default when signing in or clicking the application logo in the upper left.
The default is **Your Projects**.
+
+### Default Project view
+
+It allows user to choose what content he or she want to see on project page.
+
+The default is **Readme**.