OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/views/wiki/show.html.erb

79 lines
5.3 KiB

<%= call_hook :wiki_navigation %>
<% content_for :action_menu_main do %>
<% if @editable %>
<%= li_unless_nil(link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit))) if @content.version == @page.content.version %>
<%= li_unless_nil(watcher_link(@page, User.current)) if Setting.notified_events.include?("wiki_content_added") or Setting.notified_events.include?("wiki_content_updated") %>
<% end %>
<% end %>
<% content_for :action_menu_more do %>
<% if @editable %>
<%= li_unless_nil(link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock')) if !@page.protected? %>
<%= li_unless_nil(link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock')) if @page.protected? %>
<% if User.current.allowed_to? :edit_wiki_pages, @project %>
<% if @page %>
<%= content_tag(:li, link_to(l(:create_child_page), wiki_new_child_path(:id => @page.title, :project_id => @project), :class => 'icon icon-duplicate')) %>
<% end %>
<% end %>
<%= li_unless_nil(link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-rename')) if @content.version == @page.content.version %>
<%= li_unless_nil(link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del')) %>
<%= li_unless_nil(link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel')) if @content.version < @page.content.version %>
<% end %>
<%= li_unless_nil(link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history')) %>
<%= li_unless_nil(link_to_if_authorized(l(:button_wiki_menu_entry), {:controller => '/wiki_menu_items', :action => 'edit', :project_id => @project.identifier, :id => @page.title}, :class => 'icon icon-configure')) %>
<% end %>
<% breadcrumb_paths(*(@page.ancestors.reverse.collect {|parent| link_to h(parent.breadcrumb_title), {:id => parent.title, :project_id => parent.project}} + [h(@page.breadcrumb_title)])) %>
<% if @content.version != @page.content.version %>
<p>
<%= link_to(l(:label_previous), { :action => 'show', :id => @page.title, :project_id => @page.project, :version => (@content.version - 1) }, :class => 'navigate-left') + " - " if @content.version > 1 %>
<%= "#{Version.model_name.human} #{@content.version}/#{@page.content.version}" %>
<%= '(' + link_to(l(:label_diff), :controller => '/wiki', :action => 'diff', :id => @page.title, :project_id => @page.project, :version => @content.version) + ')' if @content.version > 1 %> -
<%= link_to(l(:label_next), :action => 'show', :id => @page.title, :project_id => @page.project, :version => (@content.version + 1), :class => 'navigate-right') + " - " if @content.version < @page.content.version %>
<%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %>
<br />
<em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous) %>, <%= format_time(@content.updated_on) %> </em><br />
<%=h @content.comments %>
</p>
<hr />
<% end %>
<%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
<%= link_to_attachments @page %>
<% if @editable && authorize_for('wiki', 'add_attachment') %>
<div id="wiki_add_attachment">
<p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;",
:id => 'attach_files_link' %></p>
<%= form_tag({ :controller => '/wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %>
<div class="box">
<p><%= render :partial => 'attachments/form' %></p>
</div>
<%= submit_tag l(:button_add) %>
<%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %>
<% end %>
</div>
<% end %>
<%= other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => { :controller => '/activities',
:action => 'index',
:show_wiki_edits => 1,
:key => User.current.rss_key } %>
<%= f.link_to 'HTML', :url => { :version => @content.version } %>
<%= f.link_to 'TXT', :url => { :version => @content.version } %>
<%= call_hook(:view_wiki_show_other_formats, {:link_builder => f, :url_params => {:id => @page.title, :version => @content.version}}) %>
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, :controller => '/activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
<% end %>
<% content_for :sidebar do %>
<%= render :partial => 'wiki/sidebar' %>
<% end %>
<% html_title h(@page.pretty_title) %>