BigW Consortium Gitlab

_form.html.haml 1.48 KB
Newer Older
1
= 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|
2
  = form_errors(@page)
Valery Sizov committed
3

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

Douwe Maan committed
10
  .form-group
11 12
    = f.label :content, class: 'control-label'
    .col-sm-10
13
      = render layout: 'projects/md_preview', locals: { preview_class: "md-preview" } do
14
        = render 'projects/zen', f: f, attr: :content, classes: 'note-textarea', placeholder: 'Write your content or drag files here...'
15
        = render 'projects/notes/hints'
yglukhov committed
16

17 18
      .clearfix
      .error-alert
Douwe Maan committed
19 20 21 22 23

      .help-block
        To link to a (new) page, simply type
        %code [Link Title](page-slug)
        \.
24 25 26
  .form-group
    = f.label :commit_message, class: 'control-label'
    .col-sm-10= f.text_field :message, class: 'form-control', rows: 18
27

28
  .form-actions
29
    - if @page && @page.persisted?
30
      = f.submit 'Save changes', class: "btn-save btn"
Vinnie Okada committed
31
      = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, @page), class: "btn btn-cancel"
32
    - else
33
      = f.submit 'Create page', class: "btn-create btn"
Vinnie Okada committed
34
      = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, :home), class: "btn btn-cancel"