diff --git a/CHANGELOG b/CHANGELOG index d248639296f48a22d01893435562b2122d24ca77..282e4b9b4498b5bdcc4c49e32e8369392d3ae6c6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ v 8.11.0 (unreleased) - Fix don't pass a local variable called `i` to a partial. !20510 (herminiotorres) - Fix rename `add_users_into_project` and `projects_ids`. !20512 (herminiotorres) - Fix the title of the toggle dropdown button. !5515 (herminiotorres) + - Rename `markdown_preview` routes to `preview_markdown`. (Christopher Bartz) - Improve diff performance by eliminating redundant checks for text blobs - Ensure that branch names containing escapable characters (e.g. %20) aren't unescaped indiscriminately. !5770 (ewiltshi) - Convert switch icon into icon font (ClemMakesApps) diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index 288cce04f878284377e68dd0320226d9bba46509..4a6fea929c758b55d5fa382d868e6982710258d1 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -1,5 +1,5 @@ -/*= require markdown_preview */ +/*= require preview_markdown */ (function() { this.DropzoneInput = (function() { diff --git a/app/assets/javascripts/markdown_preview.js b/app/assets/javascripts/preview_markdown.js similarity index 98% rename from app/assets/javascripts/markdown_preview.js rename to app/assets/javascripts/preview_markdown.js index 18fc7bae09a6e5f65a3fbbce792b11097bde90fa..5fd7579964024c842915af9f237863d7335394f0 100644 --- a/app/assets/javascripts/markdown_preview.js +++ b/app/assets/javascripts/preview_markdown.js @@ -28,7 +28,7 @@ }; MarkdownPreview.prototype.renderMarkdown = function(text, success) { - if (!window.markdown_preview_path) { + if (!window.preview_markdown_path) { return; } if (text === this.ajaxCache.text) { @@ -36,7 +36,7 @@ } return $.ajax({ type: 'POST', - url: window.markdown_preview_path, + url: window.preview_markdown_path, data: { text: text }, diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 607fe9c7fed02d8bccc9af787ccea1284c4ed544..177ccf5eec963113407f3d8f1d8872da3b505b8c 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -91,7 +91,7 @@ class Projects::WikisController < Projects::ApplicationController ) end - def markdown_preview + def preview_markdown text = params[:text] ext = Gitlab::ReferenceExtractor.new(@project, current_user) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 207f9d6a77fb0992f2a688537acce460c648c638..47efbd4a93902efe1be30b1e30e0a5f711dc8113 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -238,7 +238,7 @@ class ProjectsController < Projects::ApplicationController } end - def markdown_preview + def preview_markdown text = params[:text] ext = Gitlab::ReferenceExtractor.new(@project, current_user) diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index ee9c0366f2bdea8131a4f63883492dea0aa60298..9fe94291db749dfa5c8c337213dfa04339678daa 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -6,13 +6,13 @@ - content_for :scripts_body_top do - project = @target_project || @project - if @project_wiki && @page - - markdown_preview_path = namespace_project_wiki_markdown_preview_path(project.namespace, project, @page.slug) + - preview_markdown_path = namespace_project_wiki_preview_markdown_path(project.namespace, project, @page.slug) - else - - markdown_preview_path = markdown_preview_namespace_project_path(project.namespace, project) + - preview_markdown_path = preview_markdown_namespace_project_path(project.namespace, project) - if current_user :javascript window.project_uploads_path = "#{namespace_project_uploads_path project.namespace,project}"; - window.markdown_preview_path = "#{markdown_preview_path}"; + window.preview_markdown_path = "#{preview_markdown_path}"; - content_for :scripts_body do = render "layouts/init_auto_complete" if current_user diff --git a/config/routes.rb b/config/routes.rb index 99a2cd884fe04aa0d475dc2637104ef6ab13404c..9a98fab15a39d47f17a1ab725807a75631cc7751 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -468,7 +468,7 @@ Rails.application.routes.draw do post :unarchive post :housekeeping post :toggle_star - post :markdown_preview + post :preview_markdown post :export post :remove_export post :generate_new_export @@ -672,7 +672,7 @@ Rails.application.routes.draw do get '/wikis/*id', to: 'wikis#show', as: 'wiki', constraints: WIKI_SLUG_ID delete '/wikis/*id', to: 'wikis#destroy', constraints: WIKI_SLUG_ID put '/wikis/*id', to: 'wikis#update', constraints: WIKI_SLUG_ID - post '/wikis/*id/markdown_preview', to: 'wikis#markdown_preview', constraints: WIKI_SLUG_ID, as: 'wiki_markdown_preview' + post '/wikis/*id/preview_markdown', to: 'wikis#preview_markdown', constraints: WIKI_SLUG_ID, as: 'wiki_preview_markdown' end resource :repository, only: [:create] do diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index b941e78f983539666eb04cb5370fbb5bc67ce3f3..77842057a1044917fb1a61a1ef406ea8f044fe5a 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -60,7 +60,7 @@ end # project GET /:id(.:format) projects#show # PUT /:id(.:format) projects#update # DELETE /:id(.:format) projects#destroy -# markdown_preview_project POST /:id/markdown_preview(.:format) projects#markdown_preview +# preview_markdown_project POST /:id/preview_markdown(.:format) projects#preview_markdown describe ProjectsController, 'routing' do it 'to #create' do expect(post('/projects')).to route_to('projects#create') @@ -91,9 +91,9 @@ describe ProjectsController, 'routing' do expect(delete('/gitlab/gitlabhq')).to route_to('projects#destroy', namespace_id: 'gitlab', id: 'gitlabhq') end - it 'to #markdown_preview' do - expect(post('/gitlab/gitlabhq/markdown_preview')).to( - route_to('projects#markdown_preview', namespace_id: 'gitlab', id: 'gitlabhq') + it 'to #preview_markdown' do + expect(post('/gitlab/gitlabhq/preview_markdown')).to( + route_to('projects#preview_markdown', namespace_id: 'gitlab', id: 'gitlabhq') ) end end