diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-04-21 16:41:11 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-04-21 16:41:11 +0300 |
commit | 0625b15a481b3a3edd88110b3c18031ad9068d2f (patch) | |
tree | c382ff09cfb221b492fa14372827bea358f293ae /app | |
parent | 81112b54051c99c7546b282c47edc176f0aebd40 (diff) | |
parent | abdc4cbef23a14540cc4526d0e5af23852ce1119 (diff) |
Merge branch '7-10-rc5' into '7-10-stable'
7.10.0.rc5
cc @job
See merge request !1787
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/help_controller.rb | 56 | ||||
-rw-r--r-- | app/controllers/import/google_code_controller.rb | 2 | ||||
-rw-r--r-- | app/views/help/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/import/google_code/new_user_map.html.haml | 28 |
4 files changed, 62 insertions, 26 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 0e5567c7734..35ece5b270b 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -3,40 +3,54 @@ class HelpController < ApplicationController end def show - @filepath = clean_path_info(params[:filepath]) - @format = params[:format] + category = clean_path_info(path_params[:category]) + file = path_params[:file] respond_to do |format| - format.md { render_doc } - format.all { send_file_data } - end - end + format.any(:markdown, :md, :html) do + path = Rails.root.join('doc', category, "#{file}.md") - def shortcuts - end + if File.exist?(path) + @markdown = File.read(path) - private + render 'show.html.haml' + else + # Force template to Haml + render 'errors/not_found.html.haml', layout: 'errors', status: 404 + end + end + + # Allow access to images in the doc folder + format.any(:png, :gif, :jpeg) do + path = Rails.root.join('doc', category, "#{file}.#{params[:format]}") + + if File.exist?(path) + send_file(path, disposition: 'inline') + else + head :not_found + end + end - def render_doc - if File.exists?(Rails.root.join('doc', @filepath + '.md')) - render 'show.html.haml' - else - not_found! + # Any other format we don't recognize, just respond 404 + format.any { head :not_found } end end - def send_file_data - path = Rails.root.join('doc', "#{@filepath}.#{@format}") - if File.exists?(path) - send_file(path, disposition: 'inline') - else - head :not_found - end + def shortcuts end def ui end + private + + def path_params + params.require(:category) + params.require(:file) + + params + end + PATH_SEPS = Regexp.union(*[::File::SEPARATOR, ::File::ALT_SEPARATOR].compact) # Taken from ActionDispatch::FileHandler diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb index 73c912e285b..6574be91920 100644 --- a/app/controllers/import/google_code_controller.rb +++ b/app/controllers/import/google_code_controller.rb @@ -68,7 +68,7 @@ class Import::GoogleCodeController < Import::BaseController def status unless client.valid? - return redirect_to new_import_google_path + return redirect_to new_import_google_code_path end @repos = client.repos diff --git a/app/views/help/show.html.haml b/app/views/help/show.html.haml index f22aa92caf7..cc1be6a717a 100644 --- a/app/views/help/show.html.haml +++ b/app/views/help/show.html.haml @@ -1,2 +1,2 @@ .documentation.wiki - = markdown File.read(Rails.root.join('doc', @filepath + '.md')).gsub("$your_email", current_user.email) + = markdown @markdown.gsub('$your_email', current_user.email) diff --git a/app/views/import/google_code/new_user_map.html.haml b/app/views/import/google_code/new_user_map.html.haml index d55fcfc97a8..9c6824ecad7 100644 --- a/app/views/import/google_code/new_user_map.html.haml +++ b/app/views/import/google_code/new_user_map.html.haml @@ -8,9 +8,31 @@ Customize how Google Code email addresses and usernames are imported into GitLab. In the next step, you'll be able to select the projects you want to import. %p - The user map is a JSON document mapping Google Code users (as keys) to the way they will be imported into GitLab (as values). By default the username is masked to ensure users' privacy. - %p - To map a Google Code user to a full name or GitLab user, simply replace the value, e.g. <code>"johnsmith@gmail.com": "John Smith"</code> or <code>"johnsmith@gmail.com": "@johnsmith"</code>. Be sure to preserve the surrounding double quotes and other punctuation. + The user map is a JSON document mapping the Google Code users that participated on your projects to the way their email addresses and usernames will be imported into GitLab. You can change this by changing the value on the right hand side of <code>:</code>. Be sure to preserve the surrounding double quotes, other punctuation and the email address or username on the left hand side. + %ul + %li + %strong Default: Directly import the Google Code email address or username + %p + <code>"johnsmith@example.com": "johnsm...@example.com"</code> + will add "By johnsm...@example.com" to all issues and comments originally created by johnsmith@example.com. + The email address or username is masked to ensure the user's privacy. + %li + %strong Map a Google Code user to a GitLab user + %p + <code>"johnsmith@example.com": "@johnsmith"</code> + will add "By <a href="#">@johnsmith</a>" to all issues and comments originally created by johnsmith@example.com, + and will set <a href="#">@johnsmith</a> as the assignee on all issues originally assigned to johnsmith@example.com. + %li + %strong Map a Google Code user to a full name + %p + <code>"johnsmith@example.com": "John Smith"</code> + will add "By John Smith" to all issues and comments originally created by johnsmith@example.com. + %li + %strong Map a Google Code user to a full email address + %p + <code>"johnsmith@example.com": "johnsmith@example.com"</code> + will add "By <a href="#">johnsmith@example.com</a>" to all issues and comments originally created by johnsmith@example.com. + By default, the email address or username is masked to ensure the user's privacy. Use this option if you want to show the full email address. .form-group .col-sm-12 |