48 lines
2.4 KiB
Text
48 lines
2.4 KiB
Text
- commit_message = @page.persisted? ? s_("WikiPageEdit|Update %{page_title}") : s_("WikiPageCreate|Create %{page_title}")
|
|
- commit_message = commit_message % { page_title: @page.title }
|
|
|
|
= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form common-note-form prepend-top-default js-quick-submit' } do |f|
|
|
= form_errors(@page)
|
|
|
|
- if @page.persisted?
|
|
= f.hidden_field :last_commit_sha, value: @page.last_commit_sha
|
|
|
|
.form-group
|
|
.col-sm-12= f.label :title, class: 'control-label-full-width'
|
|
.col-sm-12= f.text_field :title, class: 'form-control', value: @page.title
|
|
.form-group
|
|
.col-sm-12= f.label :format, class: 'control-label-full-width'
|
|
.col-sm-12
|
|
= f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: 'form-control'
|
|
|
|
.form-group
|
|
.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', placeholder: s_("WikiPage|Write your content or drag files here...")
|
|
= render 'shared/notes/hints'
|
|
|
|
.clearfix
|
|
.error-alert
|
|
|
|
.help-block
|
|
= succeed '.' do
|
|
= (s_("WikiMarkdownTip|To link to a (new) page, simply type %{link_example}") % { link_example: '<code>[Link Title](page-slug)</code>' }).html_safe
|
|
|
|
= succeed '.' do
|
|
- 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
|
|
.col-sm-12= f.label :commit_message, class: 'control-label-full-width'
|
|
.col-sm-12= f.text_field :message, class: 'form-control', rows: 18, value: commit_message
|
|
|
|
.form-actions
|
|
- if @page && @page.persisted?
|
|
= f.submit _("Save changes"), class: 'btn-save btn'
|
|
.pull-right
|
|
= link_to _("Cancel"), project_wiki_path(@project, @page), class: 'btn btn-cancel btn-grouped'
|
|
- else
|
|
= f.submit s_("Wiki|Create page"), class: 'btn-create btn'
|
|
.pull-right
|
|
= link_to _("Cancel"), project_wiki_path(@project, :home), class: 'btn btn-cancel'
|