A wiki page can now be attached to each version.

For that, edit the version and set the wiki page name (project wiki must be enabled).
The wiki page content is displayed for each version on the roadmap view.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@564 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-06-14 18:26:27 +00:00
parent ff1343882a
commit f2acb56041
19 changed files with 49 additions and 11 deletions

View File

@ -141,6 +141,7 @@ private
def find_wiki
@project = Project.find(params[:id])
@wiki = @project.wiki
render_404 unless @wiki
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@ -37,6 +37,13 @@ class Version < ActiveRecord::Base
effective_date && effective_date <= Date.today
end
def wiki_page
if project.wiki && !wiki_page_title.blank?
@wiki_page ||= project.wiki.find_page(wiki_page_title)
end
@wiki_page
end
# Versions are sorted by effective_date
# Those with no effective_date are at the end, sorted by name
def <=>(version)

View File

@ -21,7 +21,7 @@
<% elsif version.effective_date %>
<p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p>
<% end %>
<p><%=h version.description %></p>
<p><%=h version.description %></p>
<% issues = version.fixed_issues.find(:all,
:include => [:status, :tracker],
:conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"],
@ -44,7 +44,8 @@
<em><%= link_to(complete, :controller => 'projects', :action => 'list_issues', :id => @project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_closed_issues, complete) %> (<%= percentComplete %>%) &#160;
<%= link_to((total - complete), :controller => 'projects', :action => 'list_issues', :id => @project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_open_issues, total - complete)%> (<%= percentIncomplete %>%)</em>
<br />
<br />
<br />
<%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
<ul>
<% if total == 0 %>
<li><%=l(:label_roadmap_no_issues)%></li>

View File

@ -25,13 +25,21 @@
<div id="tab-content-versions" class="tab-content" style="display:none;">
<table class="list">
<thead><th><%= l(:label_version) %></th><th><%= l(:field_effective_date) %></th><th><%= l(:field_description) %></th><th style="width:15%"></th><th style="width:15%"></th></thead>
<thead>
<th><%= l(:label_version) %></th>
<th><%= l(:field_effective_date) %></th>
<th><%= l(:field_description) %></th>
<th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th>
<th style="width:15%"></th>
<th style="width:15%"></th>
</thead>
<tbody>
<% for version in @project.versions.sort %>
<tr class="<%= cycle 'odd', 'even' %>">
<td><%=h version.name %></td>
<td align="center"><%= format_date(version.effective_date) %></td>
<td><%=h version.description %></td>
<td><%= link_to(version.wiki_page_title, :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td>
<td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td>
<td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td>
</td>

View File

@ -1,11 +1,10 @@
<%= error_messages_for 'version' %>
<div class="box">
<!--[form:version]-->
<p><%= f.text_field :name, :size => 20, :required => true %></p>
<p><%= f.text_field :description, :size => 60 %></p>
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
<!--[eoform:version]-->
</div>
<% content_for :header_tags do %>
@ -13,4 +12,4 @@
<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
<%= javascript_include_tag 'calendar/calendar-setup' %>
<%= stylesheet_link_tag 'calendar' %>
<% end %>
<% end %>

View File

@ -0,0 +1,5 @@
<div class="wiki">
<% cache "wiki/show/#{content.page.id}/#{content.version}" do %>
<%= textilizable content.text, :attachments => content.page.attachments %>
<% end %>
</div>

View File

@ -19,11 +19,7 @@
<hr />
<% end %>
<div class="wiki">
<% cache "wiki/show/#{@page.id}/#{@content.version}" do %>
<%= textilizable @content.text, :attachments => @page.attachments %>
<% end %>
</div>
<%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
<%= link_to_attachments @page.attachments, :delete_url => (authorize_for('wiki', 'destroy_attachment') ? {:controller => 'wiki', :action => 'destroy_attachment', :page => @page.title} : nil) %>

View File

@ -0,0 +1,9 @@
class AddVersionsWikiPageTitle < ActiveRecord::Migration
def self.up
add_column :versions, :wiki_page_title, :string
end
def self.down
remove_column :versions, :wiki_page_title
end
end

View File

@ -346,6 +346,7 @@ label_all_words: Всички думи
label_wiki: Wiki
label_wiki_edit: Wiki редакция
label_wiki_edit_plural: Wiki редакции
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Индекс
label_current_version: Текуща версия

View File

@ -346,6 +346,7 @@ label_all_words: Alle Wörter
label_wiki: Wiki
label_wiki_edit: Wiki Bearbeitung
label_wiki_edit_plural: Wiki Bearbeitungen
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Index
label_current_version: Gegenwärtige Version

View File

@ -346,6 +346,7 @@ label_all_words: All words
label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Index
label_current_version: Current version

View File

@ -346,6 +346,7 @@ label_all_words: Todas las palabras
label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Índice
label_current_version: Versión actual

View File

@ -346,6 +346,7 @@ label_all_words: Tous les mots
label_wiki: Wiki
label_wiki_edit: Révision wiki
label_wiki_edit_plural: Révisions wiki
label_wiki_page: Page wiki
label_wiki_page_plural: Pages wiki
label_page_index: Index
label_current_version: Version actuelle

View File

@ -346,6 +346,7 @@ label_all_words: Tutte le parole
label_wiki: Wiki
label_wiki_edit: Modifica Wiki
label_wiki_edit_plural: Modfiche wiki
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Indice
label_current_version: Versione corrente

View File

@ -347,6 +347,7 @@ label_all_words: すべての単語
label_wiki: Wiki
label_wiki_edit: Wiki編集
label_wiki_edit_plural: Wiki編集
label_wiki_page: Wiki page
label_wiki_page_plural: Wikiページ
label_page_index: 索引
label_current_version: 最新版

View File

@ -346,6 +346,7 @@ label_all_words: Alle woorden
label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Index
label_current_version: Huidige versie

View File

@ -346,6 +346,7 @@ label_all_words: Todas as palavras
label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Index
label_current_version: Versao atual

View File

@ -346,6 +346,7 @@ label_all_words: Todas as palavras
label_wiki: Wiki
label_wiki_edit: Wiki edit
label_wiki_edit_plural: Wiki edits
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Index
label_current_version: Versão atual

View File

@ -346,6 +346,8 @@ label_all_words: Alla ord
label_wiki: Wiki
label_wiki_edit: Wiki editera
label_wiki_edit_plural: Wiki editeringar
label_wiki_page: Wiki page
label_wiki_page_plural: Wiki pages
label_page_index: Index
label_current_version: Nuvarande version
label_preview: Preview