Merge branch 'link-doc-help' into 'master'

Readme on the help page

Adds the readme from the docs to the help page instead of the current links.

Fixes #1117
This commit is contained in:
Dmitriy Zaporozhets 2014-05-29 11:33:54 +00:00
commit 0e4bc4e6de
28 changed files with 77 additions and 110 deletions

View File

@ -34,6 +34,7 @@
/**
* Page specific styles (issues, projects etc):
*/
@import "sections/*";
/**

View File

@ -0,0 +1,11 @@
.documentation {
padding-bottom: 10px;
p {
padding: 10px;
margin: 0;
}
li {
list-style-type: none;
padding-left: 10px;
}
}

View File

@ -13,6 +13,17 @@ class HelpController < ApplicationController
end
end
def show
@category = params[:category]
@file = params[:file]
if File.exists?(Rails.root.join('doc', @category, @file + '.md'))
render 'show'
else
not_found!
end
end
def shortcuts
end
end

View File

@ -33,15 +33,15 @@ module SearchHelper
# Autocomplete results for internal help pages
def help_autocomplete
[
{ label: "help: API Help", url: help_api_path },
{ label: "help: Markdown Help", url: help_markdown_path },
{ label: "help: Permissions Help", url: help_permissions_path },
{ label: "help: Public Access Help", url: help_public_access_path },
{ label: "help: Rake Tasks Help", url: help_raketasks_path },
{ label: "help: SSH Keys Help", url: help_ssh_path },
{ label: "help: System Hooks Help", url: help_system_hooks_path },
{ label: "help: Web Hooks Help", url: help_web_hooks_path },
{ label: "help: Workflow Help", url: help_workflow_path },
{ label: "help: API Help", url: help_page_path("api", "README") },
{ label: "help: Markdown Help", url: help_page_path("markdown", "markdown") },
{ label: "help: Permissions Help", url: help_page_path("permissions", "permissions") },
{ label: "help: Public Access Help", url: help_page_path("public_access", "public_access") },
{ label: "help: Rake Tasks Help", url: help_page_path("raketasks", "README") },
{ label: "help: SSH Keys Help", url: help_page_path("ssh", "README") },
{ label: "help: System Hooks Help", url: help_page_path("system_hooks", "system_hooks") },
{ label: "help: Web Hooks Help", url: help_page_path("web_hooks", "web_hooks") },
{ label: "help: Workflow Help", url: help_page_path("workflow", "README") },
]
end

View File

@ -51,7 +51,7 @@
.body.form-holder
%p.light
Read more about project permissions
%strong= link_to "here", help_permissions_path, class: "vlink"
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
= form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do
%div

View File

@ -2,7 +2,7 @@
System hooks
%p.light
#{link_to "System hooks ", help_system_hooks_path, class: "vlink"} can be
#{link_to "System hooks ", help_page_path("system_hooks", "system_hooks"), class: "vlink"} can be
used for binding events when GitLab creates a User or Project.
%hr

View File

@ -2,4 +2,4 @@
%h3.page-title Access Denied
%hr
%p You are not allowed to access this page.
%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"}
%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "vlink"}

View File

@ -5,7 +5,7 @@
%p.light
Members of group have access to all group projects.
Read more about permissions
%strong= link_to "here", help_permissions_path, class: "vlink"
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
%hr

View File

@ -1,12 +1,6 @@
.row
.col-md-3
%h3.page-title Help
%ul.nav.nav-pills.nav-stacked
- links = {:"Workflow" => help_workflow_path, :"SSH Keys" => help_ssh_path, :"GitLab Markdown" => help_markdown_path, :"Permissions" => help_permissions_path, :"API" => help_api_path, :"Web Hooks" => help_web_hooks_path, :"Rake Tasks" => help_raketasks_path, :"System Hooks" => help_system_hooks_path, :"Public Access" => help_public_access_path, :"Security" => help_security_path}
- links.each do |title,path|
%li{class: current_page?(path) ? 'active' : nil}
= link_to title, path
.col-md-9
.wiki
= yield

View File

@ -33,53 +33,12 @@
Use
= link_to "shortcuts", '#', onclick: "new Shortcuts()"
.col-md-4
.ui-box
.title
User documentation
%ul.well-list
%li
%strong= link_to "Workflow", help_workflow_path
%p Learn how to use Git and GitLab together.
.col-md-8
.ui-box.documentation
.title Documentation
%li
%strong= link_to "SSH keys", help_ssh_path
%p Setup secure access to your projects.
%li
%strong= link_to "GitLab Markdown", help_markdown_path
%p Learn what you can do with GitLab's advanced formatting system.
%li
%strong= link_to "Permissions", help_permissions_path
%p Get familiar with GitLab's permission levels.
%li
%strong= link_to "API", help_api_file_path(category: 'README')
%p Explore how you can access GitLab via a simple and powerful API.
%li
%strong= link_to "Web Hooks", help_web_hooks_path
%p Let GitLab notify you when new code has been pushed to your project.
.col-md-4
.ui-box
.title
Admin documentation
%ul.well-list
%li
%strong= link_to "Rake Tasks", help_raketasks_path
%p Explore what GitLab has in store for you to make administration easier.
%li
%strong= link_to "System Hooks", help_system_hooks_path
%p Let GitLab notify you when certain management tasks need to be carried out.
%li
%strong= link_to "Public Access", help_public_access_path
%p Learn how you can allow public access to a project.
%li
%strong= link_to "Security", help_security_path
%p Learn what you can do to secure your GitLab instance.
= preserve do
- readme_text = File.read(Rails.root.join("doc", "README.md"))
- text = readme_text.dup
- readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") }
= markdown text

View File

@ -0,0 +1,3 @@
.col-md-12
.documentation
= markdown File.read(Rails.root.join('doc', @category, @file + '.md'))

View File

@ -6,7 +6,7 @@
SSH keys allow you to establish a secure connection between your computer and GitLab
%br
Before you can add an SSH key you need to
= link_to "generate it", help_ssh_path
= link_to "generate it", help_page_path("ssh", "README")
%hr

View File

@ -1,6 +1,6 @@
%h3.page-title Add an SSH Key
%p.light
Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_ssh_path}.
Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_page_path("ssh", "README")}.
%hr
= render 'form'

View File

@ -1,7 +1,7 @@
.form-group.project-visibility-level-holder
= f.label :visibility_level, class: 'control-label' do
Visibility Level
= link_to "(?)", help_public_access_path
= link_to "(?)", help_page_path("public_access", "public_access")
.col-sm-10
- if can_change_visibility_level
- Gitlab::VisibilityLevel.values.each do |level|

View File

@ -14,7 +14,7 @@
.col-sm-10
%p.light
Paste a machine public key here. Read more about how to generate it
= link_to "here", help_ssh_path
= link_to "here", help_page_path("ssh", "README")
= f.text_area :key, class: "form-control thin_area", rows: 5
.form-actions

View File

@ -2,7 +2,7 @@
Web hooks
%p.light
#{link_to "Web hooks ", help_web_hooks_path, class: "vlink"} can be
#{link_to "Web hooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be
used for binding events when something is happening within the project.
%hr.clearfix

View File

@ -22,7 +22,7 @@
.col-sm-10
= f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 14
.col-sm-12.hint
.pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
.clearfix
.error-alert

View File

@ -24,9 +24,8 @@
.col-sm-10
= f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 14
.col-sm-12.hint
.pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
.clearfix
.error-alert
%hr

View File

@ -25,9 +25,8 @@
= f.label :description, "Description"
= f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 10
.col-sm-12.hint
.pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
.clearfix
.error-alert
.form-group

View File

@ -23,7 +23,7 @@
.col-sm-10
= f.text_area :description, maxlength: 2000, class: "form-control markdown-area", rows: 10
.hint
.pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-left Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
.clearfix
.error-alert

View File

@ -17,7 +17,7 @@
= f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input markdown-area'
.light.clearfix.hint
.pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
.error-alert
.note-preview-holder.hide

View File

@ -5,10 +5,10 @@
.bs-callout.bs-callout-info
%p Protected branches designed to
%ul
%li prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}.
%li prevent push for all except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"}.
%li prevent branch from force push
%li prevent branch from removal
%p Read more about project permissions #{link_to "here", help_permissions_path, class: "underlined-link"}
%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "underlined-link"}
- if can? current_user, :admin_project, @project
= form_for [@project, @protected_branch], html: { class: 'form-horizontal' } do |f|

View File

@ -10,7 +10,7 @@
%p.light
Read more about project permissions
%strong= link_to "here", help_permissions_path, class: "vlink"
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
= render "team", members: @users_projects
- if @group
= render "group_members"

View File

@ -24,9 +24,8 @@
.col-sm-10
= f.text_area :content, class: 'form-control js-gfm-input markdown-area', rows: 18
.col-sm-12.hint
.pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
.clearfix
.error-alert
.form-group

View File

@ -31,19 +31,10 @@ Gitlab::Application.routes.draw do
#
# Help
#
get 'help' => 'help#index'
get 'help/api' => 'help#api'
get 'help/api/:category' => 'help#api', as: 'help_api_file'
get 'help/markdown' => 'help#markdown'
get 'help/permissions' => 'help#permissions'
get 'help/public_access' => 'help#public_access'
get 'help/raketasks' => 'help#raketasks'
get 'help/ssh' => 'help#ssh'
get 'help/system_hooks' => 'help#system_hooks'
get 'help/web_hooks' => 'help#web_hooks'
get 'help/workflow' => 'help#workflow'
get 'help' => 'help#index'
get 'help/:category/:file' => 'help#show', as: :help_page
get 'help/shortcuts'
get 'help/security'
#
# Global snippets

View File

@ -1,2 +1,2 @@
+ [Workflow](workflow/workflow.md)
+ [Project Features](workflow/project_features.md)
+ [Workflow](workflow.md)
+ [Project Features](project_features.md)

View File

@ -8,14 +8,14 @@ class Spinach::Features::Help < Spinach::FeatureSteps
end
step 'I visit the "Rake Tasks" help page' do
visit help_raketasks_path
visit help_page_path("raketasks", "maintenance")
end
step 'I should see "Rake Tasks" page markdown rendered' do
page.should have_content "GitLab provides some specific rake tasks to enable special features or perform maintenance tasks"
page.should have_content "Gather information about GitLab and the system it runs on"
end
step 'Header "Rebuild project satellites" should have correct ids and links' do
header_should_have_correct_id_and_link(3, '(Re-)Create satellite repos', 're-create-satellite-repos')
header_should_have_correct_id_and_link(3, '(Re-)Create satellite repos', 're-create-satellite-repos', '.documentation')
end
end

View File

@ -79,35 +79,35 @@ describe HelpController, "routing" do
end
it "to #permissions" do
get("/help/permissions").should route_to('help#permissions')
get("/help/permissions/permissions").should route_to('help#show', category: "permissions", file: "permissions")
end
it "to #workflow" do
get("/help/workflow").should route_to('help#workflow')
get("/help/workflow/README").should route_to('help#show', category: "workflow", file: "README")
end
it "to #api" do
get("/help/api").should route_to('help#api')
get("/help/api/README").should route_to('help#show', category: "api", file: "README")
end
it "to #web_hooks" do
get("/help/web_hooks").should route_to('help#web_hooks')
get("/help/web_hooks/web_hooks").should route_to('help#show', category: "web_hooks", file: "web_hooks")
end
it "to #system_hooks" do
get("/help/system_hooks").should route_to('help#system_hooks')
get("/help/system_hooks/system_hooks").should route_to('help#show', category: "system_hooks", file: "system_hooks")
end
it "to #markdown" do
get("/help/markdown").should route_to('help#markdown')
get("/help/markdown/markdown").should route_to('help#show',category: "markdown", file: "markdown")
end
it "to #ssh" do
get("/help/ssh").should route_to('help#ssh')
get("/help/ssh/README").should route_to('help#show', category: "ssh", file: "README")
end
it "to #raketasks" do
get("/help/raketasks").should route_to('help#raketasks')
get("/help/raketasks/README").should route_to('help#show', category: "raketasks", file: "README")
end
end