gitlab-org--gitlab-foss/app/views/wikis/_form.html.haml
Dan Knox 8300ae366c Fix the Cancel button on the Edit Wiki page.
The Cancel button on the Edit Wiki page was still redirecting back
to the "Index" page which is no longer the default Wiki page.

This commit changes the Cancel button in the following ways:

  * Pressing Cancel while editing an existing Wiki page will now
    redirect you back to the latest version of that page.
  * Pressing Cancel while editing a brand new Wiki home page that
    does not yet exist will redirect you to back to the same Edit
    Wiki Home page.
2013-03-19 21:36:09 -07:00

36 lines
1.4 KiB
Text

= form_for [@project, @wiki] do |f|
-if @wiki.errors.any?
#error_explanation
%h2= "#{pluralize(@wiki.errors.count, "error")} prohibited this wiki from being saved:"
%ul
- @wiki.errors.full_messages.each do |msg|
%li= msg
.ui-box.ui-box-show
.ui-box-head
%h3.page_title
.edit-wiki-header
= @wiki.title.titleize
= f.hidden_field :title, value: @wiki.title
= f.select :format, options_for_select(GollumWiki::MARKUPS, {selected: @wiki.format}), {}, class: "pull-right input-medium"
= f.label :format, class: "pull-right", style: "padding-right: 20px;"
.ui-box-body
.input
%span.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)
\.
.ui-box-bottom
= f.label :content
.input= f.text_area :content, class: 'span8 js-gfm-input'
.ui-box-bottom
= f.label :commit_message
.input= f.text_field :message, class: 'span8'
.actions
= f.submit 'Save', class: "btn-save btn"
- if @wiki && @wiki.persisted?
= link_to "Cancel", project_wiki_path(@project, @wiki), class: "btn btn-cancel"
- else
= link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel"