Commit c34f50ff authored by Achilleas Pipinellis's avatar Achilleas Pipinellis Committed by Craig Norris

Minor style edits

Style edits in updated text.
parent ed29856f
...@@ -306,68 +306,51 @@ with GitLab 11.4. Meaning, it's available only with `/help` from GitLab ...@@ -306,68 +306,51 @@ with GitLab 11.4. Meaning, it's available only with `/help` from GitLab
### Linking to `/help` ### Linking to `/help`
When you're building a new feature, you may need to link the documentation When you're building a new feature, you may need to link to the documentation
from GitLab, the application. This is normally done in files inside the from the GitLab application. This is normally done in files inside the
`app/views/` directory with the help of the `help_page_path` helper method. `app/views/` directory, with the help of the `help_page_path` helper method.
In its simplest form, the HAML code to generate a link to the `/help` page is: The `help_page_path` contains the path to the document you want to link to,
with the following conventions:
```haml - It's relative to the `doc/` directory in the GitLab repository.
= link_to 'Help page', help_page_path('user/permissions') - It omits the `.md` extension.
``` - It doesn't end with a slash (`/`).
The `help_page_path` contains the path to the document you want to link to with
the following conventions:
- it is relative to the `doc/` directory in the GitLab repository
- the `.md` extension must be omitted
- it must not end with a slash (`/`)
Below are some special cases where should be used depending on the context.
You can combine one or more of the following:
1. **Linking to an anchor link.** Use `anchor` as part of the `help_page_path`
method:
```haml The help text follows the [Pajamas guidelines](https://design.gitlab.com/usability/helping-users/#formatting-help-content).
= link_to 'Help page', help_page_path('user/permissions', anchor: 'anchor-link')
```
1. **Opening links in a new tab.** This should be the default behavior: Use the following special cases depending on the context, ensuring all links
are inside `_()` so they can be translated:
```haml - Linking to a doc page. In its most basic form, the HAML code to generate a
= link_to 'Help page', help_page_path('user/permissions'), target: '_blank' link to the `/help` page is:
```
1. **Using a question icon.** Usually used in settings where a long ```haml
description cannot be used, like near checkboxes. You can basically use = link_to _('Learn more.'), help_page_path('user/permissions'), target: '_blank', rel: 'noopener noreferrer'
any GitLab SVG icon, but prefer the `question-o`: ```
```haml
= link_to sprite_icon('question-o'), help_page_path('user/permissions')
```
1. **Using a button link.** Useful in places where text would be out of context - Linking to an anchor link. Use `anchor` as part of the `help_page_path`
with the rest of the page layout: method:
```haml ```haml
= link_to 'Help page', help_page_path('user/permissions'), class: 'btn btn-info' = link_to _('Learn more.'), help_page_path('user/permissions', anchor: 'anchor-link'), target: '_blank', rel: 'noopener noreferrer'
``` ```
1. **Using links inline of some text.** - Using links inline of some text. First, define the link, and then use it. In
this example, `link_start` is the name of the variable that contains the
link:
```haml ```haml
Description to #{link_to 'Help page', help_page_path('user/permissions')}. - link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/permissions') }
``` %p= _("This is a text describing the option/feature in a sentence. %{link_start}Learn more.%{link_end}").html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
```
1. **Adding a period at the end of the sentence.** Useful when you don't want - Using a button link. Useful in places where text would be out of context with
the period to be part of the link: the rest of the page layout:
```haml ```haml
= succeed '.' do = link_to _('Learn more.'), help_page_path('user/permissions'), class: 'btn btn-info', target: '_blank', rel: 'noopener noreferrer'
Learn more in the ```
= link_to 'Help page', help_page_path('user/permissions')
```
#### Linking to `/help` in JavaScript #### Linking to `/help` in JavaScript
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment