_form.html.haml 1.68 KB
Newer Older
1 2
= form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f|
  -if @page.errors.any?
Valery Sizov's avatar
Valery Sizov committed
3
    #error_explanation
4
      .alert.alert-danger
5
        - @page.errors.full_messages.each do |msg|
6
          %p= msg
Valery Sizov's avatar
Valery Sizov committed
7

8
  = f.hidden_field :title, value: @page.title
9 10 11
  .form-group
    = f.label :format, class: 'control-label'
    .col-sm-10
12
      = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control"
13 14 15 16 17 18 19 20 21 22 23 24

  .row
    .col-sm-2
    .col-sm-10
      %p.cgray
        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
25 26 27 28 29 30
      = f.text_area :content, class: 'form-control js-gfm-input markdown-area', rows: 18
      .col-sm-12.hint
        .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
        .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
      .clearfix
      .error-alert
31 32 33
  .form-group
    = f.label :commit_message, class: 'control-label'
    .col-sm-10= f.text_field :message, class: 'form-control', rows: 18
34

35
  .form-actions
36
    - if @page && @page.persisted?
37
      = f.submit 'Save changes', class: "btn-save btn"
38
      = link_to "Cancel", project_wiki_path(@project, @page), class: "btn btn-cancel"
39
    - else
40
      = f.submit 'Create page', class: "btn-create btn"
41
      = link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel"
42 43 44 45
      
:javascript
  window.project_image_path_upload = "#{upload_image_project_path @project}";