summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/dropzone_input.js.coffee1
-rw-r--r--app/assets/javascripts/notes.js.coffee5
-rw-r--r--app/assets/javascripts/syntax_highlight.coffee10
-rw-r--r--app/assets/stylesheets/pages/notes.scss2
-rw-r--r--app/controllers/dashboard/projects_controller.rb15
-rw-r--r--app/controllers/dashboard/snippets_controller.rb10
-rw-r--r--app/controllers/dashboard_controller.rb19
-rw-r--r--app/controllers/explore/application_controller.rb2
-rw-r--r--app/controllers/explore/groups_controller.rb3
-rw-r--r--app/controllers/explore/projects_controller.rb3
-rw-r--r--app/controllers/explore/snippets_controller.rb6
-rw-r--r--app/controllers/groups_controller.rb4
-rw-r--r--app/controllers/help_controller.rb2
-rw-r--r--app/controllers/invites_controller.rb4
-rw-r--r--app/controllers/projects/project_members_controller.rb2
-rw-r--r--app/controllers/projects_controller.rb6
-rw-r--r--app/controllers/root_controller.rb7
-rw-r--r--app/controllers/snippets_controller.rb8
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/services/files/create_service.rb2
-rw-r--r--app/views/dashboard/_activities.html.haml2
-rw-r--r--app/views/dashboard/_groups_head.html.haml4
-rw-r--r--app/views/dashboard/_projects_head.html.haml4
-rw-r--r--app/views/dashboard/_snippets_head.html.haml7
-rw-r--r--app/views/dashboard/activity.html.haml4
-rw-r--r--app/views/dashboard/projects/_projects.html.haml (renamed from app/views/dashboard/_projects.html.haml)0
-rw-r--r--app/views/dashboard/projects/_zero_authorized_projects.html.haml (renamed from app/views/dashboard/_zero_authorized_projects.html.haml)0
-rw-r--r--app/views/dashboard/projects/index.atom.builder (renamed from app/views/dashboard/show.atom.builder)6
-rw-r--r--app/views/dashboard/projects/index.html.haml (renamed from app/views/dashboard/show.html.haml)6
-rw-r--r--app/views/dashboard/projects/starred.html.haml5
-rw-r--r--app/views/dashboard/snippets/index.html.haml38
-rw-r--r--app/views/explore/_head.html.haml6
-rw-r--r--app/views/explore/groups/index.html.haml8
-rw-r--r--app/views/explore/projects/index.html.haml7
-rw-r--r--app/views/explore/projects/starred.html.haml6
-rw-r--r--app/views/explore/projects/trending.html.haml12
-rw-r--r--app/views/explore/snippets/index.html.haml18
-rw-r--r--app/views/help/show.html.haml2
-rw-r--r--app/views/layouts/_page.html.haml4
-rw-r--r--app/views/layouts/devise.html.haml2
-rw-r--r--app/views/layouts/explore.html.haml6
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml45
-rw-r--r--app/views/layouts/nav/_explore.html.haml21
-rw-r--r--app/views/layouts/nav/_group.html.haml2
-rw-r--r--app/views/layouts/nav/_profile.html.haml2
-rw-r--r--app/views/layouts/nav/_project.html.haml4
-rw-r--r--app/views/layouts/snippets.html.haml7
-rw-r--r--app/views/projects/activity.html.haml1
-rw-r--r--app/views/snippets/_head.html.haml7
-rw-r--r--app/views/snippets/current_user_index.html.haml36
-rw-r--r--app/views/snippets/index.html.haml24
-rw-r--r--app/views/snippets/show.html.haml4
-rw-r--r--app/views/snippets/user_index.html.haml13
-rw-r--r--config/routes.rb20
-rw-r--r--doc/raketasks/backup_restore.md5
-rw-r--r--doc/update/patch_versions.md9
-rw-r--r--features/steps/groups.rb2
-rw-r--r--features/steps/invites.rb2
-rw-r--r--features/steps/project/project.rb4
-rw-r--r--features/steps/shared/paths.rb4
-rw-r--r--features/steps/snippets/user.rb2
-rw-r--r--lib/gitlab/markdown/sanitization_filter.rb12
-rw-r--r--spec/controllers/root_controller_spec.rb8
-rw-r--r--spec/features/atom/dashboard_spec.rb4
-rw-r--r--spec/features/profiles/preferences_spec.rb2
-rw-r--r--spec/features/security/dashboard_access_spec.rb4
-rw-r--r--spec/javascripts/syntax_highlight_spec.js.coffee42
-rw-r--r--spec/routing/routing_spec.rb6
68 files changed, 333 insertions, 219 deletions
diff --git a/app/assets/javascripts/dropzone_input.js.coffee b/app/assets/javascripts/dropzone_input.js.coffee
index a0dcaa8c27a..6f789e668af 100644
--- a/app/assets/javascripts/dropzone_input.js.coffee
+++ b/app/assets/javascripts/dropzone_input.js.coffee
@@ -167,6 +167,7 @@ class @DropzoneInput
dataType: "json"
).success (data) ->
preview.html data.body
+ preview.syntaxHighlight()
renderReferencedUsers data.references.users
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index b7f2c63c5a7..ce638c2641b 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -122,8 +122,9 @@ class @Notes
# or skip if rendered
if @isNewNote(note)
@note_ids.push(note.id)
- $('ul.main-notes-list').append(note.html)
- $('.js-syntax-highlight').syntaxHighlight()
+ $('ul.main-notes-list').
+ append(note.html).
+ syntaxHighlight()
@initTaskList()
###
diff --git a/app/assets/javascripts/syntax_highlight.coffee b/app/assets/javascripts/syntax_highlight.coffee
index 71295cd4b08..980f0232d10 100644
--- a/app/assets/javascripts/syntax_highlight.coffee
+++ b/app/assets/javascripts/syntax_highlight.coffee
@@ -1,3 +1,5 @@
+# Syntax Highlighter
+#
# Applies a syntax highlighting color scheme CSS class to any element with the
# `js-syntax-highlight` class
#
@@ -6,7 +8,13 @@
# <div class="js-syntax-highlight"></div>
#
$.fn.syntaxHighlight = ->
- $(this).addClass(gon.user_color_scheme)
+ if $(this).hasClass('js-syntax-highlight')
+ # Given the element itself, apply highlighting
+ $(this).addClass(gon.user_color_scheme)
+ else
+ # Given a parent element, recurse to any of its applicable children
+ $children = $(this).find('.js-syntax-highlight')
+ $children.syntaxHighlight() if $children.length
$(document).on 'ready page:load', ->
$('.js-syntax-highlight').syntaxHighlight()
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 2544356a5f6..2a77f065aed 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -235,8 +235,6 @@ ul.notes {
filter: alpha(opacity=0);
&:hover {
- width: 38px;
- font-size: 20px;
background: $gl-info;
color: #FFF;
@include show-add-diff-note;
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb
index da96171e885..467d0f81aca 100644
--- a/app/controllers/dashboard/projects_controller.rb
+++ b/app/controllers/dashboard/projects_controller.rb
@@ -1,6 +1,21 @@
class Dashboard::ProjectsController < Dashboard::ApplicationController
before_action :event_filter
+ def index
+ @projects = current_user.authorized_projects.sorted_by_activity.non_archived
+ @projects = @projects.includes(:namespace)
+ @last_push = current_user.recent_push
+
+ respond_to do |format|
+ format.html
+ format.atom do
+ event_filter
+ load_events
+ render layout: false
+ end
+ end
+ end
+
def starred
@projects = current_user.starred_projects
@projects = @projects.includes(:namespace, :forked_from_project, :tags)
diff --git a/app/controllers/dashboard/snippets_controller.rb b/app/controllers/dashboard/snippets_controller.rb
new file mode 100644
index 00000000000..f4354c6d8ca
--- /dev/null
+++ b/app/controllers/dashboard/snippets_controller.rb
@@ -0,0 +1,10 @@
+class Dashboard::SnippetsController < Dashboard::ApplicationController
+ def index
+ @snippets = SnippetsFinder.new.execute(current_user,
+ filter: :by_user,
+ user: current_user,
+ scope: params[:scope]
+ )
+ @snippets = @snippets.page(params[:page]).per(PER_PAGE)
+ end
+end
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index 2bc2e5e58f5..4ebb3d7276e 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -1,23 +1,8 @@
class DashboardController < Dashboard::ApplicationController
- before_action :load_projects, except: :activity
before_action :event_filter, only: :activity
respond_to :html
- def show
- @projects = @projects.includes(:namespace)
- @last_push = current_user.recent_push
-
- respond_to do |format|
- format.html
- format.atom do
- event_filter
- load_events
- render layout: false
- end
- end
- end
-
def merge_requests
@merge_requests = get_merge_requests_collection
@merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE)
@@ -50,10 +35,6 @@ class DashboardController < Dashboard::ApplicationController
protected
- def load_projects
- @projects = current_user.authorized_projects.sorted_by_activity.non_archived
- end
-
def load_events
project_ids =
if params[:filter] == "starred"
diff --git a/app/controllers/explore/application_controller.rb b/app/controllers/explore/application_controller.rb
index 4b275033d26..461fc059a3c 100644
--- a/app/controllers/explore/application_controller.rb
+++ b/app/controllers/explore/application_controller.rb
@@ -1,3 +1,5 @@
class Explore::ApplicationController < ApplicationController
+ skip_before_action :authenticate_user!, :reject_blocked
+
layout 'explore'
end
diff --git a/app/controllers/explore/groups_controller.rb b/app/controllers/explore/groups_controller.rb
index 55cda0cff17..9575a87ee41 100644
--- a/app/controllers/explore/groups_controller.rb
+++ b/app/controllers/explore/groups_controller.rb
@@ -1,7 +1,4 @@
class Explore::GroupsController < Explore::ApplicationController
- skip_before_action :authenticate_user!,
- :reject_blocked, :set_current_user_for_observers
-
def index
@groups = GroupsFinder.new.execute(current_user)
@groups = @groups.search(params[:search]) if params[:search].present?
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb
index 6c733c1ae4d..a5aeaed66c5 100644
--- a/app/controllers/explore/projects_controller.rb
+++ b/app/controllers/explore/projects_controller.rb
@@ -1,7 +1,4 @@
class Explore::ProjectsController < Explore::ApplicationController
- skip_before_action :authenticate_user!,
- :reject_blocked
-
def index
@projects = ProjectsFinder.new.execute(current_user)
@tags = @projects.tags_on(:tags)
diff --git a/app/controllers/explore/snippets_controller.rb b/app/controllers/explore/snippets_controller.rb
new file mode 100644
index 00000000000..b70ac51d06e
--- /dev/null
+++ b/app/controllers/explore/snippets_controller.rb
@@ -0,0 +1,6 @@
+class Explore::SnippetsController < Explore::ApplicationController
+ def index
+ @snippets = SnippetsFinder.new.execute(current_user, filter: :all)
+ @snippets = @snippets.page(params[:page]).per(PER_PAGE)
+ end
+end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 279c6ef0f4d..486c6b2819c 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -14,6 +14,10 @@ class GroupsController < Groups::ApplicationController
layout :determine_layout
+ def index
+ redirect_to(current_user ? dashboard_groups_path : explore_groups_path)
+ end
+
def new
@group = Group.new
end
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 71831c5380d..ad00948da51 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -1,4 +1,6 @@
class HelpController < ApplicationController
+ skip_before_action :authenticate_user!, :reject_blocked
+
layout 'help'
def index
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb
index eb3c8233530..8ef10a17f55 100644
--- a/app/controllers/invites_controller.rb
+++ b/app/controllers/invites_controller.rb
@@ -24,7 +24,7 @@ class InvitesController < ApplicationController
path =
if current_user
- dashboard_path
+ dashboard_projects_path
else
new_user_session_path
end
@@ -73,7 +73,7 @@ class InvitesController < ApplicationController
path = group_path(group)
else
label = "who knows what"
- path = dashboard_path
+ path = dashboard_projects_path
end
[label, path]
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb
index b82b6f45d59..cf73bc01c8f 100644
--- a/app/controllers/projects/project_members_controller.rb
+++ b/app/controllers/projects/project_members_controller.rb
@@ -78,7 +78,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@project.project_members.find_by(user_id: current_user).destroy
respond_to do |format|
- format.html { redirect_to dashboard_path }
+ format.html { redirect_to dashboard_projects_path }
format.js { render nothing: true }
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index dafc11d0707..f4d1a828aab 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -10,6 +10,10 @@ class ProjectsController < ApplicationController
layout :determine_layout
+ def index
+ redirect_to(current_user ? root_path : explore_root_path)
+ end
+
def new
@project = Project.new
end
@@ -105,7 +109,7 @@ class ProjectsController < ApplicationController
if request.referer.include?('/admin')
redirect_to admin_namespaces_projects_path
else
- redirect_to dashboard_path
+ redirect_to dashboard_projects_path
end
rescue Projects::DestroyService::DestroyError => ex
redirect_to edit_project_path(@project), alert: ex.message
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb
index fdfe00dc135..54171ff67c5 100644
--- a/app/controllers/root_controller.rb
+++ b/app/controllers/root_controller.rb
@@ -6,10 +6,10 @@
#
# For users who haven't customized the setting, we simply delegate to
# `DashboardController#show`, which is the default.
-class RootController < DashboardController
- before_action :redirect_to_custom_dashboard, only: [:show]
+class RootController < Dashboard::ProjectsController
+ before_action :redirect_to_custom_dashboard, only: [:index]
- def show
+ def index
super
end
@@ -20,6 +20,7 @@ class RootController < DashboardController
case current_user.dashboard
when 'stars'
+ flash.keep
redirect_to starred_dashboard_projects_path
else
return
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 8e7e45c781f..9f9f9a92f11 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -24,13 +24,9 @@ class SnippetsController < ApplicationController
scope: params[:scope] }).
page(params[:page]).per(PER_PAGE)
- if @user == current_user
- render 'current_user_index'
- else
- render 'user_index'
- end
+ render 'index'
else
- @snippets = SnippetsFinder.new.execute(current_user, filter: :all).page(params[:page]).per(PER_PAGE)
+ redirect_to(current_user ? dashboard_snippets_path : explore_snippets_path)
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a803b66c502..c3da54fd554 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -201,7 +201,7 @@ module ApplicationHelper
class: "#{html_class} js-timeago",
datetime: time.getutc.iso8601,
title: time.in_time_zone.stamp('Aug 21, 2011 9:23pm'),
- data: { toggle: 'tooltip', placement: placement }
+ data: { toggle: 'tooltip', placement: placement, container: 'body' }
element += javascript_tag "$('.js-timeago').timeago()" unless skip_js
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index 91d715b2d63..c2da0c30bad 100644
--- a/app/services/files/create_service.rb
+++ b/app/services/files/create_service.rb
@@ -22,7 +22,7 @@ module Files
blob = repository.blob_at_branch(@current_branch, @file_path)
if blob
- raise_error("Your changes could not be committed, because file with such name exists")
+ raise_error("Your changes could not be committed because a file with the same name already exists")
end
end
end
diff --git a/app/views/dashboard/_activities.html.haml b/app/views/dashboard/_activities.html.haml
index 1db56542afd..19d919f9b6a 100644
--- a/app/views/dashboard/_activities.html.haml
+++ b/app/views/dashboard/_activities.html.haml
@@ -5,7 +5,7 @@
- if current_user
%ul.nav.nav-pills.event_filter.pull-right
%li.pull-right
- = link_to dashboard_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do
+ = link_to dashboard_projects_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do
%i.fa.fa-rss
= render 'shared/event_filter'
diff --git a/app/views/dashboard/_groups_head.html.haml b/app/views/dashboard/_groups_head.html.haml
index dcd6c97d44d..64bd356f546 100644
--- a/app/views/dashboard/_groups_head.html.haml
+++ b/app/views/dashboard/_groups_head.html.haml
@@ -1,7 +1,7 @@
%ul.center-top-menu
- = nav_link(page: [dashboard_groups_path]) do
+ = nav_link(page: dashboard_groups_path) do
= link_to dashboard_groups_path, title: 'Your groups', data: {placement: 'right'} do
Your Groups
- = nav_link(page: [explore_groups_path]) do
+ = nav_link(page: explore_groups_path) do
= link_to explore_groups_path, title: 'Explore groups', data: {placement: 'bottom'} do
Explore Groups
diff --git a/app/views/dashboard/_projects_head.html.haml b/app/views/dashboard/_projects_head.html.haml
index 13a5eae3cdc..ed480b8caf8 100644
--- a/app/views/dashboard/_projects_head.html.haml
+++ b/app/views/dashboard/_projects_head.html.haml
@@ -1,6 +1,6 @@
%ul.center-top-menu
- = nav_link(path: ['dashboard#show', 'root#show']) do
- = link_to dashboard_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
+ = nav_link(path: ['projects#index', 'root#index']) do
+ = link_to dashboard_projects_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
Your Projects
= nav_link(page: starred_dashboard_projects_path) do
= link_to starred_dashboard_projects_path, title: 'Starred Projects', data: {placement: 'right'} do
diff --git a/app/views/dashboard/_snippets_head.html.haml b/app/views/dashboard/_snippets_head.html.haml
new file mode 100644
index 00000000000..0ae62d6f1b6
--- /dev/null
+++ b/app/views/dashboard/_snippets_head.html.haml
@@ -0,0 +1,7 @@
+%ul.center-top-menu
+ = nav_link(page: dashboard_snippets_path, html_options: {class: 'home'}) do
+ = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
+ Your Snippets
+ = nav_link(page: explore_snippets_path) do
+ = link_to explore_snippets_path, title: 'Explore snippets', data: {placement: 'right'} do
+ Explore Snippets
diff --git a/app/views/dashboard/activity.html.haml b/app/views/dashboard/activity.html.haml
index 3e24338af64..aa57df14c23 100644
--- a/app/views/dashboard/activity.html.haml
+++ b/app/views/dashboard/activity.html.haml
@@ -1,8 +1,10 @@
= content_for :meta_tags do
- if current_user
- = auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity")
+ = auto_discovery_link_tag(:atom, dashboard_projects_url(format: :atom, private_token: current_user.private_token), title: "All activity")
+- page_title "Activity"
- header_title "Activity", activity_dashboard_path
+
= render 'dashboard/activity_head'
%section.activities
diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/projects/_projects.html.haml
index ef9b9ce756a..ef9b9ce756a 100644
--- a/app/views/dashboard/_projects.html.haml
+++ b/app/views/dashboard/projects/_projects.html.haml
diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/projects/_zero_authorized_projects.html.haml
index 4e7d6639727..4e7d6639727 100644
--- a/app/views/dashboard/_zero_authorized_projects.html.haml
+++ b/app/views/dashboard/projects/_zero_authorized_projects.html.haml
diff --git a/app/views/dashboard/show.atom.builder b/app/views/dashboard/projects/index.atom.builder
index e9a612231d5..d2c51486841 100644
--- a/app/views/dashboard/show.atom.builder
+++ b/app/views/dashboard/projects/index.atom.builder
@@ -1,9 +1,9 @@
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "Activity"
- xml.link href: dashboard_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml"
- xml.link href: dashboard_url, rel: "alternate", type: "text/html"
- xml.id dashboard_url
+ xml.link href: dashboard_projects_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml"
+ xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html"
+ xml.id dashboard_projects_url
xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
@events.each do |event|
diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/projects/index.html.haml
index 1d5324e0d72..7a16b811f6b 100644
--- a/app/views/dashboard/show.html.haml
+++ b/app/views/dashboard/projects/index.html.haml
@@ -1,8 +1,10 @@
= content_for :meta_tags do
- if current_user
- = auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity")
+ = auto_discovery_link_tag(:atom, dashboard_projects_url(format: :atom, private_token: current_user.private_token), title: "All activity")
+
+- page_title "Projects"
+- header_title "Projects", root_path
-- header_title "Projects", (current_user ? root_path : explore_root_path)
= render 'dashboard/projects_head'
- if @last_push
diff --git a/app/views/dashboard/projects/starred.html.haml b/app/views/dashboard/projects/starred.html.haml
index 2fd7a1cf16c..339362701d4 100644
--- a/app/views/dashboard/projects/starred.html.haml
+++ b/app/views/dashboard/projects/starred.html.haml
@@ -1,9 +1,10 @@
- page_title "Starred Projects"
-- header_title "Projects", (current_user ? root_path : explore_root_path)
+- header_title "Projects", projects_path
+
= render 'dashboard/projects_head'
- if @projects.any?
- = render 'dashboard/projects'
+ = render 'projects'
- else
%h3 You don't have starred projects yet
%p.slead Visit project page and press on star icon and it will appear on this page.
diff --git a/app/views/dashboard/snippets/index.html.haml b/app/views/dashboard/snippets/index.html.haml
new file mode 100644
index 00000000000..d3908062f43
--- /dev/null
+++ b/app/views/dashboard/snippets/index.html.haml
@@ -0,0 +1,38 @@
+- page_title "Snippets"
+- header_title "Snippets", dashboard_snippets_path
+
+= render 'dashboard/snippets_head'
+
+.gray-content-block
+ .pull-right
+ = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
+ Add new snippet
+
+ .oneline
+ Share code pastes with others out of git repository
+
+%ul.nav.nav-tabs.prepend-top-20
+ = nav_tab :scope, nil do
+ = link_to dashboard_snippets_path do
+ All
+ %span.badge
+ = current_user.snippets.count
+ = nav_tab :scope, 'are_private' do
+ = link_to dashboard_snippets_path(scope: 'are_private') do
+ Private
+ %span.badge
+ = current_user.snippets.are_private.count
+ = nav_tab :scope, 'are_internal' do
+ = link_to dashboard_snippets_path(scope: 'are_internal') do
+ Internal
+ %span.badge
+ = current_user.snippets.are_internal.count
+ = nav_tab :scope, 'are_public' do
+ = link_to dashboard_snippets_path(scope: 'are_public') do
+ Public
+ %span.badge
+ = current_user.snippets.are_public.count
+
+.my-snippets
+ = render 'snippets/snippets'
+
diff --git a/app/views/explore/_head.html.haml b/app/views/explore/_head.html.haml
new file mode 100644
index 00000000000..d8a57560788
--- /dev/null
+++ b/app/views/explore/_head.html.haml
@@ -0,0 +1,6 @@
+.explore-title
+ %h3
+ Explore GitLab
+ %p.lead
+ Discover projects, groups and snippets. Share your projects with others
+ %br
diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml
index e8a6752de8c..83d4d321c83 100644
--- a/app/views/explore/groups/index.html.haml
+++ b/app/views/explore/groups/index.html.haml
@@ -1,7 +1,11 @@
-- page_title "Groups"
-- header_title "Groups", (current_user ? dashboard_groups_path : explore_groups_path)
+- page_title "Groups"
+- header_title "Groups", dashboard_groups_path
+
- if current_user
= render 'dashboard/groups_head'
+- else
+ = render 'explore/head'
+
.gray-content-block.clearfix
.pull-left
= form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f|
diff --git a/app/views/explore/projects/index.html.haml b/app/views/explore/projects/index.html.haml
index 9df5b3830a8..67e38ca3127 100644
--- a/app/views/explore/projects/index.html.haml
+++ b/app/views/explore/projects/index.html.haml
@@ -1,6 +1,11 @@
-- page_title "Projects"
+- page_title "Projects"
+- header_title "Projects", root_path
+
- if current_user
= render 'dashboard/projects_head'
+- else
+ = render 'explore/head'
+
.gray-content-block.clearfix
= render 'filter'
= render 'projects', projects: @projects
diff --git a/app/views/explore/projects/starred.html.haml b/app/views/explore/projects/starred.html.haml
index a9df32f3d7d..596cb0a96cd 100644
--- a/app/views/explore/projects/starred.html.haml
+++ b/app/views/explore/projects/starred.html.haml
@@ -1,6 +1,10 @@
-- page_title "Starred Projects"
+- page_title "Projects"
+- header_title "Projects", root_path
+
- if current_user
= render 'dashboard/projects_head'
+- else
+ = render 'explore/head'
.explore-trending-block
.gray-content-block
diff --git a/app/views/explore/projects/trending.html.haml b/app/views/explore/projects/trending.html.haml
index c1ef06f6cdb..5ea6d81c5b9 100644
--- a/app/views/explore/projects/trending.html.haml
+++ b/app/views/explore/projects/trending.html.haml
@@ -1,13 +1,11 @@
-- page_title "Trending Projects"
+- page_title "Projects"
+- header_title "Projects", root_path
+
- if current_user
= render 'dashboard/projects_head'
- else
- .explore-title
- %h3
- Explore GitLab
- %p.lead
- Discover projects and groups. Share your projects with others
- %br
+ = render 'explore/head'
+
.explore-trending-block
.gray-content-block
.pull-right
diff --git a/app/views/explore/snippets/index.html.haml b/app/views/explore/snippets/index.html.haml
new file mode 100644
index 00000000000..7e4fa7d4873
--- /dev/null
+++ b/app/views/explore/snippets/index.html.haml
@@ -0,0 +1,18 @@
+- page_title "Snippets"
+- header_title "Snippets", snippets_path
+
+- if current_user
+ = render 'dashboard/snippets_head'
+- else
+ = render 'explore/head'
+
+.gray-content-block
+ - if current_user
+ .pull-right
+ = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
+ Add new snippet
+
+ .oneline
+ Public snippets created by you and other users are listed here
+
+= render 'snippets/snippets'
diff --git a/app/views/help/show.html.haml b/app/views/help/show.html.haml
index 8551496b98a..0398afb4c1d 100644
--- a/app/views/help/show.html.haml
+++ b/app/views/help/show.html.haml
@@ -1,3 +1,3 @@
- page_title @file.humanize, *@category.split("/").reverse.map(&:humanize)
.documentation.wiki
- = markdown @markdown.gsub('$your_email', current_user.email)
+ = markdown @markdown.gsub('$your_email', current_user.try(:email) || "email@example.com")
diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml
index 707905ee92a..2468687b56d 100644
--- a/app/views/layouts/_page.html.haml
+++ b/app/views/layouts/_page.html.haml
@@ -6,10 +6,14 @@
= brand_header_logo
.gitlab-text-container
%h3 GitLab
+
- if defined?(sidebar) && sidebar
= render "layouts/nav/#{sidebar}"
- elsif current_user
= render 'layouts/nav/dashboard'
+ - else
+ = render 'layouts/nav/explore'
+
.collapse-nav
= render partial: 'layouts/collapse_button'
- if current_user
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 1987bf1592a..95e077c339f 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -31,5 +31,5 @@
.container
.footer-links
= link_to "Explore", explore_root_path
- = link_to "Documentation", "http://doc.gitlab.com/"
+ = link_to "Help", help_path
= link_to "About GitLab", "https://about.gitlab.com/"
diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml
index 9098554e6f0..df65792be73 100644
--- a/app/views/layouts/explore.html.haml
+++ b/app/views/layouts/explore.html.haml
@@ -1,9 +1,5 @@
- page_title "Explore"
-- if current_user
- - unless @header_title
- - header_title "Projects", (current_user ? root_path : explore_root_path)
-- else
+- unless current_user
- header_title "Explore GitLab", explore_root_path
-- sidebar "dashboard"
= render template: "layouts/application"
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index 7d3764a76a3..c3b07200621 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -1,31 +1,30 @@
%ul.nav.nav-sidebar
- = nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
- = link_to (current_user ? root_path : explore_root_path), title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
+ = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
+ = link_to root_path, title: 'Projects', data: {placement: 'right'} do
= icon('home fw')
%span
Projects
= nav_link(path: 'dashboard#activity') do
- = link_to activity_dashboard_path, title: 'Activity', data: {placement: 'right'} do
+ = link_to activity_dashboard_path, class: 'shortcuts-activity', title: 'Activity', data: {placement: 'right'} do
= icon('dashboard fw')
%span
Activity
= nav_link(controller: :groups) do
- = link_to (current_user ? dashboard_groups_path : explore_groups_path), title: 'Groups', data: {placement: 'right'} do
+ = link_to dashboard_groups_path, title: 'Groups', data: {placement: 'right'} do
= icon('group fw')
%span
Groups
- - if current_user
- = nav_link(controller: :milestones) do
- = link_to dashboard_milestones_path, title: 'Milestones', data: {placement: 'right'} do
- = icon('clock-o fw')
- %span
- Milestones
- = nav_link(path: 'dashboard#issues') do
- = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'shortcuts-issues', data: {placement: 'right'} do
- = icon('exclamation-circle fw')
- %span
- Issues
- %span.count= current_user.assigned_issues.opened.count
+ = nav_link(controller: :milestones) do
+ = link_to dashboard_milestones_path, title: 'Milestones', data: {placement: 'right'} do
+ = icon('clock-o fw')
+ %span
+ Milestones
+ = nav_link(path: 'dashboard#issues') do
+ = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'shortcuts-issues', data: {placement: 'right'} do
+ = icon('exclamation-circle fw')
+ %span
+ Issues
+ %span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do
= link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'shortcuts-merge_requests', data: {placement: 'right'} do
= icon('tasks fw')
@@ -33,7 +32,7 @@
Merge Requests
%span.count= current_user.assigned_merge_requests.opened.count
= nav_link(controller: :snippets) do
- = link_to (current_user ? user_snippets_path(current_user) : snippets_path), title: 'Your snippets', data: {placement: 'right'} do
+ = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
= icon('clipboard fw')
%span
Snippets
@@ -42,10 +41,8 @@
= icon('question-circle fw')
%span
Help
- - if current_user
- %li.separate-item
- = nav_link(controller: :profile) do
- = link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do
- = icon('user fw')
- %span
- Profile Settings
+ = nav_link(controller: :profile) do
+ = link_to profile_path, title: 'Profile settings', data: {placement: 'bottom'} do
+ = icon('user fw')
+ %span
+ Profile Settings
diff --git a/app/views/layouts/nav/_explore.html.haml b/app/views/layouts/nav/_explore.html.haml
new file mode 100644
index 00000000000..21e565972a7
--- /dev/null
+++ b/app/views/layouts/nav/_explore.html.haml
@@ -0,0 +1,21 @@
+%ul.nav.nav-sidebar
+ = nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
+ = link_to explore_root_path, title: 'Projects', data: {placement: 'right'} do
+ = icon('home fw')
+ %span
+ Projects
+ = nav_link(controller: :groups) do
+ = link_to explore_groups_path, title: 'Groups', data: {placement: 'right'} do
+ = icon('group fw')
+ %span
+ Groups
+ = nav_link(controller: :snippets) do
+ = link_to explore_snippets_path, title: 'Snippets', data: {placement: 'right'} do
+ = icon('clipboard fw')
+ %span
+ Snippets
+ = nav_link(controller: :help) do
+ = link_to help_path, title: 'Help', data: {placement: 'right'} do
+ = icon('question-circle fw')
+ %span
+ Help
diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml
index 695ce68a201..f57ec7e13f2 100644
--- a/app/views/layouts/nav/_group.html.haml
+++ b/app/views/layouts/nav/_group.html.haml
@@ -3,7 +3,7 @@
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw')
%span
- Back to Dashboard
+ Back to dashboard
%li.separate-item
diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml
index abdb7544651..5a47b8e6db2 100644
--- a/app/views/layouts/nav/_profile.html.haml
+++ b/app/views/layouts/nav/_profile.html.haml
@@ -3,7 +3,7 @@
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw')
%span
- Back to Dashboard
+ Back to dashboard
%li.separate-item
diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml
index 5e7b902622b..1d22a7442e3 100644
--- a/app/views/layouts/nav/_project.html.haml
+++ b/app/views/layouts/nav/_project.html.haml
@@ -4,13 +4,13 @@
= link_to group_path(@project.group), title: 'Back to group', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw')
%span
- Back to Group
+ Back to group
- else
= nav_link do
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw')
%span
- Back to Dashboard
+ Back to dashboard
%li.separate-item
diff --git a/app/views/layouts/snippets.html.haml b/app/views/layouts/snippets.html.haml
index d9c90d4fcef..02ca3ee7a28 100644
--- a/app/views/layouts/snippets.html.haml
+++ b/app/views/layouts/snippets.html.haml
@@ -1,8 +1,3 @@
-- page_title 'Snippets'
-- if current_user
- - header_title "Snippets", user_snippets_path(current_user)
-- else
- - header_title 'Snippets', snippets_path
-- sidebar "dashboard"
+- header_title "Snippets", snippets_path
= render template: "layouts/application"
diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml
index 65674913bb0..5f6e5f3b644 100644
--- a/app/views/projects/activity.html.haml
+++ b/app/views/projects/activity.html.haml
@@ -1 +1,2 @@
+- page_title "Activity"
= render 'projects/activity'
diff --git a/app/views/snippets/_head.html.haml b/app/views/snippets/_head.html.haml
deleted file mode 100644
index 0adf6b91f2c..00000000000
--- a/app/views/snippets/_head.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-%ul.center-top-menu
- = nav_link(page: user_snippets_path(current_user), html_options: {class: 'home'}) do
- = link_to user_snippets_path(current_user), title: 'Your snippets', data: {placement: 'right'} do
- Your Snippets
- = nav_link(page: snippets_path) do
- = link_to snippets_path, title: 'Explore snippets', data: {placement: 'right'} do
- Explore Snippets
diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml
deleted file mode 100644
index d704407c4dd..00000000000
--- a/app/views/snippets/current_user_index.html.haml
+++ /dev/null
@@ -1,36 +0,0 @@
-- page_title "Your Snippets"
-= render 'head'
-
-.gray-content-block
- .pull-right
- = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
- Add new snippet
-
- .oneline
- Share code pastes with others out of git repository
-
-%ul.nav.nav-tabs.prepend-top-20
- = nav_tab :scope, nil do
- = link_to user_snippets_path(@user) do
- All
- %span.badge
- = @user.snippets.count
- = nav_tab :scope, 'are_private' do
- = link_to user_snippets_path(@user, scope: 'are_private') do
- Private
- %span.badge
- = @user.snippets.are_private.count
- = nav_tab :scope, 'are_internal' do
- = link_to user_snippets_path(@user, scope: 'are_internal') do
- Internal
- %span.badge
- = @user.snippets.are_internal.count
- = nav_tab :scope, 'are_public' do
- = link_to user_snippets_path(@user, scope: 'are_public') do
- Public
- %span.badge
- = @user.snippets.are_public.count
-
-.my-snippets
- = render 'snippets'
-
diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml
index 3b62dd2a6e1..7e4918a6085 100644
--- a/app/views/snippets/index.html.haml
+++ b/app/views/snippets/index.html.haml
@@ -1,15 +1,13 @@
-- page_title "Public Snippets"
-- if current_user
- = render 'head'
-
-.gray-content-block
- - if current_user
- .pull-right
- = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
- Add new snippet
-
- .oneline
- Public snippets created by you and other users are listed here
+- page_title "By #{@user.name}", "Snippets"
+
+%ol.breadcrumb
+ %li
+ = link_to snippets_path do
+ Snippets
+ %li
+ = @user.name
+ .pull-right.hidden-xs
+ = link_to user_path(@user) do
+ #{@user.name} profile page
= render 'snippets'
-
diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml
index aed00f9caeb..97374e073dc 100644
--- a/app/views/snippets/show.html.haml
+++ b/app/views/snippets/show.html.haml
@@ -20,10 +20,10 @@
.back-link
- if @snippet.author == current_user
- = link_to user_snippets_path(current_user) do
+ = link_to dashboard_snippets_path do
&larr; your snippets
- else
- = link_to snippets_path do
+ = link_to explore_snippets_path do
&larr; explore snippets
.file-holder
diff --git a/app/views/snippets/user_index.html.haml b/app/views/snippets/user_index.html.haml
deleted file mode 100644
index 7af5352da34..00000000000
--- a/app/views/snippets/user_index.html.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-- page_title "Snippets", @user.name
-
-%ol.breadcrumb
- %li
- = link_to snippets_path do
- Snippets
- %li
- = @user.name
- .pull-right.hidden-xs
- = link_to user_path(@user) do
- #{@user.name} profile page
-
-= render 'snippets'
diff --git a/config/routes.rb b/config/routes.rb
index 011af4825fa..fad6b3c569a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -143,6 +143,7 @@ Gitlab::Application.routes.draw do
end
resources :groups, only: [:index]
+ resources :snippets, only: [:index]
root to: 'projects#trending'
end
@@ -263,24 +264,25 @@ Gitlab::Application.routes.draw do
#
# Dashboard Area
#
- resource :dashboard, controller: 'dashboard', only: [:show] do
- member do
- get :issues
- get :merge_requests
- get :activity
- end
+ resource :dashboard, controller: 'dashboard', only: [] do
+ get :issues
+ get :merge_requests
+ get :activity
scope module: :dashboard do
resources :milestones, only: [:index, :show]
resources :groups, only: [:index]
+ resources :snippets, only: [:index]
- resources :projects, only: [] do
+ resources :projects, only: [:index] do
collection do
get :starred
end
end
end
+
+ root to: "dashboard/projects#index"
end
#
@@ -304,7 +306,7 @@ Gitlab::Application.routes.draw do
end
end
- resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
+ resources :projects, constraints: { id: /[^\/]+/ }, only: [:index, :new, :create]
devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
@@ -312,7 +314,7 @@ Gitlab::Application.routes.draw do
get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
end
- root to: "root#show"
+ root to: "root#index"
#
# Project Area
diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md
index 6a68c8e8286..4ff5e74d438 100644
--- a/doc/raketasks/backup_restore.md
+++ b/doc/raketasks/backup_restore.md
@@ -369,4 +369,7 @@ For more information see similar questions on postgresql issue tracker[here](htt
## Note
This documentation is for GitLab CE.
-We backup GitLab.com and make sure your data is secure, but you can't use these methods to export / backup your data yourself from GitLab.com.
+We backup GitLab.com and make sure your data is secure, but you can't use these methods
+to export / backup your data yourself from GitLab.com.
+
+Issues are stored in the database. They can't be stored in Git itself.
diff --git a/doc/update/patch_versions.md b/doc/update/patch_versions.md
index 22b9be059d6..a66a863f6c4 100644
--- a/doc/update/patch_versions.md
+++ b/doc/update/patch_versions.md
@@ -1,7 +1,7 @@
# Universal update guide for patch versions
*Make sure you view this [upgrade guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/patch_versions.md) from the `master` branch for the most up to date instructions.*
-For example from 6.2.0 to 6.2.1, also see the [semantic versioning specification](http://semver.org/).
+For example from 7.14.0 to 7.14.3, also see the [semantic versioning specification](http://semver.org/).
### 0. Backup
@@ -23,17 +23,16 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
cd /home/git/gitlab
sudo -u git -H git fetch --all
sudo -u git -H git checkout -- Gemfile.lock db/schema.rb
-sudo -u git -H git checkout LATEST_TAG
+LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
+sudo -u git -H git checkout $LATEST_TAG -b $LATEST_TAG
```
-Replace LATEST_TAG with the latest GitLab tag you want to upgrade to, for example `v6.6.3`.
-
### 3. Update gitlab-shell to the corresponding version
```bash
cd /home/git/gitlab-shell
sudo -u git -H git fetch
-sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`
+sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION` -b v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`
```
### 4. Install libs, migrations, etc.
diff --git a/features/steps/groups.rb b/features/steps/groups.rb
index 18a1c4d32ce..a5c2eed4ddd 100644
--- a/features/steps/groups.rb
+++ b/features/steps/groups.rb
@@ -6,7 +6,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
include Select2Helper
step 'I should see back to dashboard button' do
- expect(page).to have_content 'Back to Dashboard'
+ expect(page).to have_content 'Back to dashboard'
end
step 'gitlab user "Mike"' do
diff --git a/features/steps/invites.rb b/features/steps/invites.rb
index 5e8feff5095..dac972172aa 100644
--- a/features/steps/invites.rb
+++ b/features/steps/invites.rb
@@ -63,7 +63,7 @@ class Spinach::Features::Invites < Spinach::FeatureSteps
end
step 'I should be redirected to the dashboard' do
- expect(current_path).to eq(dashboard_path)
+ expect(current_path).to eq(dashboard_projects_path)
end
step 'I should see a notice telling me I have declined' do
diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb
index 0404fd5e594..079a190e356 100644
--- a/features/steps/project/project.rb
+++ b/features/steps/project/project.rb
@@ -124,10 +124,10 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end
step 'I should see back to dashboard button' do
- expect(page).to have_content 'Back to Dashboard'
+ expect(page).to have_content 'Back to dashboard'
end
step 'I should see back to group button' do
- expect(page).to have_content 'Back to Group'
+ expect(page).to have_content 'Back to group'
end
end
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index b4deccb6520..eb978620da6 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -68,7 +68,7 @@ module SharedPaths
# ----------------------------------------
step 'I visit dashboard page' do
- visit dashboard_path
+ visit dashboard_projects_path
end
step 'I visit dashboard activity page' do
@@ -460,7 +460,7 @@ module SharedPaths
end
step 'I visit snippets page' do
- visit snippets_path
+ visit explore_snippets_path
end
step 'I visit new snippet page' do
diff --git a/features/steps/snippets/user.rb b/features/steps/snippets/user.rb
index 007fcb2893f..dea3256229f 100644
--- a/features/steps/snippets/user.rb
+++ b/features/steps/snippets/user.rb
@@ -4,7 +4,7 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
include SharedSnippet
step 'I visit my snippets page' do
- visit user_snippets_path(current_user)
+ visit dashboard_snippets_path
end
step 'I should see "Personal snippet one" in snippets' do
diff --git a/lib/gitlab/markdown/sanitization_filter.rb b/lib/gitlab/markdown/sanitization_filter.rb
index 68ed57f6257..e368de7d848 100644
--- a/lib/gitlab/markdown/sanitization_filter.rb
+++ b/lib/gitlab/markdown/sanitization_filter.rb
@@ -67,12 +67,16 @@ module Gitlab
def clean_spans
lambda do |env|
- return unless env[:node_name] == 'span'
- return unless env[:node].has_attribute?('class')
+ node = env[:node]
- unless has_ancestor?(env[:node], 'pre')
- env[:node].remove_attribute('class')
+ return unless node.name == 'span'
+ return unless node.has_attribute?('class')
+
+ unless has_ancestor?(node, 'pre')
+ node.remove_attribute('class')
end
+
+ { node_whitelist: [node] }
end
end
end
diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb
index abbbf6855fc..64dfe8f34e3 100644
--- a/spec/controllers/root_controller_spec.rb
+++ b/spec/controllers/root_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe RootController do
- describe 'GET show' do
+ describe 'GET index' do
context 'with a user' do
let(:user) { create(:user) }
@@ -16,15 +16,15 @@ describe RootController do
end
it 'redirects to their specified dashboard' do
- get :show
+ get :index
expect(response).to redirect_to starred_dashboard_projects_path
end
end
context 'who uses the default dashboard setting' do
it 'renders the default dashboard' do
- get :show
- expect(response).to render_template 'dashboard/show'
+ get :index
+ expect(response).to render_template 'dashboard/projects/index'
end
end
end
diff --git a/spec/features/atom/dashboard_spec.rb b/spec/features/atom/dashboard_spec.rb
index ad157d742ff..f81a3c117ff 100644
--- a/spec/features/atom/dashboard_spec.rb
+++ b/spec/features/atom/dashboard_spec.rb
@@ -6,7 +6,7 @@ describe "Dashboard Feed", feature: true do
context "projects atom feed via private token" do
it "should render projects atom feed" do
- visit dashboard_path(:atom, private_token: user.private_token)
+ visit dashboard_projects_path(:atom, private_token: user.private_token)
expect(body).to have_selector('feed title')
end
end
@@ -20,7 +20,7 @@ describe "Dashboard Feed", feature: true do
project.team << [user, :master]
issue_event(issue, user)
note_event(note, user)
- visit dashboard_path(:atom, private_token: user.private_token)
+ visit dashboard_projects_path(:atom, private_token: user.private_token)
end
it "should have issue opened event" do
diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb
index 9bc6145dda4..8f645438cff 100644
--- a/spec/features/profiles/preferences_spec.rb
+++ b/spec/features/profiles/preferences_spec.rb
@@ -70,7 +70,7 @@ describe 'Profile > Preferences', feature: true do
expect(page.current_path).to eq starred_dashboard_projects_path
click_link 'Your Projects'
- expect(page.current_path).to eq dashboard_path
+ expect(page.current_path).to eq dashboard_projects_path
end
end
diff --git a/spec/features/security/dashboard_access_spec.rb b/spec/features/security/dashboard_access_spec.rb
index c38cddbb904..788581a26cb 100644
--- a/spec/features/security/dashboard_access_spec.rb
+++ b/spec/features/security/dashboard_access_spec.rb
@@ -4,7 +4,7 @@ describe "Dashboard access", feature: true do
include AccessMatchers
describe "GET /dashboard" do
- subject { dashboard_path }
+ subject { dashboard_projects_path }
it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user }
@@ -40,7 +40,7 @@ describe "Dashboard access", feature: true do
it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user }
- it { is_expected.to be_denied_for :visitor }
+ it { is_expected.to be_allowed_for :visitor }
end
describe "GET /projects/new" do
diff --git a/spec/javascripts/syntax_highlight_spec.js.coffee b/spec/javascripts/syntax_highlight_spec.js.coffee
new file mode 100644
index 00000000000..6a73b6bf32c
--- /dev/null
+++ b/spec/javascripts/syntax_highlight_spec.js.coffee
@@ -0,0 +1,42 @@
+#= require syntax_highlight
+
+describe 'Syntax Highlighter', ->
+ stubUserColorScheme = (value) ->
+ window.gon ?= {}
+ window.gon.user_color_scheme = value
+
+ describe 'on a js-syntax-highlight element', ->
+ beforeEach ->
+ fixture.set('<div class="js-syntax-highlight"></div>')
+
+ it 'applies syntax highlighting', ->
+ stubUserColorScheme('monokai')
+
+ $('.js-syntax-highlight').syntaxHighlight()
+
+ expect($('.js-syntax-highlight')).toHaveClass('monokai')
+
+ describe 'on a parent element', ->
+ beforeEach ->
+ fixture.set """
+ <div class="parent">
+ <div class="js-syntax-highlight"></div>
+ <div class="foo"></div>
+ <div class="js-syntax-highlight"></div>
+ </div>
+ """
+
+ it 'applies highlighting to all applicable children', ->
+ stubUserColorScheme('monokai')
+
+ $('.parent').syntaxHighlight()
+
+ expect($('.parent, .foo')).not.toHaveClass('monokai')
+ expect($('.monokai').length).toBe(2)
+
+ it 'prevents an infinite loop when no matches exist', ->
+ fixture.set('<div></div>')
+
+ highlight = -> $('div').syntaxHighlight()
+
+ expect(highlight).not.toThrow()
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb
index dd045826692..dfa18f69e05 100644
--- a/spec/routing/routing_spec.rb
+++ b/spec/routing/routing_spec.rb
@@ -206,7 +206,7 @@ end
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
describe DashboardController, "routing" do
it "to #index" do
- expect(get("/dashboard")).to route_to('dashboard#show')
+ expect(get("/dashboard")).to route_to('dashboard/projects#index')
end
it "to #issues" do
@@ -220,8 +220,8 @@ end
# root / root#show
describe RootController, 'routing' do
- it 'to #show' do
- expect(get('/')).to route_to('root#show')
+ it 'to #index' do
+ expect(get('/')).to route_to('root#index')
end
end