@@ -1,35 +1,41 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | module WikiHelper |
|
19 | 19 | |
|
20 | 20 | def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) |
|
21 | 21 | pages = pages.group_by(&:parent) unless pages.is_a?(Hash) |
|
22 | 22 | s = '' |
|
23 | 23 | if pages.has_key?(parent) |
|
24 | 24 | pages[parent].each do |page| |
|
25 | 25 | attrs = "value='#{page.id}'" |
|
26 | 26 | attrs << " selected='selected'" if selected == page |
|
27 | 27 | indent = (level > 0) ? (' ' * level * 2 + '» ') : nil |
|
28 | 28 | |
|
29 | 29 | s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" + |
|
30 | 30 | wiki_page_options_for_select(pages, selected, page, level + 1) |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | s |
|
34 | 34 | end |
|
35 | ||
|
36 | def wiki_page_breadcrumb(page) | |
|
37 | breadcrumb(page.ancestors.reverse.collect {|parent| | |
|
38 | link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project}) | |
|
39 | }) | |
|
40 | end | |
|
35 | 41 | end |
@@ -1,32 +1,34 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <%= link_to(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit') %> |
|
3 | 3 | <%= link_to(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %> |
|
4 | 4 | </div> |
|
5 | 5 | |
|
6 | <h2><%= @page.pretty_title %></h2> | |
|
6 | <%= wiki_page_breadcrumb(@page) %> | |
|
7 | ||
|
8 | <h2><%=h @page.pretty_title %></h2> | |
|
7 | 9 | |
|
8 | 10 | <p> |
|
9 | 11 | <%= l(:label_version) %> <%= link_to @annotate.content.version, :action => 'show', :id => @page.title, :version => @annotate.content.version %> |
|
10 | 12 | <em>(<%= @annotate.content.author ? @annotate.content.author.name : "anonyme" %>, <%= format_time(@annotate.content.updated_on) %>)</em> |
|
11 | 13 | </p> |
|
12 | 14 | |
|
13 | 15 | <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %> |
|
14 | 16 | |
|
15 | 17 | <table class="filecontent annotate"> |
|
16 | 18 | <tbody> |
|
17 | 19 | <% line_num = 1 %> |
|
18 | 20 | <% @annotate.lines.each do |line| -%> |
|
19 | 21 | <tr class="bloc-<%= colors[line[0]] %>"> |
|
20 | 22 | <th class="line-num"><%= line_num %></th> |
|
21 | 23 | <td class="revision"><%= link_to line[0], :controller => 'wiki', :action => 'show', :project_id => @project, :id => @page.title, :version => line[0] %></td> |
|
22 | 24 | <td class="author"><%= h(line[1]) %></td> |
|
23 | 25 | <td class="line-code"><pre><%=h line[2] %></pre></td> |
|
24 | 26 | </tr> |
|
25 | 27 | <% line_num += 1 %> |
|
26 | 28 | <% end -%> |
|
27 | 29 | </tbody> |
|
28 | 30 | </table> |
|
29 | 31 | |
|
30 | 32 | <% content_for :header_tags do %> |
|
31 | 33 | <%= stylesheet_link_tag 'scm' %> |
|
32 | 34 | <% end %> |
@@ -1,19 +1,21 | |||
|
1 | <%= wiki_page_breadcrumb(@page) %> | |
|
2 | ||
|
1 | 3 | <h2><%=h @page.pretty_title %></h2> |
|
2 | 4 | |
|
3 | 5 | <% form_tag({}, :method => :delete) do %> |
|
4 | 6 | <div class="box"> |
|
5 | 7 | <p><strong><%= l(:text_wiki_page_destroy_question, :descendants => @descendants_count) %></strong></p> |
|
6 | 8 | <p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_wiki_page_nullify_children) %></label><br /> |
|
7 | 9 | <label><%= radio_button_tag 'todo', 'destroy', false %> <%= l(:text_wiki_page_destroy_children) %></label> |
|
8 | 10 | <% if @reassignable_to.any? %> |
|
9 | 11 | <br /> |
|
10 | 12 | <label><%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_wiki_page_reassign_children) %></label>: |
|
11 | 13 | <%= select_tag 'reassign_to_id', wiki_page_options_for_select(@reassignable_to), |
|
12 | 14 | :onclick => "$('todo_reassign').checked = true;" %> |
|
13 | 15 | <% end %> |
|
14 | 16 | </p> |
|
15 | 17 | </div> |
|
16 | 18 | |
|
17 | 19 | <%= submit_tag l(:button_apply) %> |
|
18 | 20 | <%= link_to l(:button_cancel), :controller => 'wiki', :action => 'show', :project_id => @project, :id => @page.title %> |
|
19 | 21 | <% end %> |
@@ -1,17 +1,19 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <%= link_to(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %> |
|
3 | 3 | </div> |
|
4 | 4 | |
|
5 | <h2><%= @page.pretty_title %></h2> | |
|
5 | <%= wiki_page_breadcrumb(@page) %> | |
|
6 | ||
|
7 | <h2><%=h @page.pretty_title %></h2> | |
|
6 | 8 | |
|
7 | 9 | <p> |
|
8 | 10 | <%= l(:label_version) %> <%= link_to @diff.content_from.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_from.version %> |
|
9 | 11 | <em>(<%= @diff.content_from.author ? @diff.content_from.author.name : "anonyme" %>, <%= format_time(@diff.content_from.updated_on) %>)</em> |
|
10 | 12 | → |
|
11 | 13 | <%= l(:label_version) %> <%= link_to @diff.content_to.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_to.version %>/<%= @page.content.version %> |
|
12 | 14 | <em>(<%= @diff.content_to.author ? @diff.content_to.author.name : "anonyme" %>, <%= format_time(@diff.content_to.updated_on) %>)</em> |
|
13 | 15 | </p> |
|
14 | 16 | |
|
15 | 17 | <div class="text-diff"> |
|
16 | 18 | <%= simple_format_without_paragraph @diff.to_html %> |
|
17 | 19 | </div> |
@@ -1,29 +1,31 | |||
|
1 | <%= wiki_page_breadcrumb(@page) %> | |
|
2 | ||
|
1 | 3 | <h2><%=h @page.pretty_title %></h2> |
|
2 | 4 | |
|
3 | 5 | <% form_for :content, @content, :url => {:action => 'update', :id => @page.title}, :html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| %> |
|
4 | 6 | <%= f.hidden_field :version %> |
|
5 | 7 | <%= error_messages_for 'content' %> |
|
6 | 8 | |
|
7 | 9 | <p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %></p> |
|
8 | 10 | <p><label><%= l(:field_comments) %></label><br /><%= f.text_field :comments, :size => 120 %></p> |
|
9 | 11 | <p><label><%=l(:label_attachment_plural)%></label><br /><%= render :partial => 'attachments/form' %></p> |
|
10 | 12 | |
|
11 | 13 | <p><%= submit_tag l(:button_save) %> |
|
12 | 14 | <%= link_to_remote l(:label_preview), |
|
13 | 15 | { :url => { :controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, |
|
14 | 16 | :method => :post, |
|
15 | 17 | :update => 'preview', |
|
16 | 18 | :with => "Form.serialize('wiki_form')", |
|
17 | 19 | :complete => "Element.scrollTo('preview')" |
|
18 | 20 | }, :accesskey => accesskey(:preview) %></p> |
|
19 | 21 | <%= wikitoolbar_for 'content_text' %> |
|
20 | 22 | <% end %> |
|
21 | 23 | |
|
22 | 24 | <div id="preview" class="wiki"></div> |
|
23 | 25 | |
|
24 | 26 | <% content_for :header_tags do %> |
|
25 | 27 | <%= stylesheet_link_tag 'scm' %> |
|
26 | 28 | <%= robot_exclusion_tag %> |
|
27 | 29 | <% end %> |
|
28 | 30 | |
|
29 | 31 | <% html_title @page.pretty_title %> |
@@ -1,35 +1,37 | |||
|
1 | <h2><%= @page.pretty_title %></h2> | |
|
1 | <%= wiki_page_breadcrumb(@page) %> | |
|
2 | ||
|
3 | <h2><%=h @page.pretty_title %></h2> | |
|
2 | 4 | |
|
3 | 5 | <h3><%= l(:label_history) %></h3> |
|
4 | 6 | |
|
5 | 7 | <% form_tag({:action => "diff"}, :method => :get) do %> |
|
6 | 8 | <table class="list wiki-page-versions"> |
|
7 | 9 | <thead><tr> |
|
8 | 10 | <th>#</th> |
|
9 | 11 | <th></th> |
|
10 | 12 | <th></th> |
|
11 | 13 | <th><%= l(:field_updated_on) %></th> |
|
12 | 14 | <th><%= l(:field_author) %></th> |
|
13 | 15 | <th><%= l(:field_comments) %></th> |
|
14 | 16 | <th></th> |
|
15 | 17 | </tr></thead> |
|
16 | 18 | <tbody> |
|
17 | 19 | <% show_diff = @versions.size > 1 %> |
|
18 | 20 | <% line_num = 1 %> |
|
19 | 21 | <% @versions.each do |ver| %> |
|
20 | 22 | <tr class="wiki-page-version <%= cycle("odd", "even") %>"> |
|
21 | 23 | <td class="id"><%= link_to ver.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => ver.version %></td> |
|
22 | 24 | <td class="checkbox"><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < @versions.size) %></td> |
|
23 | 25 | <td class="checkbox"><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %></td> |
|
24 | 26 | <td class="updated_on"><%= format_time(ver.updated_on) %></td> |
|
25 | 27 | <td class="author"><%= link_to_user ver.author %></td> |
|
26 | 28 | <td class="comments"><%=h ver.comments %></td> |
|
27 | 29 | <td class="buttons"><%= link_to l(:button_annotate), :action => 'annotate', :id => @page.title, :version => ver.version %></td> |
|
28 | 30 | </tr> |
|
29 | 31 | <% line_num += 1 %> |
|
30 | 32 | <% end %> |
|
31 | 33 | </tbody> |
|
32 | 34 | </table> |
|
33 | 35 | <%= submit_tag l(:label_view_diff), :class => 'small' if show_diff %> |
|
34 | 36 | <span class="pagination"><%= pagination_links_full @version_pages, @version_count, :page_param => :p %></span> |
|
35 | 37 | <% end %> |
@@ -1,12 +1,14 | |||
|
1 | <h2><%= l(:button_rename) %>: <%= @original_title %></h2> | |
|
1 | <%= wiki_page_breadcrumb(@page) %> | |
|
2 | ||
|
3 | <h2><%=h @original_title %></h2> | |
|
2 | 4 | |
|
3 | 5 | <%= error_messages_for 'page' %> |
|
4 | 6 | |
|
5 | 7 | <% labelled_tabular_form_for :wiki_page, @page, :url => { :action => 'rename' } do |f| %> |
|
6 | 8 | <div class="box"> |
|
7 | 9 | <p><%= f.text_field :title, :required => true, :size => 100 %></p> |
|
8 | 10 | <p><%= f.check_box :redirect_existing_links %></p> |
|
9 | 11 | <p><%= f.select :parent_id, "<option value=''></option>" + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent), :label => :field_parent_title %></p> |
|
10 | 12 | </div> |
|
11 | 13 | <%= submit_tag l(:button_rename) %> |
|
12 | 14 | <% end %> |
@@ -1,61 +1,61 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <% if @editable %> |
|
3 | 3 | <%= 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 %> |
|
4 | 4 | <%= watcher_tag(@page, User.current) %> |
|
5 | 5 | <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> |
|
6 | 6 | <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> |
|
7 | 7 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> |
|
8 | 8 | <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> |
|
9 | 9 | <%= 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 %> |
|
10 | 10 | <% end %> |
|
11 | 11 | <%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %> |
|
12 | 12 | </div> |
|
13 | 13 | |
|
14 | <%= breadcrumb(@page.ancestors.reverse.collect {|parent| link_to h(parent.pretty_title), {:id => parent.title, :project_id => parent.project}}) %> | |
|
14 | <%= wiki_page_breadcrumb(@page) %> | |
|
15 | 15 | |
|
16 | 16 | <% if @content.version != @page.content.version %> |
|
17 | 17 | <p> |
|
18 | 18 | <%= link_to(('« ' + l(:label_previous)), :action => 'show', :id => @page.title, :project_id => @page.project, :version => (@content.version - 1)) + " - " if @content.version > 1 %> |
|
19 | 19 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> |
|
20 | 20 | <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :id => @page.title, :project_id => @page.project, :version => @content.version) + ')' if @content.version > 1 %> - |
|
21 | 21 | <%= link_to((l(:label_next) + ' »'), :action => 'show', :id => @page.title, :project_id => @page.project, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> |
|
22 | 22 | <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %> |
|
23 | 23 | <br /> |
|
24 | 24 | <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> |
|
25 | 25 | <%=h @content.comments %> |
|
26 | 26 | </p> |
|
27 | 27 | <hr /> |
|
28 | 28 | <% end %> |
|
29 | 29 | |
|
30 | 30 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> |
|
31 | 31 | |
|
32 | 32 | <%= link_to_attachments @page %> |
|
33 | 33 | |
|
34 | 34 | <% if @editable && authorize_for('wiki', 'add_attachment') %> |
|
35 | 35 | <div id="wiki_add_attachment"> |
|
36 | 36 | <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", |
|
37 | 37 | :id => 'attach_files_link' %></p> |
|
38 | 38 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> |
|
39 | 39 | <div class="box"> |
|
40 | 40 | <p><%= render :partial => 'attachments/form' %></p> |
|
41 | 41 | </div> |
|
42 | 42 | <%= submit_tag l(:button_add) %> |
|
43 | 43 | <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %> |
|
44 | 44 | <% end %> |
|
45 | 45 | </div> |
|
46 | 46 | <% end %> |
|
47 | 47 | |
|
48 | 48 | <% other_formats_links do |f| %> |
|
49 | 49 | <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %> |
|
50 | 50 | <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %> |
|
51 | 51 | <% end if User.current.allowed_to?(:export_wiki_pages, @project) %> |
|
52 | 52 | |
|
53 | 53 | <% content_for :header_tags do %> |
|
54 | 54 | <%= stylesheet_link_tag 'scm' %> |
|
55 | 55 | <% end %> |
|
56 | 56 | |
|
57 | 57 | <% content_for :sidebar do %> |
|
58 | 58 | <%= render :partial => 'sidebar' %> |
|
59 | 59 | <% end %> |
|
60 | 60 | |
|
61 | 61 | <% html_title @page.pretty_title %> |
General Comments 0
You need to be logged in to leave comments.
Login now