diff options
Diffstat (limited to 'app/views/projects/wikis/_form.html.haml')
-rw-r--r-- | app/views/projects/wikis/_form.html.haml | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml new file mode 100644 index 00000000000..a153f527ee0 --- /dev/null +++ b/app/views/projects/wikis/_form.html.haml @@ -0,0 +1,58 @@ +- form_classes = 'wiki-form common-note-form prepend-top-default js-quick-submit' +- form_classes += ' js-new-wiki-page' unless @page.persisted? + += form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post, + html: { class: form_classes }, + data: { uploads_path: uploads_path } do |f| + = form_errors(@page) + + - if @page.persisted? + = f.hidden_field :last_commit_sha, value: @page.last_commit_sha + + .form-group.row + .col-sm-12= f.label :title, class: 'control-label-full-width' + .col-sm-12 + = f.text_field :title, class: 'form-control qa-wiki-title-textbox', value: @page.title, required: true, autofocus: !@page.persisted?, placeholder: _('Wiki|Page title') + %span.d-inline-block.mw-100.prepend-top-5 + = icon('lightbulb-o') + - if @page.persisted? + = s_("WikiEditPageTip|Tip: You can move this page by adding the path to the beginning of the title.") + = link_to icon('question-circle'), help_page_path('user/project/wiki/index', anchor: 'moving-a-wiki-page'), target: '_blank' + - else + = s_("WikiNewPageTip|Tip: You can specify the full path for the new file. We will automatically create any missing directories.") + .form-group.row + .col-sm-12= f.label :format, class: 'control-label-full-width' + .col-sm-12 + = f.select :format, options_for_select(ProjectWiki::MARKUPS, {selected: @page.format}), {}, class: 'form-control' + + .form-group.row + .col-sm-12= f.label :content, class: 'control-label-full-width' + .col-sm-12 + = render layout: 'projects/md_preview', locals: { url: project_wiki_preview_markdown_path(@project, @page.slug) } do + = render 'projects/zen', f: f, attr: :content, classes: 'note-textarea qa-wiki-content-textarea', placeholder: s_("WikiPage|Write your content or drag files hereā¦") + = render 'shared/notes/hints' + + .clearfix + .error-alert + + .form-text.text-muted + = succeed '.' do + = (s_("WikiMarkdownTip|To link to a (new) page, simply type %{link_example}") % { link_example: '<code>[Link Title](page-slug)</code>' }).html_safe + + = succeed '.' do + - markdown_link = link_to s_("WikiMarkdownDocs|documentation"), help_page_path('user/markdown', anchor: 'wiki-specific-markdown') + = (s_("WikiMarkdownDocs|More examples are in the %{docs_link}") % { docs_link: markdown_link }).html_safe + + .form-group.row + .col-sm-12= f.label :commit_message, class: 'control-label-full-width' + .col-sm-12= f.text_field :message, class: 'form-control qa-wiki-message-textbox', rows: 18, value: nil + + .form-actions + - if @page && @page.persisted? + = f.submit _("Save changes"), class: 'btn-success btn qa-save-changes-button' + .float-right + = link_to _("Cancel"), project_wiki_path(@project, @page), class: 'btn btn-cancel btn-grouped' + - else + = f.submit s_("Wiki|Create page"), class: 'btn-success btn qa-create-page-button rspec-create-page-button' + .float-right + = link_to _("Cancel"), project_wiki_path(@project, :home), class: 'btn btn-cancel' |