Files

66 lines
2.9 KiB
Plaintext

<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 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 COPYRIGHT and LICENSE files for more details.
++#%>
<%= render(WikiPages::ShowPageHeaderComponent.new(page: @page, project: @project, editable: @editable)) %>
<% if @show_create %>
<%= render(WikiPages::ShowSubHeaderComponent.new(page: @page, project: @project)) %>
<% end %>
<%= call_hook :wiki_navigation %>
<% if @page.current_version? %>
<% title = h(@page.title) %>
<% else %>
<% title = link_to(@page.title, { action: "show", id: @page, project_id: @page.project }) %>
<% end %>
<%# Set meta tags %>
<% title "#{t(:project_module_wiki)} | #{title}" %>
<% @formatted_text = format_text @page, :text, attachments: @page.attachments %>
<%# Prevent passing the entire formatted text to strip_tags, as that would be quite slow. Numbers used are arbitrary. %>
<% description strip_tags(@formatted_text.to_s.first(500)).truncate(160) %>
<% if params[:version] %>
<hr>
<div class="wiki-version--details">
<div>
<%= link_to(t(:label_previous), { action: "show", id: @page, project_id: @page.project, version: (@page.version - 1) }, class: "button navigate-left") if @page.version > 1 %>
<span><%= "#{Version.model_name.human} #{@page.version}/#{@page.latest_version}" %> &#x2014;</span>
<span><em><%= @page.author ? link_to_user(@page.author) : t(:label_user_anonymous) %></em> &#x2014; <%= format_time(@page.updated_at) %></span>
<%= link_to(t(:label_next), { action: "show", id: @page, project_id: @page.project, version: (@page.version + 1) }, class: "button navigate-right") unless @page.current_version? %>
</div>
<hr>
</div>
<% end %>
<%= render(partial: "wiki/text", locals: { page: @page }) %>
<% resource = ::API::V3::WikiPages::WikiPageRepresenter.new(@page, current_user: current_user, embed_links: true) %>
<%= list_attachments(resource) %>
<% html_title h(@page.title) %>