summaryrefslogtreecommitdiff
path: root/app/views/projects/wikis/_form.html.haml
blob: c77ed3433d1c10fead388f16987b4da014308c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
= form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f|
  -if @page.errors.any?
    #error_explanation
      %h2= "#{pluralize(@page.errors.count, "error")} prohibited this wiki from being saved:"
      %ul
        - @page.errors.full_messages.each do |msg|
          %li= msg

  = f.hidden_field :title, value: @page.title
  .form-group
    = f.label :format, class: 'control-label'
    .col-sm-10
      = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control"

  .row
    .col-sm-2
    .col-sm-10
      %p.cgray
        Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
        To link to a (new) page you can just type
        %code [Link Title](page-slug)
        \.

  .form-group
    = f.label :content, class: 'control-label'
    .col-sm-10
      = f.text_area :content, class: 'form-control js-gfm-input', rows: 18

  .form-group
    = f.label :commit_message, class: 'control-label'
    .col-sm-10= f.text_field :message, class: 'form-control', rows: 18

  .form-actions
    - if @page && @page.persisted?
      = f.submit 'Save changes', class: "btn-save btn"
      = link_to "Cancel", project_wiki_path(@project, @page), class: "btn btn-cancel"
    - else
      = f.submit 'Create page', class: "btn-create btn"
      = link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel"