summaryrefslogtreecommitdiffstats
path: root/app/views/wiki/show.html.erb
blob: 8acb0abdcb5a0098c5b163e177fb7ac28a7c1fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<div class="contextual">

<% if @editable %>
<% if @content.current_version? %>
  <%= link_to_if_authorized(icon_with_label('edit', l(:button_edit)), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
  <%= watcher_link(@page, User.current) %>
<% end %>
<% end %>

  <%= actions_dropdown do %>
    <%= link_to_if_authorized(icon_with_label('history', l(:label_history)), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>

    <% if @editable %>
    <% if @content.current_version? %>
      <%= link_to_if_authorized(icon_with_label('lock', l(:button_lock)), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
      <%= link_to_if_authorized(icon_with_label('unlock', l(:button_unlock)), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
      <%= link_to_if_authorized(icon_with_label('move', l(:button_rename)), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %>
      <%= link_to_if_authorized(icon_with_label('del', l(:button_delete)), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %>
    <% else %>
      <%= link_to_if_authorized(icon_with_label('cancel', l(:button_rollback)), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') %>
    <% end %>
    <% end %>

    <% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
      <%= link_to icon_with_label('add', l(:label_wiki_page_new)), new_project_wiki_page_path(@project, :parent => @page.title), :remote => true, :class => 'icon icon-add' %>
    <% end %>
  <% end %>
</div>

<%= wiki_page_breadcrumb(@page) %>

<% unless @content.current_version? %>
  <%= title [@page.pretty_title, project_wiki_page_path(@page.project, @page.title, :version => nil)],
        [l(:label_history), history_project_wiki_page_path(@page.project, @page.title)],
        "#{l(:label_revision)} #{@content.version}" %>

    <p>
    <% if @content.previous %>
      <%= link_to ("\xc2\xab " + l(:label_previous)),
                :action => 'show', :id => @page.title, :project_id => @page.project,
                :version => @content.previous.version %> |
    <% end %>
    <%= "#{l(:label_revision)} #{@content.version}/#{@page.content.version}" %>
    <% if @content.previous %>
      (<%= link_to l(:label_diff), :controller => 'wiki', :action => 'diff',
                      :id => @page.title, :project_id => @page.project,
                      :version => @content.version %>)
    <% end %>
    <% if @content.next %>
      | <%= link_to (l(:label_next) + " \xc2\xbb"), :action => 'show',
                :id => @page.title, :project_id => @page.project,
                :version => @content.next.version %>
    <% end %>
    <br />
    <em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous)
         %>, <%= format_time(@content.updated_on) %> </em><br />
    <%= @content.comments %>
    </p>
    <hr />
<% end %>

<%= render(:partial => "wiki/content", :locals => {:content => @content}) %>

<fieldset class="collapsible collapsed hide-when-print">
  <legend onclick="toggleFieldset(this);" class="icon icon-collapsed"><%= l(:label_attachment_plural) %> (<%= @page.attachments.length %>)</legend>
  <div style="display: none;">

  <%= link_to_attachments @page, :thumbnails => true %>

  <% if @editable && authorize_for('wiki', 'add_attachment') %>
  <div id="wiki_add_attachment">
    <%= form_tag({:controller => 'wiki', :action => 'add_attachment',
                  :project_id => @project, :id => @page.title},
                 :multipart => true, :id => "add_attachment_form") do %>
      <div class="box">
      <p><%= render :partial => 'attachments/form' %></p>
      </div>
      <%= submit_tag l(:button_add) %>
    <% end %>
  </div>
  <% end %>
</div>
</fieldset>

<p class="wiki-update-info">
  <% if User.current.allowed_to?(:view_wiki_edits, @project) %>
    <%= wiki_content_update_info(@content) %>
    · <%= link_to l(:label_x_revisions, :count => @page.content.versions.size), {:action => 'history', :id => @page.title} %>
  <% end %>
  <% if @page.protected? %>
    <span class="badge badge-status-locked"><%= l('status_locked') %></span>
  <% end %>
</p>

<% other_formats_links do |f| %>
  <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %>
  <%= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %>
  <%= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %>
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>

<% content_for :sidebar do %>
  <%= render :partial => 'sidebar' %>
  <% if User.current.allowed_to?(:add_wiki_page_watchers, @project) ||
    (@page.watchers.present? && User.current.allowed_to?(:view_wiki_page_watchers, @project)) %>
    <div id="watchers">
      <%= render :partial => 'watchers/watchers', :locals => {:watched => @page} %>
    </div>
  <% end %>
<% end %>

<% content_for :header_tags do %>
  <%= robot_exclusion_tag unless @content.current_version? %>
<% end %>

<% html_title @page.pretty_title %>