gitlab-org--gitlab-foss/app/views/projects/wikis/_form.html.haml

57 lines
2.9 KiB
Text
Raw Normal View History

2017-09-27 13:13:29 -04:00
- commit_message = @page.persisted? ? s_("WikiPageEdit|Update %{page_title}") : s_("WikiPageCreate|Create %{page_title}")
- commit_message = commit_message % { page_title: @page.title }
2017-04-04 21:58:27 -04:00
= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post,
html: { class: 'wiki-form common-note-form prepend-top-default js-quick-submit' },
data: { uploads_path: uploads_path } do |f|
= form_errors(@page)
2012-02-19 09:35:31 -05:00
2017-03-04 09:03:14 -05:00
- if @page.persisted?
2017-07-27 09:00:06 -04:00
= f.hidden_field :last_commit_sha, value: @page.last_commit_sha
.form-group.row
.col-sm-12= f.label :title, class: 'control-label-full-width'
2018-02-05 12:17:21 -05:00
.col-sm-12
= f.text_field :title, class: 'form-control qa-wiki-title-textbox', value: @page.title
2018-02-05 12:17:21 -05:00
- if @page.persisted?
%span.edit-wiki-page-slug-tip
= icon('lightbulb-o')
= s_("WikiEditPageTip|Tip: You can move this page by adding the path to the beginning of the title.")
= link_to icon('question-circle'), help_page_path('user/project/wiki/index', anchor: 'moving-a-wiki-page'), target: '_blank'
.form-group.row
.col-sm-12= f.label :format, class: 'control-label-full-width'
.col-sm-12
2017-09-27 13:13:29 -04:00
= f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: 'form-control'
.form-group.row
.col-sm-12= f.label :content, class: 'control-label-full-width'
.col-sm-12
= render layout: 'projects/md_preview', locals: { url: project_wiki_preview_markdown_path(@project, @page.slug) } do
= render 'projects/zen', f: f, attr: :content, classes: 'note-textarea qa-wiki-content-textarea', placeholder: s_("WikiPage|Write your content or drag files here…")
2017-05-03 04:48:01 -04:00
= render 'shared/notes/hints'
2014-12-24 09:52:40 -05:00
.clearfix
.error-alert
2015-12-02 07:59:42 -05:00
.form-text.text-muted
= succeed '.' do
2017-09-27 13:13:29 -04:00
= (s_("WikiMarkdownTip|To link to a (new) page, simply type %{link_example}") % { link_example: '<code>[Link Title](page-slug)</code>' }).html_safe
= succeed '.' do
2017-09-27 13:13:29 -04:00
- 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
.form-group.row
.col-sm-12= f.label :commit_message, class: 'control-label-full-width'
.col-sm-12= f.text_field :message, class: 'form-control qa-wiki-message-textbox', rows: 18, value: commit_message
2013-08-07 16:35:24 -04:00
.form-actions
- if @page && @page.persisted?
= f.submit _("Save changes"), class: 'btn-success btn qa-save-changes-button'
.float-right
2017-09-27 13:13:29 -04:00
= link_to _("Cancel"), project_wiki_path(@project, @page), class: 'btn btn-cancel btn-grouped'
- else
= f.submit s_("Wiki|Create page"), class: 'btn-success btn qa-create-page-button'
.float-right
2017-09-27 13:13:29 -04:00
= link_to _("Cancel"), project_wiki_path(@project, :home), class: 'btn btn-cancel'