Patch #3274 » wiki_page_categories_20090520.patch
| redmine/app/controllers/wiki_controller.rb 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
@pages = @wiki.pages.find :all, :order => 'title'
|
||
|
export = render_to_string :action => 'export_multiple', :layout => false
|
||
|
send_data(export, :type => 'text/html', :filename => "wiki.html")
|
||
|
return
|
||
|
return
|
||
|
when 'category'
|
||
|
@category = params[:category].gsub(/_/, ' ')
|
||
|
@pages = @wiki.find_pages_in_category(@category)
|
||
|
when 'category_index'
|
||
|
@categories = @wiki.find_all_categories
|
||
|
else
|
||
|
# requested special page doesn't exist, redirect to default page
|
||
|
redirect_to :action => 'index', :id => @project, :page => nil and return
|
||
| redmine/app/helpers/application_helper.rb 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
|
||
|
# Wiki category links
|
||
|
#
|
||
|
# Examples:
|
||
|
# [[category:mycategory]]
|
||
|
# [[category:mycategory|mytext]]
|
||
|
# wiki links can refer other project wikis, using project name or identifier:
|
||
|
# [[myproject:category:mycategory]]
|
||
|
# [[myproject:category:mycategory|mytext]]
|
||
|
text = text.gsub(/(!)?(\[\[(?:(.+?):)?category:(.+?)(?:\|(.+?))?\]\])/) do |m|
|
||
|
esc, all, link_project, category, title = $1, $2, $3, $4, $5
|
||
|
if esc.nil?
|
||
|
if link_project.nil?
|
||
|
link_project = project
|
||
|
else
|
||
|
link_project = Project.find_by_name(link_project) || Project.find_by_identifier(link_project)
|
||
|
end
|
||
|
if link_project && link_project.wiki
|
||
|
link_to((title || category), :only_path => only_path, :controller => 'wiki', :id => project, :action => 'special', :page => 'category', :category => Wiki.titleize(category))
|
||
|
else
|
||
|
all
|
||
|
end
|
||
|
else
|
||
|
'!' + all
|
||
|
end
|
||
|
end
|
||
|
# Wiki links
|
||
|
#
|
||
|
# Examples:
|
||
| redmine/app/models/wiki.rb 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
end
|
||
|
page
|
||
|
end
|
||
|
|
||
|
# Find pages which belong to a certain category.
|
||
|
# Special category 'None' contains all pages with no particular category set.
|
||
|
def find_pages_in_category(category)
|
||
|
if category == 'None'
|
||
|
pages.find :all, :conditions => "categories = '' OR categories IS NULL", :order=> 'title'
|
||
|
else
|
||
|
pages.find :all, :conditions => [ "LOWER(categories) LIKE LOWER(?)", "%|#{category.downcase}|%"], :order=> 'title'
|
||
|
end
|
||
|
end
|
||
|
# Traverse all pages and compile a list of categories.
|
||
|
def find_all_categories
|
||
|
categories = {}
|
||
|
groups = pages.find :all, :select => :categories, :conditions => "categories != ''", :group => :categories
|
||
|
groups.map {|c| c.categories[1..-2].split('|') }.flatten.sort.each do |g|
|
||
|
categories[g.downcase] = g # case insensitive uniq
|
||
|
end
|
||
|
categories.values
|
||
|
end
|
||
|
# Finds a page by title
|
||
|
# The given string can be of one of the forms: "title" or "project:title"
|
||
|
# Examples:
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
# Upcase only the first letter of a title
|
||
|
def self.upcase_first(title='')
|
||
|
title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title
|
||
|
end
|
||
|
# turn a string into a valid page title
|
||
|
def self.titleize(title)
|
||
|
# replace spaces with _ and remove unwanted caracters
|
||
|
title = title.gsub(/\s+/, '_').delete(',./?;|:') if title
|
||
|
# upcase the first letter
|
||
|
title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title
|
||
|
title = self.upcase_first(title)
|
||
|
title
|
||
|
end
|
||
|
end
|
||
| redmine/app/models/wiki_content.rb 2009-05-20 08:48:03 +0200 | ||
|---|---|---|
|
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||
|
validates_presence_of :text
|
||
|
validates_length_of :comments, :maximum => 255, :allow_nil => true
|
||
|
|
||
|
def after_save
|
||
|
page.categories = categories.join('|')
|
||
|
page.categories = '|' + page.categories + '|' if !categories.empty?
|
||
|
page.save!
|
||
|
end
|
||
|
def categories
|
||
|
if text.match(/\{\{categor(?:y|ies)\((.+?)\)\}\}/)
|
||
|
$1.split(/\s*,\s*/).map { |c| Wiki.upcase_first(c) }
|
||
|
else
|
||
|
[]
|
||
|
end
|
||
|
end
|
||
|
acts_as_versioned
|
||
|
|
||
|
def project
|
||
| redmine/app/views/wiki/_sidebar.rhtml 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
<%= link_to l(:field_start_page), {:action => 'index', :page => nil} %><br />
|
||
|
<%= link_to l(:label_index_by_title), {:action => 'special', :page => 'Page_index'} %><br />
|
||
|
<%= link_to l(:label_index_by_date), {:action => 'special', :page => 'Date_index'} %><br />
|
||
|
<%= link_to l(:label_index_by_category), {:action => 'special', :page => 'Category_index'} %><br />
|
||
|
<% if wiki_categories = @page.categories.sub(/^\|(.*)\|$/, '\1').split('|') rescue nil %>
|
||
|
<% if (!wiki_categories.empty?) %>
|
||
|
<h3><%= l((wiki_categories.length==1)?(:label_wiki_category):(:label_wiki_category_plural)) %></h3>
|
||
|
<% wiki_categories.sort.each do |category| %>
|
||
|
<%= link_to category, {:action => 'special', :page => 'category', :category => Wiki.titleize(category)} %><br />
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
| redmine/app/views/wiki/special_category.rhtml 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
<% if @category == 'None' %>
|
||
|
<h2><%= l(:label_pages_without_category) %></h2>
|
||
|
<% else %>
|
||
|
<h2><%= l(:label_wiki_category) %>: <%= @category %></h2>
|
||
|
<% end %>
|
||
|
<% if @pages.empty? %>
|
||
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
||
|
<% end %>
|
||
|
<% content_for :sidebar do %>
|
||
|
<%= render :partial => 'sidebar' %>
|
||
|
<% end %>
|
||
|
<% unless @pages.empty? %>
|
||
|
<p>
|
||
|
<ul>
|
||
|
<% group = nil %>
|
||
|
<% @pages.each do |page| %>
|
||
|
<% if page.title[0,1].upcase != group %>
|
||
|
</ul><h4><%= group = page.title[0,1].upcase %></h4><ul>
|
||
|
<% end %>
|
||
|
<li><%= link_to page.pretty_title, {:action => 'index', :page => page.title} %></li>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
</p>
|
||
|
<% end %>
|
||
| redmine/app/views/wiki/special_category_index.rhtml 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
<h2><%= l(:label_index_by_category) %></h2>
|
||
|
<% content_for :sidebar do %>
|
||
|
<%= render :partial => 'sidebar' %>
|
||
|
<% end %>
|
||
|
<% unless @categories.empty? %>
|
||
|
<p>
|
||
|
<ul>
|
||
|
<% group = nil %>
|
||
|
<% @categories.each do |category| %>
|
||
|
<% if category[0,1].upcase != group %>
|
||
|
</ul><h4><%= group = category[0,1].upcase %></h4><ul>
|
||
|
<% end %>
|
||
|
<li><%= link_to category, {:action => 'special', :page => 'category', :category => category} %></li>
|
||
|
<% end %>
|
||
|
</ul>
|
||
|
</p>
|
||
|
<% end %>
|
||
|
<h4><%= l(:label_special) %></h4>
|
||
|
<p>
|
||
|
<ul>
|
||
|
<li>
|
||
|
<%= link_to l(:label_pages_without_category), {:action => 'special', :page => 'category', :category => 'None'} %>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</p>
|
||
| redmine/config/locales/bg.yml 2009-05-20 08:48:03 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki редакции
|
||
|
label_wiki_page: Wiki page
|
||
|
label_wiki_page_plural: Wiki pages
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Индекс
|
||
|
label_index_by_date: Индекс по дата
|
||
|
label_current_version: Текуща версия
|
||
| redmine/config/locales/bs.yml 2009-05-20 09:01:40 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: ispravke wiki-ja
|
||
|
label_wiki_page: Wiki stranica
|
||
|
label_wiki_page_plural: Wiki stranice
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Indeks prema naslovima
|
||
|
label_index_by_date: Indeks po datumima
|
||
|
label_current_version: Tekuća verzija
|
||
| redmine/config/locales/ca.yml 2009-05-20 08:48:03 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Edicions wiki
|
||
|
label_wiki_page: Pàgina wiki
|
||
|
label_wiki_page_plural: Pàgines wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Índex per títol
|
||
|
label_index_by_date: Índex per data
|
||
|
label_current_version: Versió actual
|
||
| redmine/config/locales/cs.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki úpravy
|
||
|
label_wiki_page: Wiki stránka
|
||
|
label_wiki_page_plural: Wiki stránky
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Index dle názvu
|
||
|
label_index_by_date: Index dle data
|
||
|
label_current_version: Aktuální verze
|
||
| redmine/config/locales/da.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki ændringer
|
||
|
label_wiki_page: Wiki side
|
||
|
label_wiki_page_plural: Wiki sider
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Indhold efter titel
|
||
|
label_index_by_date: Indhold efter dato
|
||
|
label_current_version: Nuværende version
|
||
| redmine/config/locales/de.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki-Bearbeitungen
|
||
|
label_wiki_page: Wiki-Seite
|
||
|
label_wiki_page_plural: Wiki-Seiten
|
||
|
label_wiki_category: Kategorie
|
||
|
label_wiki_category_plural: Kategorien
|
||
|
label_index_by_category: Seiten nach Kategorie sortiert
|
||
|
label_special: Speziell
|
||
|
label_pages_without_category: Seiten ohne Kategorie
|
||
|
label_index_by_title: Seiten nach Titel sortiert
|
||
|
label_index_by_date: Seiten nach Datum sortiert
|
||
|
label_current_version: Gegenwärtige Version
|
||
| redmine/config/locales/en.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki edits
|
||
|
label_wiki_page: Wiki page
|
||
|
label_wiki_page_plural: Wiki pages
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Index by title
|
||
|
label_index_by_date: Index by date
|
||
|
label_current_version: Current version
|
||
| redmine/config/locales/es.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki edicciones
|
||
|
label_wiki_page: Wiki página
|
||
|
label_wiki_page_plural: Wiki páginas
|
||
|
label_wiki_category: Categoría
|
||
|
label_wiki_category_plural: Categorías
|
||
|
label_index_by_category: Índice por categoría
|
||
|
label_special: Especial
|
||
|
label_pages_without_category: Páginas sin categoría
|
||
|
label_workflow: Flujo de trabajo
|
||
|
label_year: Año
|
||
|
label_yesterday: ayer
|
||
| redmine/config/locales/fi.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki muokkaukset
|
||
|
label_wiki_page: Wiki sivu
|
||
|
label_wiki_page_plural: Wiki sivut
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Hakemisto otsikoittain
|
||
|
label_index_by_date: Hakemisto päivittäin
|
||
|
label_current_version: Nykyinen versio
|
||
| redmine/config/locales/fr.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Révisions wiki
|
||
|
label_wiki_page: Page wiki
|
||
|
label_wiki_page_plural: Pages wiki
|
||
|
label_wiki_category: Catégorie
|
||
|
label_wiki_category_plural: Catégories
|
||
|
label_label_index_by_category: Index par catégorie
|
||
|
label_special: Spécial
|
||
|
label_pages_without_category: Pages sans catégorie
|
||
|
label_index_by_title: Index par titre
|
||
|
label_index_by_date: Index par date
|
||
|
label_current_version: Version actuelle
|
||
| redmine/config/locales/gl.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki edicións
|
||
|
label_wiki_page: Wiki páxina
|
||
|
label_wiki_page_plural: Wiki páxinas
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_workflow: Fluxo de traballo
|
||
|
label_year: Ano
|
||
|
label_yesterday: onte
|
||
| redmine/config/locales/he.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: עריכות Wiki
|
||
|
label_wiki_page: דף Wiki
|
||
|
label_wiki_page_plural: דפי Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: סדר על פי כותרת
|
||
|
label_index_by_date: סדר על פי תאריך
|
||
|
label_current_version: גירסא נוכאית
|
||
| redmine/config/locales/hu.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki szerkesztések
|
||
|
label_wiki_page: Wiki oldal
|
||
|
label_wiki_page_plural: Wiki oldalak
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Cím szerint indexelve
|
||
|
label_index_by_date: Dátum szerint indexelve
|
||
|
label_current_version: Jelenlegi verzió
|
||
| redmine/config/locales/it.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Modfiche wiki
|
||
|
label_wiki_page: Pagina Wiki
|
||
|
label_wiki_page_plural: Pagine Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Ordina per titolo
|
||
|
label_index_by_date: Ordina per data
|
||
|
label_current_version: Versione corrente
|
||
| redmine/config/locales/ja.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki編集
|
||
|
label_wiki_page: Wiki page
|
||
|
label_wiki_page_plural: Wikiページ
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: 索引(名前順)
|
||
|
label_index_by_date: 索引(日付順)
|
||
|
label_current_version: 最新版
|
||
| redmine/config/locales/ko.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: 위키 편집
|
||
|
label_wiki_page: 위키
|
||
|
label_wiki_page_plural: 위키
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: 제목별 색인
|
||
|
label_index_by_date: 날짜별 색인
|
||
|
label_current_version: 현재 버전
|
||
| redmine/config/locales/lt.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki redakcijos
|
||
|
label_wiki_page: Wiki puslapis
|
||
|
label_wiki_page_plural: Wiki puslapiai
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Indeksas prie pavadinimo
|
||
|
label_index_by_date: Indeksas prie datos
|
||
|
label_current_version: Einamoji versija
|
||
| redmine/config/locales/nl.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki edits
|
||
|
label_wiki_page: Wikipagina
|
||
|
label_wiki_page_plural: Wikipagina's
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_workflow: Workflow
|
||
|
label_year: Jaar
|
||
|
label_yesterday: gisteren
|
||
| redmine/config/locales/no.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki endringer
|
||
|
label_wiki_page: Wiki-side
|
||
|
label_wiki_page_plural: Wiki-sider
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Indekser etter tittel
|
||
|
label_index_by_date: Indekser etter dato
|
||
|
label_current_version: Gjeldende versjon
|
||
| redmine/config/locales/pl.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Edycje wiki
|
||
|
label_wiki_page: Strona wiki
|
||
|
label_wiki_page_plural: Strony wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_workflow: Przepływ
|
||
|
label_year: Rok
|
||
|
label_yesterday: wczoraj
|
||
| redmine/config/locales/pt-BR.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Edições Wiki
|
||
|
label_wiki_page: Página Wiki
|
||
|
label_wiki_page_plural: páginas Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Índice por título
|
||
|
label_index_by_date: Índice por data
|
||
|
label_current_version: Versão atual
|
||
| redmine/config/locales/pt.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Edições da Wiki
|
||
|
label_wiki_page: Página da Wiki
|
||
|
label_wiki_page_plural: Páginas da Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Índice por título
|
||
|
label_index_by_date: Índice por data
|
||
|
label_current_version: Versão actual
|
||
| redmine/config/locales/ro.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Editari Wiki
|
||
|
label_wiki_page: Pagina Wiki
|
||
|
label_wiki_page_plural: Pagini Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Sorteaza dupa titlu
|
||
|
label_index_by_date: Sorteaza dupa data
|
||
|
label_current_version: Versiunea curenta
|
||
| redmine/config/locales/ru.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki
|
||
|
label_wiki_page: Страница Wiki
|
||
|
label_wiki_page_plural: Страницы Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_workflow: Последовательность действий
|
||
|
label_x_closed_issues_abbr:
|
||
|
zero: 0 закрыто
|
||
| redmine/config/locales/sk.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki úpravy
|
||
|
label_wiki_page: Wiki stránka
|
||
|
label_wiki_page_plural: Wiki stránky
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Index podľa názvu
|
||
|
label_index_by_date: Index podľa dátumu
|
||
|
label_current_version: Aktuálna verzia
|
||
| redmine/config/locales/sl.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki urejanja
|
||
|
label_wiki_page: Wiki stran
|
||
|
label_wiki_page_plural: Wiki strani
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Razvrsti po naslovu
|
||
|
label_index_by_date: Razvrsti po datumu
|
||
|
label_current_version: Trenutna verzija
|
||
| redmine/config/locales/sr.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki promene
|
||
|
label_wiki_page: Wiki stranica
|
||
|
label_wiki_page_plural: Wiki stranice
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Indeks po naslovima
|
||
|
label_index_by_date: Indeks po datumu
|
||
|
label_current_version: Trenutna verzija
|
||
| redmine/config/locales/sv.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wikiändringar
|
||
|
label_wiki_page: Wikisida
|
||
|
label_wiki_page_plural: Wikisidor
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Innehåll efter titel
|
||
|
label_index_by_date: Innehåll efter datum
|
||
|
label_current_version: Nuvarande version
|
||
| redmine/config/locales/th.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: แก้ไข Wiki
|
||
|
label_wiki_page: หน้า Wiki
|
||
|
label_wiki_page_plural: หน้า Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: เรียงตามชื่อเรื่อง
|
||
|
label_index_by_date: เรียงตามวัน
|
||
|
label_current_version: รุ่นปัจจุบัน
|
||
| redmine/config/locales/tr.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki düzenlemeleri
|
||
|
label_wiki_page: Wiki sayfası
|
||
|
label_wiki_page_plural: Wiki sayfaları
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Başlığa göre diz
|
||
|
label_index_by_date: Tarihe göre diz
|
||
|
label_current_version: Güncel versiyon
|
||
| redmine/config/locales/uk.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Редагування Wiki
|
||
|
label_wiki_page: Сторінка Wiki
|
||
|
label_wiki_page_plural: Сторінки Wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Індекс за назвою
|
||
|
label_index_by_date: Індекс за датою
|
||
|
label_current_version: Поточна версія
|
||
| redmine/config/locales/vi.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Thay đổi wiki
|
||
|
label_wiki_page: Trang wiki
|
||
|
label_wiki_page_plural: Trang wiki
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: Danh sách theo tên
|
||
|
label_index_by_date: Danh sách theo ngày
|
||
|
label_current_version: Bản hiện tại
|
||
| redmine/config/locales/zh-TW.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki 編輯
|
||
|
label_wiki_page: Wiki 網頁
|
||
|
label_wiki_page_plural: Wiki 網頁
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: 依標題索引
|
||
|
label_index_by_date: 依日期索引
|
||
|
label_current_version: 現行版本
|
||
| redmine/config/locales/zh.yml 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
label_wiki_edit_plural: Wiki 编辑记录
|
||
|
label_wiki_page: Wiki 页面
|
||
|
label_wiki_page_plural: Wiki 页面
|
||
|
label_wiki_category: Category
|
||
|
label_wiki_category_plural: Categories
|
||
|
label_wiki_index_by_category: Index by category
|
||
|
label_special: Special
|
||
|
label_pages_without_category: Pages without category
|
||
|
label_index_by_title: 按标题索引
|
||
|
label_index_by_date: 按日期索引
|
||
|
label_current_version: 当前版本
|
||
| redmine/config/routes.rb 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
|
||
|
map.with_options :controller => 'wiki' do |wiki_routes|
|
||
|
wiki_routes.with_options :conditions => {:method => :get} do |wiki_views|
|
||
|
wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|export/i
|
||
|
wiki_views.connect 'projects/:id/wiki/:page', :action => 'special', :page => /page_index|date_index|category_index|export/i
|
||
|
wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil
|
||
|
wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit'
|
||
|
wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename'
|
||
|
wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history'
|
||
|
wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff'
|
||
|
wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate'
|
||
|
wiki_views.connect 'projects/:id/wiki/category/:category', :action => 'special', :page => 'category'
|
||
|
end
|
||
|
|
||
|
wiki_routes.connect 'projects/:id/wiki/:page/:action',
|
||
| redmine/db/migrate/20090516170318_add_wiki_pages_categories.rb 2009-05-20 08:31:11 +0200 | ||
|---|---|---|
|
class AddWikiPagesCategories < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
add_column :wiki_pages, :categories, :string
|
||
|
end
|
||
|
def self.down
|
||
|
remove_column :wiki_pages, :categories
|
||
|
end
|
||
|
end
|
||
| redmine/lib/redmine/wiki_formatting/macros.rb 2009-05-20 08:31:12 +0200 | ||
|---|---|---|
|
@included_wiki_pages.pop
|
||
|
out
|
||
|
end
|
||
|
desc "Add the current wiki page to a category.\nExample: !{{category(Help)}}"
|
||
|
macro :category do |obj, args|
|
||
|
'' # categories are listed in the sidebar
|
||
|
end
|
||
|
desc "Add the current wiki page to several categories.\nExample: !{{categories(Help, Snippets)}}"
|
||
|
macro :categories do |obj, args|
|
||
|
'' # categories are listed in the sidebar
|
||
|
end
|
||
|
desc "Display a list of pages which belong to the specified category.\nExample: !{{pages_in_category(Help)}}"
|
||
|
macro :pages_in_category do |obj, args|
|
||
|
if !args.first.nil?
|
||
|
content_tag :ul, :class => :pages_in_category do
|
||
|
@wiki.find_pages_in_category(args.first).map do |p|
|
||
|
content_tag :li do
|
||
|
link_to p.pretty_title, {:action => 'index', :page => p.title}
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
-- redmine.orig/test/fixtures/wiki_pages.yml 2009-05-20 09:10:13 +0200
|
||
|
++ redmine/test/fixtures/wiki_pages.yml 2009-05-20 08:31:12 +0200
|
||
| ... | ... | |
|
wiki_id: 1
|
||
|
protected: true
|
||
|
parent_id:
|
||
|
categories: |Examples|Documentation|
|
||
|
wiki_pages_002:
|
||
|
created_on: 2007-03-08 00:18:07 +01:00
|
||
|
title: Another_page
|
||
| ... | ... | |
|
wiki_id: 1
|
||
|
protected: false
|
||
|
parent_id:
|
||
|
categories:
|
||
|
wiki_pages_003:
|
||
|
created_on: 2007-03-08 00:18:07 +01:00
|
||
|
title: Start_page
|
||
| ... | ... | |
|
wiki_id: 2
|
||
|
protected: false
|
||
|
parent_id:
|
||
|
categories:
|
||
|
wiki_pages_004:
|
||
|
created_on: 2007-03-08 00:18:07 +01:00
|
||
|
title: Page_with_an_inline_image
|
||
| ... | ... | |
|
wiki_id: 1
|
||
|
protected: false
|
||
|
parent_id: 1
|
||
|
categories: |Examples|
|
||
|
wiki_pages_005:
|
||
|
created_on: 2007-03-08 00:18:07 +01:00
|
||
|
title: Child_1
|
||
| ... | ... | |
|
wiki_id: 1
|
||
|
protected: false
|
||
|
parent_id: 2
|
||
|
categories: |Examples|
|
||
|
wiki_pages_006:
|
||
|
created_on: 2007-03-08 00:18:07 +01:00
|
||
|
title: Child_2
|
||
| ... | ... | |
|
wiki_id: 1
|
||
|
protected: false
|
||
|
parent_id: 2
|
||
|
|
||
|
categories: |Examples|
|
||
| redmine/test/functional/wiki_controller_test.rb 2009-05-20 08:31:12 +0200 | ||
|---|---|---|
|
:controller => 'wiki', :action => 'special', :id => '567', :page => 'date_index'
|
||
|
)
|
||
|
assert_routing(
|
||
|
{:method => :get, :path => '/projects/567/wiki/category_index'},
|
||
|
:controller => 'wiki', :action => 'special', :id => '567', :page => 'category_index'
|
||
|
)
|
||
|
assert_routing(
|
||
|
{:method => :get, :path => '/projects/567/wiki/category/Test'},
|
||
|
:controller => 'wiki', :action => 'special', :id => '567', :page => 'category', :category => 'Test'
|
||
|
)
|
||
|
assert_routing(
|
||
|
{:method => :get, :path => '/projects/567/wiki/export'},
|
||
|
:controller => 'wiki', :action => 'special', :id => '567', :page => 'export'
|
||
|
)
|
||
| redmine/test/unit/helpers/application_helper_test.rb 2009-05-20 08:31:12 +0200 | ||
|---|---|---|
|
# project does not exist
|
||
|
'[[unknowproject:Start]]' => '[[unknowproject:Start]]',
|
||
|
'[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]',
|
||
|
# categories
|
||
|
'[[category:Test]]' => '<a href="/projects/ecookbook/wiki/category/Test">Test</a>',
|
||
|
'[[category:Test|Text]]' => '<a href="/projects/ecookbook/wiki/category/Test">Text</a>',
|
||
|
'[[ecookbook:category:Test]]' => '<a href="/projects/ecookbook/wiki/category/Test">Test</a>',
|
||
|
'[[ecookbook:category:Test|Text]]' => '<a href="/projects/ecookbook/wiki/category/Test">Text</a>',
|
||
|
'[[unknownproject:category:Test]]' => '[[unknownproject:category:Test]]',
|
||
|
'[[unknownproject:category:Test|Text]]' => '[[unknownproject:category:Test|Text]]',
|
||
|
'![[category:Test]]' => '[[category:Test]]',
|
||
|
}
|
||
|
@project = Project.find(1)
|
||
|
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
||
| redmine/test/unit/wiki_content_test.rb 2009-05-20 08:48:04 +0200 | ||
|---|---|---|
|
|
||
|
def test_create
|
||
|
page = WikiPage.new(:wiki => @wiki, :title => "Page")
|
||
|
page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
|
||
|
page.content = WikiContent.new(:text => "{{category(Test)}}Content text", :author => User.find(1), :comments => "My comment")
|
||
|
assert page.save
|
||
|
page.reload
|
||
|
|
||
| ... | ... | |
|
assert_kind_of WikiContent, content
|
||
|
assert_equal 1, content.version
|
||
|
assert_equal 1, content.versions.length
|
||
|
assert_equal "Content text", content.text
|
||
|
assert_equal "{{category(Test)}}Content text", content.text
|
||
|
assert_equal "|Test|", content.page.categories
|
||
|
assert_equal "My comment", content.comments
|
||
|
assert_equal User.find(1), content.author
|
||
|
assert_equal content.text, content.versions.last.text
|
||
| redmine/test/unit/wiki_test.rb 2009-05-20 08:31:12 +0200 | ||
|---|---|---|
|
class WikiTest < Test::Unit::TestCase
|
||
|
fixtures :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
|
||
|
|
||
|
def test_create
|
||
|
|
||
|
def test_create
|
||
|
wiki = Wiki.new(:project => Project.find(2))
|
||
|
assert !wiki.save
|
||
|
assert_equal 1, wiki.errors.count
|
||
|
|
||
|
wiki.start_page = "Start page"
|
||
|
assert wiki.save
|
||
|
end
|
||
|
wiki.start_page = "Start page"
|
||
|
assert wiki.save
|
||
|
end
|
||
|
def test_update
|
||
|
@wiki = Wiki.find(1)
|
||
| ... | ... | |
|
assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES')
|
||
|
assert_equal 'テスト', Wiki.titleize('テスト')
|
||
|
end
|
||
|
def test_upcase_first
|
||
|
assert_equal 'Page title', Wiki.upcase_first('page title')
|
||
|
assert_equal 'テスト', Wiki.titleize('テスト')
|
||
|
end
|
||
|
def test_find_categories
|
||
|
@wiki = Wiki.find(1)
|
||
|
assert_equal ['Examples', 'Documentation'], @wiki.find_all_categories
|
||
|
end
|
||
|
def test_find_pages_in_category
|
||
|
@wiki = Wiki.find(1)
|
||
|
assert_equal [1], @wiki.find_pages_in_category('Documentation').map {|c| c.id }.sort
|
||
|
assert_equal [1, 4, 5, 6], @wiki.find_pages_in_category('Examples').map {|c| c.id }.sort
|
||
|
assert_equal [2], @wiki.find_pages_in_category('None').map {|c| c.id }.sort
|
||
|
end
|
||
|
end
|
||