Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
d365004e
Commit
d365004e
authored
Oct 07, 2014
by
Sullivan SENECHAL
Committed by
Sullivan SENECHAL
Apr 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and improve help rendering
parent
0d0042d2
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
28 deletions
+48
-28
CHANGELOG
CHANGELOG
+1
-0
app/controllers/help_controller.rb
app/controllers/help_controller.rb
+23
-5
app/views/help/show.html.haml
app/views/help/show.html.haml
+1
-1
config/initializers/mime_types.rb
config/initializers/mime_types.rb
+1
-0
config/routes.rb
config/routes.rb
+1
-1
features/steps/dashboard/help.rb
features/steps/dashboard/help.rb
+1
-1
spec/features/help_pages_spec.rb
spec/features/help_pages_spec.rb
+1
-1
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+19
-19
No files found.
CHANGELOG
View file @
d365004e
...
@@ -56,6 +56,7 @@ v 7.10.0 (unreleased)
...
@@ -56,6 +56,7 @@ v 7.10.0 (unreleased)
- Fix "Hello @username." references not working by no longer allowing usernames to end in period.
- Fix "Hello @username." references not working by no longer allowing usernames to end in period.
- Archive repositories in background worker.
- Archive repositories in background worker.
- Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
- Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
- Fix and improve help rendering (Sullivan Sénéchal)
v 7.9.2
v 7.9.2
...
...
app/controllers/help_controller.rb
View file @
d365004e
...
@@ -3,17 +3,35 @@ class HelpController < ApplicationController
...
@@ -3,17 +3,35 @@ class HelpController < ApplicationController
end
end
def
show
def
show
@
category
=
params
[
:category
]
@
filepath
=
params
[
:filepath
]
@f
ile
=
params
[
:file
]
@f
ormat
=
params
[
:format
]
if
File
.
exists?
(
Rails
.
root
.
join
(
'doc'
,
@category
,
@file
+
'.md'
))
respond_to
do
|
format
|
render
'show'
format
.
md
{
render_doc
}
format
.
all
{
send_file_data
}
end
end
def
shortcuts
end
private
def
render_doc
if
File
.
exists?
(
Rails
.
root
.
join
(
'doc'
,
@filepath
+
'.md'
))
render
'show.html.haml'
else
else
not_found!
not_found!
end
end
end
end
def
shortcuts
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
end
end
def
ui
def
ui
...
...
app/views/help/show.html.haml
View file @
d365004e
.documentation.wiki
.documentation.wiki
=
markdown
File
.
read
(
Rails
.
root
.
join
(
'doc'
,
@
category
,
@file
+
'.md'
)).
gsub
(
"$your_email"
,
current_user
.
email
)
=
markdown
File
.
read
(
Rails
.
root
.
join
(
'doc'
,
@
filepath
+
'.md'
)).
gsub
(
"$your_email"
,
current_user
.
email
)
config/initializers/mime_types.rb
View file @
d365004e
...
@@ -6,3 +6,4 @@
...
@@ -6,3 +6,4 @@
Mime
::
Type
.
register_alias
"text/plain"
,
:diff
Mime
::
Type
.
register_alias
"text/plain"
,
:diff
Mime
::
Type
.
register_alias
"text/plain"
,
:patch
Mime
::
Type
.
register_alias
"text/plain"
,
:patch
Mime
::
Type
.
register_alias
'text/html'
,
:md
config/routes.rb
View file @
d365004e
...
@@ -39,9 +39,9 @@ Gitlab::Application.routes.draw do
...
@@ -39,9 +39,9 @@ Gitlab::Application.routes.draw do
# Help
# Help
get
'help'
=>
'help#index'
get
'help'
=>
'help#index'
get
'help/:category/:file'
=>
'help#show'
,
as: :help_page
get
'help/shortcuts'
get
'help/shortcuts'
get
'help/ui'
=>
'help#ui'
get
'help/ui'
=>
'help#ui'
get
'help/:filepath'
=>
'help#show'
,
as: :help_page
,
constraints:
{
filepath:
/[^\.]+/
}
#
#
# Global snippets
# Global snippets
...
...
features/steps/dashboard/help.rb
View file @
d365004e
...
@@ -8,7 +8,7 @@ class Spinach::Features::DashboardHelp < Spinach::FeatureSteps
...
@@ -8,7 +8,7 @@ class Spinach::Features::DashboardHelp < Spinach::FeatureSteps
end
end
step
'I visit the "Rake Tasks" help page'
do
step
'I visit the "Rake Tasks" help page'
do
visit
help_page_path
(
"raketasks"
,
"maintenance"
)
visit
help_page_path
(
'raketasks/maintenance'
,
format:
'md'
)
end
end
step
'I should see "Rake Tasks" page markdown rendered'
do
step
'I should see "Rake Tasks" page markdown rendered'
do
...
...
spec/features/help_pages_spec.rb
View file @
d365004e
...
@@ -6,7 +6,7 @@ describe 'Help Pages', feature: true do
...
@@ -6,7 +6,7 @@ describe 'Help Pages', feature: true do
login_as
:user
login_as
:user
end
end
it
'replace the variable $your_email with the email of the user'
do
it
'replace the variable $your_email with the email of the user'
do
visit
help_page_path
(
category:
'ssh'
,
file:
'README.
md'
)
visit
help_page_path
(
filepath:
'ssh/README'
,
format:
'
md'
)
expect
(
page
).
to
have_content
(
"ssh-keygen -t rsa -C
\"
#{
@user
.
email
}
\"
"
)
expect
(
page
).
to
have_content
(
"ssh-keygen -t rsa -C
\"
#{
@user
.
email
}
\"
"
)
end
end
end
end
...
...
spec/routing/routing_spec.rb
View file @
d365004e
...
@@ -73,41 +73,41 @@ end
...
@@ -73,41 +73,41 @@ end
# help_markdown GET /help/markdown(.:format) help#markdown
# help_markdown GET /help/markdown(.:format) help#markdown
# help_ssh GET /help/ssh(.:format) help#ssh
# help_ssh GET /help/ssh(.:format) help#ssh
# help_raketasks GET /help/raketasks(.:format) help#raketasks
# help_raketasks GET /help/raketasks(.:format) help#raketasks
describe
HelpController
,
"routing"
do
describe
HelpController
,
'routing'
do
it
"to #index"
do
it
'to #index'
do
expect
(
get
(
"/help"
)).
to
route_to
(
'help#index'
)
expect
(
get
(
'/help'
)).
to
route_to
(
'help#index'
)
end
end
it
"to #permissions"
do
it
'to #permissions'
do
expect
(
get
(
"/help/permissions/permissions"
)).
to
route_to
(
'help#show'
,
category:
"permissions"
,
file:
"permissions"
)
expect
(
get
(
'/help/permissions/permissions'
)).
to
route_to
(
'help#show'
,
filepath:
'permissions/permissions'
)
end
end
it
"to #workflow"
do
it
'to #workflow'
do
expect
(
get
(
"/help/workflow/README"
)).
to
route_to
(
'help#show'
,
category:
"workflow"
,
file:
"README"
)
expect
(
get
(
'/help/workflow/README'
)).
to
route_to
(
'help#show'
,
filepath:
'workflow/README'
)
end
end
it
"to #api"
do
it
'to #api'
do
expect
(
get
(
"/help/api/README"
)).
to
route_to
(
'help#show'
,
category:
"api"
,
file:
"README"
)
expect
(
get
(
'/help/api/README'
)).
to
route_to
(
'help#show'
,
filepath:
'api/README'
)
end
end
it
"to #web_hooks"
do
it
'to #web_hooks'
do
expect
(
get
(
"/help/web_hooks/web_hooks"
)).
to
route_to
(
'help#show'
,
category:
"web_hooks"
,
file:
"web_hooks"
)
expect
(
get
(
'/help/web_hooks/web_hooks'
)).
to
route_to
(
'help#show'
,
filepath:
'web_hooks/web_hooks'
)
end
end
it
"to #system_hooks"
do
it
'to #system_hooks'
do
expect
(
get
(
"/help/system_hooks/system_hooks"
)).
to
route_to
(
'help#show'
,
category:
"system_hooks"
,
file:
"system_hooks"
)
expect
(
get
(
'/help/system_hooks/system_hooks'
)).
to
route_to
(
'help#show'
,
filepath:
'system_hooks/system_hooks'
)
end
end
it
"to #markdown"
do
it
'to #markdown'
do
expect
(
get
(
"/help/markdown/markdown"
)).
to
route_to
(
'help#show'
,
category:
"markdown"
,
file:
"markdown"
)
expect
(
get
(
'/help/markdown/markdown'
)).
to
route_to
(
'help#show'
,
filepath:
'markdown/markdown'
)
end
end
it
"to #ssh"
do
it
'to #ssh'
do
expect
(
get
(
"/help/ssh/README"
)).
to
route_to
(
'help#show'
,
category:
"ssh"
,
file:
"README"
)
expect
(
get
(
'/help/ssh/README'
)).
to
route_to
(
'help#show'
,
filepath:
'ssh/README'
)
end
end
it
"to #raketasks"
do
it
'to #raketasks'
do
expect
(
get
(
"/help/raketasks/README"
)).
to
route_to
(
'help#show'
,
category:
"raketasks"
,
file:
"README"
)
expect
(
get
(
'/help/raketasks/README'
)).
to
route_to
(
'help#show'
,
filepath:
'raketasks/README'
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment