Ability to watch a wiki or a single wiki page (#413).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2765 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9c630cc2b7
commit
85ce903cfa
|
@ -25,6 +25,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
helper :attachments
|
helper :attachments
|
||||||
include AttachmentsHelper
|
include AttachmentsHelper
|
||||||
|
helper :watchers
|
||||||
|
|
||||||
# display a page (in editing mode if it doesn't exist)
|
# display a page (in editing mode if it doesn't exist)
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -163,6 +163,7 @@ class Mailer < ActionMailer::Base
|
||||||
'Wiki-Page-Id' => wiki_content.page.id
|
'Wiki-Page-Id' => wiki_content.page.id
|
||||||
message_id wiki_content
|
message_id wiki_content
|
||||||
recipients wiki_content.project.recipients
|
recipients wiki_content.project.recipients
|
||||||
|
cc(wiki_content.page.wiki.watcher_recipients - recipients)
|
||||||
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
|
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
|
||||||
body :wiki_content => wiki_content,
|
body :wiki_content => wiki_content,
|
||||||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title)
|
: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
|
||||||
'Wiki-Page-Id' => wiki_content.page.id
|
'Wiki-Page-Id' => wiki_content.page.id
|
||||||
message_id wiki_content
|
message_id wiki_content
|
||||||
recipients wiki_content.project.recipients
|
recipients wiki_content.project.recipients
|
||||||
|
cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients)
|
||||||
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :page => wiki_content.page.pretty_title)}"
|
subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :page => wiki_content.page.pretty_title)}"
|
||||||
body :wiki_content => wiki_content,
|
body :wiki_content => wiki_content,
|
||||||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
|
:wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# redMine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
# Copyright (C) 2006-2009 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
@ -20,6 +20,8 @@ class Wiki < ActiveRecord::Base
|
||||||
has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title'
|
has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title'
|
||||||
has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all
|
has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all
|
||||||
|
|
||||||
|
acts_as_watchable
|
||||||
|
|
||||||
validates_presence_of :start_page
|
validates_presence_of :start_page
|
||||||
validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
|
validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# redMine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
# Copyright (C) 2006-2009 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
@ -23,7 +23,8 @@ class WikiPage < ActiveRecord::Base
|
||||||
has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy
|
has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy
|
||||||
acts_as_attachable :delete_permission => :delete_wiki_pages_attachments
|
acts_as_attachable :delete_permission => :delete_wiki_pages_attachments
|
||||||
acts_as_tree :dependent => :nullify, :order => 'title'
|
acts_as_tree :dependent => :nullify, :order => 'title'
|
||||||
|
|
||||||
|
acts_as_watchable
|
||||||
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"},
|
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"},
|
||||||
:description => :text,
|
:description => :text,
|
||||||
:datetime => :created_on,
|
:datetime => :created_on,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<% if @editable %>
|
<% if @editable %>
|
||||||
<%= 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 %>
|
<%= 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 %>
|
||||||
|
<%= watcher_tag(@page, User.current) %>
|
||||||
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
|
<%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %>
|
||||||
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
|
<%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %>
|
||||||
<%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %>
|
<%= 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 @@
|
||||||
|
<div class="contextual">
|
||||||
|
<%= watcher_tag(@wiki, User.current) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2><%= l(:label_index_by_date) %></h2>
|
<h2><%= l(:label_index_by_date) %></h2>
|
||||||
|
|
||||||
<% if @pages.empty? %>
|
<% if @pages.empty? %>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<div class="contextual">
|
||||||
|
<%= watcher_tag(@wiki, User.current) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2><%= l(:label_index_by_title) %></h2>
|
<h2><%= l(:label_index_by_title) %></h2>
|
||||||
|
|
||||||
<% if @pages.empty? %>
|
<% if @pages.empty? %>
|
||||||
|
|
Loading…
Reference in New Issue