##// END OF EJS Templates
Ability to watch a wiki or a single wiki page (#413)....
Jean-Philippe Lang -
r2666:85ce903cfa5f
parent child
Show More
@@ -25,6 +25,7 class WikiController < ApplicationController
25
25
26 helper :attachments
26 helper :attachments
27 include AttachmentsHelper
27 include AttachmentsHelper
28 helper :watchers
28
29
29 # display a page (in editing mode if it doesn't exist)
30 # display a page (in editing mode if it doesn't exist)
30 def index
31 def index
@@ -163,6 +163,7 class Mailer < ActionMailer::Base
163 'Wiki-Page-Id' => wiki_content.page.id
163 'Wiki-Page-Id' => wiki_content.page.id
164 message_id wiki_content
164 message_id wiki_content
165 recipients wiki_content.project.recipients
165 recipients wiki_content.project.recipients
166 cc(wiki_content.page.wiki.watcher_recipients - recipients)
166 subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
167 subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
167 body :wiki_content => wiki_content,
168 body :wiki_content => wiki_content,
168 :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title)
169 :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title)
@@ -178,6 +179,7 class Mailer < ActionMailer::Base
178 'Wiki-Page-Id' => wiki_content.page.id
179 'Wiki-Page-Id' => wiki_content.page.id
179 message_id wiki_content
180 message_id wiki_content
180 recipients wiki_content.project.recipients
181 recipients wiki_content.project.recipients
182 cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients)
181 subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :page => wiki_content.page.pretty_title)}"
183 subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :page => wiki_content.page.pretty_title)}"
182 body :wiki_content => wiki_content,
184 body :wiki_content => wiki_content,
183 :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
185 :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
@@ -1,5 +1,5
1 # redMine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
@@ -20,6 +20,8 class Wiki < ActiveRecord::Base
20 has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title'
20 has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title'
21 has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all
21 has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all
22
22
23 acts_as_watchable
24
23 validates_presence_of :start_page
25 validates_presence_of :start_page
24 validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
26 validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
25
27
@@ -1,5 +1,5
1 # redMine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2009 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
@@ -23,7 +23,8 class WikiPage < ActiveRecord::Base
23 has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy
23 has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy
24 acts_as_attachable :delete_permission => :delete_wiki_pages_attachments
24 acts_as_attachable :delete_permission => :delete_wiki_pages_attachments
25 acts_as_tree :dependent => :nullify, :order => 'title'
25 acts_as_tree :dependent => :nullify, :order => 'title'
26
26
27 acts_as_watchable
27 acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"},
28 acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"},
28 :description => :text,
29 :description => :text,
29 :datetime => :created_on,
30 :datetime => :created_on,
@@ -1,6 +1,7
1 <div class="contextual">
1 <div class="contextual">
2 <% if @editable %>
2 <% if @editable %>
3 <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %>
3 <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %>
4 <%= watcher_tag(@page, User.current) %>
4 <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
5 <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
5 <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
6 <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
6 <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %>
7 <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %>
@@ -1,3 +1,7
1 <div class="contextual">
2 <%= watcher_tag(@wiki, User.current) %>
3 </div>
4
1 <h2><%= l(:label_index_by_date) %></h2>
5 <h2><%= l(:label_index_by_date) %></h2>
2
6
3 <% if @pages.empty? %>
7 <% if @pages.empty? %>
@@ -1,3 +1,7
1 <div class="contextual">
2 <%= watcher_tag(@wiki, User.current) %>
3 </div>
4
1 <h2><%= l(:label_index_by_title) %></h2>
5 <h2><%= l(:label_index_by_title) %></h2>
2
6
3 <% if @pages.empty? %>
7 <% if @pages.empty? %>
General Comments 0
You need to be logged in to leave comments. Login now