Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-01 00:06:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-01 00:06:28 +0300
commit8f210aebe1d740e8ee194f171f1f33a6e1fba313 (patch)
treef43c545801bb96fd0737f18493fb30ab92972627 /app/views/projects/wikis
parent996f700997805b3590da8d8afdd19d193989078a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/views/projects/wikis')
-rw-r--r--app/views/projects/wikis/_form.html.haml58
-rw-r--r--app/views/projects/wikis/_main_links.html.haml9
-rw-r--r--app/views/projects/wikis/_pages_wiki_page.html.haml6
-rw-r--r--app/views/projects/wikis/_sidebar.html.haml21
-rw-r--r--app/views/projects/wikis/_sidebar_wiki_page.html.haml3
-rw-r--r--app/views/projects/wikis/_wiki_directory.html.haml4
-rw-r--r--app/views/projects/wikis/_wiki_page.html.haml1
-rw-r--r--app/views/projects/wikis/edit.html.haml31
-rw-r--r--app/views/projects/wikis/empty.html.haml4
-rw-r--r--app/views/projects/wikis/history.html.haml42
-rw-r--r--app/views/projects/wikis/pages.html.haml32
-rw-r--r--app/views/projects/wikis/show.html.haml35
12 files changed, 242 insertions, 4 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'
diff --git a/app/views/projects/wikis/_main_links.html.haml b/app/views/projects/wikis/_main_links.html.haml
new file mode 100644
index 00000000000..2e1e176c42a
--- /dev/null
+++ b/app/views/projects/wikis/_main_links.html.haml
@@ -0,0 +1,9 @@
+- if (@page && @page.persisted?)
+ - if can?(current_user, :create_wiki, @project)
+ = link_to project_wikis_new_path(@project), class: "add-new-wiki btn btn-success", role: "button" do
+ = s_("Wiki|New page")
+ = link_to project_wiki_history_path(@project, @page), class: "btn", role: "button" do
+ = s_("Wiki|Page history")
+ - if can?(current_user, :create_wiki, @project) && @page.latest? && @valid_encoding
+ = link_to project_wiki_edit_path(@project, @page), class: "btn js-wiki-edit", role: "button" do
+ = _("Edit")
diff --git a/app/views/projects/wikis/_pages_wiki_page.html.haml b/app/views/projects/wikis/_pages_wiki_page.html.haml
new file mode 100644
index 00000000000..c156f8cbf50
--- /dev/null
+++ b/app/views/projects/wikis/_pages_wiki_page.html.haml
@@ -0,0 +1,6 @@
+%li
+ = link_to wiki_page.title, project_wiki_path(@project, wiki_page)
+ %small (#{wiki_page.format})
+ .float-right
+ - if wiki_page.last_version
+ %small= (s_("Last edited %{date}") % { date: time_ago_with_tooltip(wiki_page.last_version.authored_date) }).html_safe
diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml
new file mode 100644
index 00000000000..83d145444d8
--- /dev/null
+++ b/app/views/projects/wikis/_sidebar.html.haml
@@ -0,0 +1,21 @@
+%aside.right-sidebar.right-sidebar-expanded.wiki-sidebar.js-wiki-sidebar.js-right-sidebar{ data: { "offset-top" => "50", "spy" => "affix" } }
+ .sidebar-container
+ .block.wiki-sidebar-header.append-bottom-default.w-100
+ %a.gutter-toggle.float-right.d-block.d-sm-block.d-md-none.js-sidebar-wiki-toggle{ href: "#" }
+ = icon('angle-double-right')
+
+ - git_access_url = project_wikis_git_access_path(@project)
+ = link_to git_access_url, class: active_nav_link?(path: 'wikis#git_access') ? 'active' : '' do
+ = icon('cloud-download', class: 'append-right-5')
+ %span= _("Clone repository")
+
+ .blocks-container
+ .block.block-first.w-100
+ - if @sidebar_page
+ = render_wiki_content(@sidebar_page)
+ - else
+ %ul.wiki-pages
+ = render @sidebar_wiki_entries, context: 'sidebar'
+ .block.w-100
+ = link_to project_wikis_pages_path(@project), class: 'btn btn-block' do
+ = s_("Wiki|More Pages")
diff --git a/app/views/projects/wikis/_sidebar_wiki_page.html.haml b/app/views/projects/wikis/_sidebar_wiki_page.html.haml
new file mode 100644
index 00000000000..769d869bd53
--- /dev/null
+++ b/app/views/projects/wikis/_sidebar_wiki_page.html.haml
@@ -0,0 +1,3 @@
+%li{ class: active_when(params[:id] == wiki_page.slug) }
+ = link_to project_wiki_path(@project, wiki_page) do
+ = wiki_page.human_title
diff --git a/app/views/projects/wikis/_wiki_directory.html.haml b/app/views/projects/wikis/_wiki_directory.html.haml
new file mode 100644
index 00000000000..0e5f32ed859
--- /dev/null
+++ b/app/views/projects/wikis/_wiki_directory.html.haml
@@ -0,0 +1,4 @@
+%li
+ = wiki_directory.slug
+ %ul
+ = render wiki_directory.pages, context: context
diff --git a/app/views/projects/wikis/_wiki_page.html.haml b/app/views/projects/wikis/_wiki_page.html.haml
new file mode 100644
index 00000000000..c84d06dad02
--- /dev/null
+++ b/app/views/projects/wikis/_wiki_page.html.haml
@@ -0,0 +1 @@
+= render "#{context}_wiki_page", wiki_page: wiki_page
diff --git a/app/views/projects/wikis/edit.html.haml b/app/views/projects/wikis/edit.html.haml
new file mode 100644
index 00000000000..9ccf5acfefc
--- /dev/null
+++ b/app/views/projects/wikis/edit.html.haml
@@ -0,0 +1,31 @@
+- @content_class = "limit-container-width" unless fluid_layout
+- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, @page)
+- breadcrumb_title @page.persisted? ? _("Edit") : _("New")
+- page_title @page.persisted? ? _("Edit") : _("New"), @page.human_title, _("Wiki")
+
+= wiki_page_errors(@error)
+
+.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
+ %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
+ = icon('angle-double-left')
+
+ .nav-text
+ %h2.wiki-page-title
+ - if @page.persisted?
+ = link_to @page.human_title, project_wiki_path(@project, @page)
+ %span.light
+ &middot;
+ = s_("Wiki|Edit Page")
+ - else
+ = s_("Wiki|Create New Page")
+
+ .nav-controls.pb-md-3.pb-lg-0
+ - if @page.persisted?
+ = link_to project_wiki_history_path(@project, @page), class: "btn" do
+ = s_("Wiki|Page history")
+ - if can?(current_user, :admin_wiki, @project)
+ #delete-wiki-modal-wrapper{ data: { delete_wiki_url: project_wiki_path(@project, @page), page_title: @page.human_title } }
+
+= render 'form', uploads_path: wiki_attachment_upload_url
+
+= render 'sidebar'
diff --git a/app/views/projects/wikis/empty.html.haml b/app/views/projects/wikis/empty.html.haml
new file mode 100644
index 00000000000..62fa6e1907b
--- /dev/null
+++ b/app/views/projects/wikis/empty.html.haml
@@ -0,0 +1,4 @@
+- page_title _("Wiki")
+- @right_sidebar = false
+
+= render 'shared/empty_states/wikis'
diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml
new file mode 100644
index 00000000000..d3a55c53649
--- /dev/null
+++ b/app/views/projects/wikis/history.html.haml
@@ -0,0 +1,42 @@
+- page_title _("History"), @page.human_title, _("Wiki")
+
+.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
+ %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
+ = icon('angle-double-left')
+
+ .nav-text
+ %h2.wiki-page-title
+ = link_to @page.human_title, project_wiki_path(@project, @page)
+ %span.light
+ &middot;
+ = _("History")
+
+.table-holder
+ %table.table
+ %thead
+ %tr
+ %th= s_("Wiki|Page version")
+ %th= _("Author")
+ %th= _("Commit Message")
+ %th= _("Last updated")
+ %th= _("Format")
+ %tbody
+ - @page_versions.each_with_index do |version, index|
+ - commit = version
+ %tr
+ %td
+ = link_to project_wiki_path_with_version(@project, @page,
+ commit.id, index == 0) do
+ = truncate_sha(commit.id)
+ %td
+ = commit.author_name
+ %td
+ = commit.message
+ %td
+ #{time_ago_with_tooltip(version.authored_date)}
+ %td
+ %strong
+ = version.format
+= paginate @page_versions, theme: 'gitlab'
+
+= render 'sidebar'
diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml
new file mode 100644
index 00000000000..d9dcd8f9acd
--- /dev/null
+++ b/app/views/projects/wikis/pages.html.haml
@@ -0,0 +1,32 @@
+- add_to_breadcrumbs "Wiki", project_wiki_path(@project, :home)
+- breadcrumb_title s_("Wiki|Pages")
+- page_title s_("Wiki|Pages"), _("Wiki")
+- sort_title = wiki_sort_title(params[:sort])
+
+.wiki-page-header.top-area.flex-column.flex-lg-row
+
+ .nav-text.flex-fill
+ %h2.wiki-page-title
+ = s_("Wiki|Wiki Pages")
+
+ .nav-controls.pb-md-3.pb-lg-0
+ = link_to project_wikis_git_access_path(@project), class: 'btn' do
+ = icon('cloud-download')
+ = _("Clone repository")
+
+ .dropdown.inline.wiki-sort-dropdown
+ .btn-group{ role: 'group' }
+ .btn-group{ role: 'group' }
+ %button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' }
+ = sort_title
+ = icon('chevron-down')
+ %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
+ %li
+ = sortable_item(s_("Wiki|Title"), project_wikis_pages_path(@project, sort: ProjectWiki::TITLE_ORDER), sort_title)
+ = sortable_item(s_("Wiki|Created date"), project_wikis_pages_path(@project, sort: ProjectWiki::CREATED_AT_ORDER), sort_title)
+ = wiki_sort_controls(@project, params[:sort], params[:direction])
+
+%ul.wiki-pages-list.content-list
+ = render @wiki_entries, context: 'pages'
+
+= paginate @wiki_pages, theme: 'gitlab'
diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml
index 9c732a933cf..ebd99cf8605 100644
--- a/app/views/projects/wikis/show.html.haml
+++ b/app/views/projects/wikis/show.html.haml
@@ -1,5 +1,32 @@
-- add_to_breadcrumbs "Wiki", project_wiki_path(@project, :home)
-- breadcrumb_title s_("Wiki|Pages")
-- page_title s_("Wiki|Contents"), _("Wiki")
+- @content_class = "limit-container-width" unless fluid_layout
+- breadcrumb_title @page.human_title
+- wiki_breadcrumb_dropdown_links(@page.slug)
+- page_title @page.human_title, _("Wiki")
+- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, :home)
-= render 'page_listing', { allow_change_nesting: ::Feature.enabled?(:wikis_allow_change_nesting), wiki_page_title: page_title, page_path: ->(opts) { project_wikis_pages_path(@project, opts) } }
+.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
+ %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
+ = icon('angle-double-left')
+
+ .nav-text.flex-fill
+ %h2.wiki-page-title= @page.human_title
+ %span.wiki-last-edit-by
+ - if @page.last_version
+ = (_("Last edited by %{name}") % { name: "<strong>#{@page.last_version.author_name}</strong>" }).html_safe
+ #{time_ago_with_tooltip(@page.last_version.authored_date)}
+
+ .nav-controls.pb-md-3.pb-lg-0
+ = render 'main_links'
+
+- if @page.historical?
+ .warning_message
+ = s_("WikiHistoricalPage|This is an old version of this page.")
+ - most_recent_link = link_to s_("WikiHistoricalPage|most recent version"), project_wiki_path(@project, @page)
+ - history_link = link_to s_("WikiHistoricalPage|history"), project_wiki_history_path(@project, @page)
+ = (s_("WikiHistoricalPage|You can view the %{most_recent_link} or browse the %{history_link}.") % { most_recent_link: most_recent_link, history_link: history_link }).html_safe
+
+.prepend-top-default.append-bottom-default
+ .md.md-file{ data: { qa_selector: 'wiki_page_content' } }
+ = render_wiki_content(@page)
+
+= render 'sidebar'