_form.html.haml 1.8 KB
Newer Older
B
blackst0ne 已提交
1 2
- commit_message = @page.persisted? ? "Update #{@page.title}" : "Create #{@page.title}"

3
= 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|
4
  = form_errors(@page)
V
Valery Sizov 已提交
5

D
Dmitriy Zaporozhets 已提交
6
  = f.hidden_field :title, value: @page.title
D
Dmitriy Zaporozhets 已提交
7 8 9
  .form-group
    = f.label :format, class: 'control-label'
    .col-sm-10
D
Dmitriy Zaporozhets 已提交
10
      = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: "form-control"
D
Dmitriy Zaporozhets 已提交
11

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

19 20
      .clearfix
      .error-alert
D
Douwe Maan 已提交
21 22

      .help-block
23 24 25 26 27 28
        = succeed '.' do
          To link to a (new) page, simply type
          %code [Link Title](page-slug)

        = succeed '.' do
          More examples are in the
29
          = link_to 'documentation', help_page_path("user/markdown", anchor: "wiki-specific-markdown")
30

D
Dmitriy Zaporozhets 已提交
31 32
  .form-group
    = f.label :commit_message, class: 'control-label'
B
blackst0ne 已提交
33
    .col-sm-10= f.text_field :message, class: 'form-control', rows: 18, value: commit_message
34

35
  .form-actions
D
Dmitriy Zaporozhets 已提交
36
    - if @page && @page.persisted?
37
      = f.submit 'Save changes', class: "btn-save btn"
H
Hiroyuki Sato 已提交
38 39
      .pull-right
        = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, @page), class: "btn btn-cancel btn-grouped"
40
    - else
41
      = f.submit 'Create page', class: "btn-create btn"
H
Hiroyuki Sato 已提交
42 43
      .pull-right
        = link_to "Cancel", namespace_project_wiki_path(@project.namespace, @project, :home), class: "btn btn-cancel"