%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2021 the OpenProject GmbH
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See docs/COPYRIGHT.rdoc for more details.
++#%>
<%= call_hook :wiki_navigation %>
<% if @content.version != @page.content.version %>
<% title = link_to(h(@page.title), {action: 'show', id: @page, project_id: @page.project}).html_safe %>
<% else %>
<% title = h(@page.title) %>
<% end %>
<%# Set meta tags %>
<% title "#{t(:project_module_wiki)} | #{title}" %>
<% @formatted_text = format_text (@content || @page.content), :text, attachments: @page.attachments %>
<% description strip_tags(@formatted_text) %>
<%= toolbar title: title, html: {class: '-with-dropdown'} do %>
<% if @editable %>
<% if User.current.allowed_to? :edit_wiki_pages, @project %>
<% if @page %>
<%= link_to({controller: '/wiki', action: 'new_child', project_id: @project.identifier, id: @page},
{ class: 'button -alt-highlight',
aria: {label: t('wiki.index.no_results_content_text')},
title: t('wiki.index.no_results_content_text')}) do %>
<%= op_icon('button--icon icon-add') %>
<%= t(:create_new_page) %>
<% end %>
<% end %>
<% end %>
<% if @content.version == @page.content.version %>
<%= link_to_if_authorized({ action: 'edit', id: @page },
{ aria: { label: t(:button_edit) },
title: t(:button_edit),
class: 'button' }) do %>
<%= op_icon('button--icon icon-edit') %>
<%= t(:button_edit) %>
<% end %>
<% end %>
<% if Setting.notified_events.include?("wiki_content_added") or Setting.notified_events.include?("wiki_content_updated") %>
<%= watcher_link(@page, User.current) %>
<% end %>
<% if @content.version != @page.content.version %>
<%= link_to(t(:label_history), {action: 'history', id: @page}, class: 'button icon-wiki') %>
<% end %>
<% end %>
<%= op_icon('button--icon icon-show-more hidden-for-desktop') %>
<%= t(:label_more) %>
<%= op_icon('button--dropdown-indicator') %>
<% end %>
<% breadcrumb_paths(*(@page.ancestors.reverse.collect { |parent| link_to h(parent.breadcrumb_title), {id: parent, project_id: parent.project}} + [h(@page.breadcrumb_title)])) %>
<% if params[:version] %>
<%= link_to(t(:label_previous), { action: 'show', id: @page, project_id: @page.project, version: (@content.version - 1) }, class: 'button navigate-left') if @content.version > 1 %>
<%= "#{Version.model_name.human} #{@content.version}/#{@page.content.version}" %> —
<%= @content.author ? link_to_user(@content.author) : t(:label_user_anonymous) %> — <%= format_time(@content.updated_at) %>
<%= link_to(t(:label_next), { action: 'show', id: @page, project_id: @page.project, version: (@content.version + 1) }, class: 'button navigate-right') if @content.version < @page.content.version %>
<% end %>
<%= render(partial: "wiki/content", locals: {content: @content}) %>
<% resource = ::API::V3::WikiPages::WikiPageRepresenter.new(@page, current_user: current_user, embed_links: true) %>
<%= list_attachments(resource) %>
<% html_title h(@page.title) %>