debian-mirror-gitlab/app/views/shared/wikis/_form.html.haml

80 lines
4.2 KiB
Text
Raw Normal View History

2020-07-28 23:09:34 +05:30
- form_classes = %w[wiki-form common-note-form gl-mt-3 js-quick-submit]
2017-08-17 22:00:37 +05:30
2020-06-23 00:09:42 +05:30
- if @page.persisted?
- form_action = wiki_page_path(@wiki, @page)
- form_method = :put
- else
- form_action = wiki_path(@wiki, action: :create)
- form_method = :post
- form_classes << 'js-new-wiki-page'
= form_for @page, url: form_action, method: form_method,
2019-12-04 20:38:33 +05:30
html: { class: form_classes },
2019-03-02 22:35:43 +05:30
data: { uploads_path: uploads_path } do |f|
2020-04-08 14:13:33 +05:30
= form_errors(@page, truncate: :title)
2014-09-02 18:07:02 +05:30
2017-09-10 17:25:29 +05:30
- if @page.persisted?
= f.hidden_field :last_commit_sha, value: @page.last_commit_sha
2018-11-08 19:23:39 +05:30
.form-group.row
2021-01-03 14:25:43 +05:30
.col-sm-2.col-form-label= f.label :title, class: 'control-label-full-width'
.col-sm-10
2020-04-08 14:13:33 +05:30
= f.text_field :title, class: 'form-control qa-wiki-title-textbox', value: @page.title, required: true, autofocus: !@page.persisted?, placeholder: s_('Wiki|Page title')
2021-01-03 14:25:43 +05:30
%span.gl-display-inline-block.gl-max-w-full.gl-mt-2.gl-text-gray-600
2020-11-24 15:15:51 +05:30
= sprite_icon('bulb', size: 12, css_class: 'gl-mr-n1')
2019-12-04 20:38:33 +05:30
- if @page.persisted?
2018-03-17 18:26:18 +05:30
= s_("WikiEditPageTip|Tip: You can move this page by adding the path to the beginning of the title.")
2020-11-24 15:15:51 +05:30
= link_to sprite_icon('question-o'), help_page_path('user/project/wiki/index', anchor: 'moving-a-wiki-page'),
2020-03-13 15:44:24 +05:30
target: '_blank', rel: 'noopener noreferrer'
2019-12-04 20:38:33 +05:30
- else
= s_("WikiNewPageTip|Tip: You can specify the full path for the new file. We will automatically create any missing directories.")
2020-03-13 15:44:24 +05:30
= succeed '.' do
2021-01-03 14:25:43 +05:30
= link_to _('More information'), help_page_path('user/project/wiki/index', anchor: 'creating-a-new-wiki-page'),
2020-03-13 15:44:24 +05:30
target: '_blank', rel: 'noopener noreferrer'
2018-11-08 19:23:39 +05:30
.form-group.row
2021-01-03 14:25:43 +05:30
.col-sm-2.col-form-label= f.label :format, class: 'control-label-full-width'
.col-sm-10
2020-03-13 15:44:24 +05:30
.select-wrapper
2020-06-23 00:09:42 +05:30
= f.select :format, options_for_select(Wiki::MARKUPS, {selected: @page.format}), {}, class: 'form-control select-control'
2021-02-22 17:27:13 +05:30
= sprite_icon('chevron-down', css_class: 'gl-absolute gl-top-3 gl-right-3 gl-text-gray-200')
2014-09-02 18:07:02 +05:30
2018-11-08 19:23:39 +05:30
.form-group.row
2021-01-03 14:25:43 +05:30
.col-sm-2.col-form-label= f.label :content, class: 'control-label-full-width'
.col-sm-10
2020-06-23 00:09:42 +05:30
= render layout: 'shared/md_preview', locals: { url: wiki_page_path(@wiki, @page, action: :preview_markdown) } do
2021-03-08 18:12:59 +05:30
= render 'shared/zen', f: f, attr: :content, classes: 'note-textarea qa-wiki-content-textarea', placeholder: s_("WikiPage|Write your content or drag files here…"), autofocus: @page.persisted?
2017-08-17 22:00:37 +05:30
= render 'shared/notes/hints'
2015-04-26 12:48:37 +05:30
2014-09-02 18:07:02 +05:30
.clearfix
.error-alert
2015-12-23 02:04:40 +05:30
2021-01-03 14:25:43 +05:30
.form-text.gl-text-gray-600
2016-09-13 17:45:13 +05:30
= succeed '.' do
2020-04-08 14:13:33 +05:30
- case @page.format.to_s
- when 'rdoc'
- link_example = '{Link title}[link:page-slug]'
- when 'asciidoc'
- link_example = 'link:page-slug[Link title]'
- when 'org'
- link_example = '[[page-slug]]'
- else
- link_example = '[Link Title](page-slug)'
2020-10-24 23:57:45 +05:30
= html_escape(s_('WikiMarkdownTip|To link to a (new) page, simply type %{link_example}')) % { link_example: tag.code(link_example, class: 'js-markup-link-example') }
2016-09-13 17:45:13 +05:30
= succeed '.' do
2018-03-17 18:26:18 +05:30
- markdown_link = link_to s_("WikiMarkdownDocs|documentation"), help_page_path('user/markdown', anchor: 'wiki-specific-markdown')
= (s_("WikiMarkdownDocs|More examples are in the %{docs_link}") % { docs_link: markdown_link }).html_safe
2016-09-13 17:45:13 +05:30
2018-11-08 19:23:39 +05:30
.form-group.row
2021-01-03 14:25:43 +05:30
.col-sm-2.col-form-label= f.label :commit_message, class: 'control-label-full-width'
.col-sm-10= f.text_field :message, class: 'form-control qa-wiki-message-textbox', rows: 18, value: nil
2014-09-02 18:07:02 +05:30
.form-actions
- if @page && @page.persisted?
2021-04-17 20:07:23 +05:30
= f.submit _("Save changes"), class: 'btn gl-button btn-confirm qa-save-changes-button js-wiki-btn-submit', disabled: 'true'
2018-11-08 19:23:39 +05:30
.float-right
2021-03-08 18:12:59 +05:30
= link_to _("Cancel"), wiki_page_path(@wiki, @page), class: 'btn gl-button btn-cancel btn-default'
2014-09-02 18:07:02 +05:30
- else
2021-04-17 20:07:23 +05:30
= f.submit s_("Wiki|Create page"), class: 'btn-confirm gl-button btn qa-create-page-button rspec-create-page-button js-wiki-btn-submit', disabled: 'true'
2018-11-08 19:23:39 +05:30
.float-right
2021-03-08 18:12:59 +05:30
= link_to _("Cancel"), wiki_path(@wiki), class: 'btn gl-button btn-cancel btn-default'