BigW Consortium Gitlab

_form.html.haml 1.83 KB
Newer Older
Vinnie Okada committed
1
= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form gfm-form' } do |f|
2
  -if @page.errors.any?
Valery Sizov committed
3
    #error_explanation
4
      .alert.alert-danger
5
        - @page.errors.full_messages.each do |msg|
6
          %p= msg
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

  .row
15
    .col-sm-offset-2.col-sm-10
16 17 18 19 20
      %p.cgray
        To link to a (new) page you can just type
        %code [Link Title](page-slug)
        \.

yglukhov committed
21
  .form-group.wiki-content
22 23
    = f.label :content, class: 'control-label'
    .col-sm-10
24
      = render layout: 'projects/md_preview', locals: { preview_class: "md-preview" } do
25
        = render 'projects/zen', f: f, attr: :content, classes: 'description form-control js-quick-submit'
yglukhov committed
26 27
        .col-sm-12.hint
          .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
28
          .pull-right Attach files by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
yglukhov committed
29

30 31
      .clearfix
      .error-alert
32 33 34
  .form-group
    = f.label :commit_message, class: 'control-label'
    .col-sm-10= f.text_field :message, class: 'form-control', rows: 18
35

36
  .form-actions
37
    - if @page && @page.persisted?
38
      = f.submit 'Save changes', class: "btn-save btn"
Vinnie Okada committed
39
      = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, @page), class: "btn btn-cancel"
40
    - else
41
      = f.submit 'Create page', class: "btn-create btn"
Vinnie Okada committed
42
      = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, :home), class: "btn btn-cancel"