Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

update page header in documents pages

Behrokh Satarnejadb36ac71a2442
diff --git a/modules/documents/app/views/documents/edit.html.erb b/modules/documents/app/views/documents/edit.html.erb
index 951b6921c28..26239cce97d 100644
--- a/modules/documents/app/views/documents/edit.html.erb
+++ b/modules/documents/app/views/documents/edit.html.erb
@@ -27,7 +27,13 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= toolbar title: Document.model_name.human %>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { @document.title }
+ header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name },
+ { href: project_documents_path(@project), text: t(:label_document_plural) },
+ "#{ @document.title }: <b>#{t(:label_edit)}</b>".html_safe], selected_item_font_weight: :normal)
+ end %>
<%= labelled_tabular_form_for @document, url: document_path(@document), method: 'PATCH' do |f| -%>
<%= render partial: "documents/form", locals: { f: f } %>
diff --git a/modules/documents/app/views/documents/show.html.erb b/modules/documents/app/views/documents/show.html.erb
index 4fa3c74d7d9..35abd864ab3 100644
--- a/modules/documents/app/views/documents/show.html.erb
+++ b/modules/documents/app/views/documents/show.html.erb
@@ -27,26 +27,46 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title h(@document.title) -%>
-<%= toolbar title: @document.title,
- subtitle: "#{@document.category.name} - #{format_date @document.created_at}" do %>
- <% if authorize_for(:documents, :edit) %>
- <li class="toolbar-item">
- <%= link_to({controller: '/documents', action: 'edit', id: @document}, class: 'button', accesskey: accesskey(:edit)) do %>
- <%= op_icon('button--icon icon-edit') %>
- <span class="button--text"><%= t(:button_edit) %></span>
- <% end %>
- </li>
- <% end %>
- <% if authorize_for(:documents, :destroy) %>
- <li class="toolbar-item">
- <%= link_to({controller: '/documents', action: 'destroy', id: @document}, class: 'button', data: { confirm: t(:text_are_you_sure) }, method: :delete) do %>
- <%= op_icon('button--icon icon-delete') %>
- <span class="button--text"><%= t(:button_delete) %></span>
- <% end %>
- </li>
- <% end %>
-<% end %>
+<%=
+ render Primer::OpenProject::PageHeader.new do |header|
+ header.with_title { @document.title }
+ header.with_description { "#{@document.category.name} - #{format_date @document.created_at}" }
+ header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name },
+ { href: project_documents_path(@project), text: t(:label_document_plural) },
+ @document.title
+ ])
+
+ if authorize_for(:documents, :edit)
+ header.with_action_button(tag: :a,
+ scheme: :default,
+ mobile_icon: :pencil,
+ mobile_label: t(:button_edit),
+ size: :medium,
+ href: url_for({controller: '/documents', action: 'edit', id: @document}),
+ aria: { label: t(:button_edit) },
+ title: t(:button_edit)) do |button|
+ button.with_leading_visual_icon(icon: :pencil)
+ t(:button_edit)
+ end
+ end
+ if authorize_for(:documents, :destroy)
+ header.with_action_button(tag: :a,
+ scheme: :danger,
+ mobile_icon: :trash,
+ mobile_label: t(:button_delete),
+ size: :medium,
+ href: url_for({controller: '/documents', action: 'destroy', id: @document}),
+ aria: { label: I18n.t(:button_delete) },
+ data: {
+ confirm: I18n.t(:text_are_you_sure),
+ method: :delete
+ },
+ title: I18n.t(:button_delete)) do |button|
+ button.with_leading_visual_icon(icon: :trash)
+ t(:button_delete)
+ end
+ end
+ end %>
<div class="wiki op-uc-container">
<%= format_text @document.description, attachments: @document.attachments %>