added rss/atom feeds at project levels for:
* news * new issues reported * details of issue changes issue cutom queries can be used as feeds git-svn-id: http://redmine.rubyforge.org/svn/trunk@339 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
22b42dc90a
commit
10cf1ccc1a
|
@ -1,5 +1,5 @@
|
||||||
# redMine - project management software
|
# redMine - project management software
|
||||||
# Copyright (C) 2006 Jean-Philippe Lang
|
# Copyright (C) 2006-2007 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
|
||||||
|
@ -16,10 +16,85 @@
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
class FeedsController < ApplicationController
|
class FeedsController < ApplicationController
|
||||||
|
before_filter :find_scope
|
||||||
session :off
|
session :off
|
||||||
|
|
||||||
|
helper :issues
|
||||||
|
include IssuesHelper
|
||||||
|
helper :custom_fields
|
||||||
|
include CustomFieldsHelper
|
||||||
|
|
||||||
|
# news feeds
|
||||||
def news
|
def news
|
||||||
|
News.with_scope(:find => @find_options) do
|
||||||
@news = News.find :all, :order => "#{News.table_name}.created_on DESC", :limit => 10, :include => [ :author, :project ]
|
@news = News.find :all, :order => "#{News.table_name}.created_on DESC", :limit => 10, :include => [ :author, :project ]
|
||||||
|
end
|
||||||
headers["Content-Type"] = "application/rss+xml"
|
headers["Content-Type"] = "application/rss+xml"
|
||||||
|
render :action => 'news_atom' if 'atom' == params[:format]
|
||||||
|
end
|
||||||
|
|
||||||
|
# issue feeds
|
||||||
|
def issues
|
||||||
|
conditions = nil
|
||||||
|
|
||||||
|
if params[:query_id]
|
||||||
|
query = Query.find(params[:query_id])
|
||||||
|
# ignore query if it's not valid
|
||||||
|
query = nil unless query.valid?
|
||||||
|
conditions = query.statement if query
|
||||||
|
end
|
||||||
|
|
||||||
|
Issue.with_scope(:find => @find_options) do
|
||||||
|
@issues = Issue.find :all, :include => [:project, :author, :tracker, :status],
|
||||||
|
:order => "#{Issue.table_name}.created_on DESC",
|
||||||
|
:conditions => conditions
|
||||||
|
end
|
||||||
|
@title = (@project ? @project.name : Setting.app_title) + ": " + (query ? query.name : l(:label_reported_issues))
|
||||||
|
headers["Content-Type"] = "application/rss+xml"
|
||||||
|
render :action => 'issues_atom' if 'atom' == params[:format]
|
||||||
|
end
|
||||||
|
|
||||||
|
# issue changes feeds
|
||||||
|
def history
|
||||||
|
conditions = nil
|
||||||
|
|
||||||
|
if params[:query_id]
|
||||||
|
query = Query.find(params[:query_id])
|
||||||
|
# ignore query if it's not valid
|
||||||
|
query = nil unless query.valid?
|
||||||
|
conditions = query.statement if query
|
||||||
|
end
|
||||||
|
|
||||||
|
Journal.with_scope(:find => @find_options) do
|
||||||
|
@journals = Journal.find :all, :include => [ :details, :user, {:issue => [:project, :author, :tracker, :status]} ],
|
||||||
|
:order => "#{Journal.table_name}.created_on DESC",
|
||||||
|
:conditions => conditions
|
||||||
|
end
|
||||||
|
|
||||||
|
@title = (@project ? @project.name : Setting.app_title) + ": " + (query ? query.name : l(:label_reported_issues))
|
||||||
|
headers["Content-Type"] = "application/rss+xml"
|
||||||
|
render :action => 'history_atom' if 'atom' == params[:format]
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# override for feeds specific authentication
|
||||||
|
def check_if_login_required
|
||||||
|
@user = User.find_by_rss_key(params[:key])
|
||||||
|
render(:nothing => true, :status => 403) and return false if !@user && Setting.login_required?
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_scope
|
||||||
|
if params[:project_id]
|
||||||
|
# project feed
|
||||||
|
# check if project is public or if the user is a member
|
||||||
|
@project = Project.find(params[:project_id])
|
||||||
|
render(:nothing => true, :status => 403) and return false unless @project.is_public? || (@user && @user.role_for_project(@project.id))
|
||||||
|
scope = ["#{Project.table_name}.id=?", params[:project_id].to_i]
|
||||||
|
else
|
||||||
|
# global feed
|
||||||
|
scope = ["#{Project.table_name}.is_public=?", true]
|
||||||
|
end
|
||||||
|
@find_options = {:conditions => scope, :limit => 10}
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -575,6 +575,11 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def feeds
|
||||||
|
@queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
|
||||||
|
@key = logged_in_user.get_or_create_rss_key.value if logged_in_user
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Find project of id params[:id]
|
# Find project of id params[:id]
|
||||||
# if not found, redirect to project list
|
# if not found, redirect to project list
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
class Journal < ActiveRecord::Base
|
class Journal < ActiveRecord::Base
|
||||||
belongs_to :journalized, :polymorphic => true
|
belongs_to :journalized, :polymorphic => true
|
||||||
|
# added as a quick fix to allow eager loading of the polymorphic association
|
||||||
|
# since always associated to an issue, for now
|
||||||
|
belongs_to :issue, :foreign_key => :journalized_id
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Token < ActiveRecord::Base
|
||||||
|
|
||||||
# Delete all expired tokens
|
# Delete all expired tokens
|
||||||
def self.destroy_expired
|
def self.destroy_expired
|
||||||
Token.delete_all ["created_on < ?", Time.now - @@validity_time]
|
Token.delete_all ["action <> 'feeds' AND created_on < ?", Time.now - @@validity_time]
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -22,6 +22,7 @@ class User < ActiveRecord::Base
|
||||||
has_many :projects, :through => :memberships
|
has_many :projects, :through => :memberships
|
||||||
has_many :custom_values, :dependent => :delete_all, :as => :customized
|
has_many :custom_values, :dependent => :delete_all, :as => :customized
|
||||||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||||||
|
has_one :rss_key, :dependent => :destroy, :class_name => 'Token', :conditions => "action='feeds'"
|
||||||
belongs_to :auth_source
|
belongs_to :auth_source
|
||||||
|
|
||||||
attr_accessor :password, :password_confirmation
|
attr_accessor :password, :password_confirmation
|
||||||
|
@ -134,6 +135,15 @@ class User < ActiveRecord::Base
|
||||||
self.preference ||= UserPreference.new(:user => self)
|
self.preference ||= UserPreference.new(:user => self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_or_create_rss_key
|
||||||
|
self.rss_key || Token.create(:user => self, :action => 'feeds')
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.find_by_rss_key(key)
|
||||||
|
token = Token.find_by_value(key)
|
||||||
|
token && token.user.active? ? token.user : nil
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Return password digest
|
# Return password digest
|
||||||
def self.hash_password(clear_password)
|
def self.hash_password(clear_password)
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
xml.instruct!
|
||||||
|
xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
|
||||||
|
xml.channel do
|
||||||
|
xml.title @title
|
||||||
|
xml.link url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.pubDate CGI.rfc1123_date(@journals.first ? @journals.first.created_on : Time.now)
|
||||||
|
xml.description l(:label_reported_issues)
|
||||||
|
@journals.each do |journal|
|
||||||
|
issue = journal.issue
|
||||||
|
xml.item do
|
||||||
|
xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
|
||||||
|
url = url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
|
||||||
|
xml.link url
|
||||||
|
xml.description do
|
||||||
|
xml.text! h(journal.notes)
|
||||||
|
xml.text! "<ul>"
|
||||||
|
journal.details.each do |detail|
|
||||||
|
xml.text! "<li>" + show_detail(detail, false) + "</li>"
|
||||||
|
end
|
||||||
|
xml.text! "</ul>"
|
||||||
|
end
|
||||||
|
xml.pubDate CGI.rfc1123_date(journal.created_on)
|
||||||
|
xml.guid url
|
||||||
|
xml.author h(journal.user.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
xml.instruct!
|
||||||
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||||
|
xml.title @title
|
||||||
|
xml.link "rel" => "self", "href" => url_for(:controller => 'feeds', :action => 'history', :format => 'atom', :only_path => false)
|
||||||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.updated CGI.rfc1123_date(@journals.first.created_on) if @journals.any?
|
||||||
|
xml.author { xml.name "#{Setting.app_title}" }
|
||||||
|
@journals.each do |journal|
|
||||||
|
issue = journal.issue
|
||||||
|
xml.entry do
|
||||||
|
xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
|
||||||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
|
||||||
|
xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
|
||||||
|
xml.updated CGI.rfc1123_date(journal.created_on)
|
||||||
|
xml.author { xml.name journal.user.name }
|
||||||
|
xml.summary journal.notes
|
||||||
|
xml.content "type" => "html" do
|
||||||
|
xml.text! journal.notes
|
||||||
|
xml.text! "<ul>"
|
||||||
|
journal.details.each do |detail|
|
||||||
|
xml.text! "<li>" + show_detail(detail, false) + "</li>"
|
||||||
|
end
|
||||||
|
xml.text! "</ul>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,20 @@
|
||||||
|
xml.instruct!
|
||||||
|
xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
|
||||||
|
xml.channel do
|
||||||
|
xml.title @title
|
||||||
|
xml.link url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.pubDate CGI.rfc1123_date(@issues.first ? @issues.first.created_on : Time.now)
|
||||||
|
xml.description l(:label_reported_issues)
|
||||||
|
@issues.each do |issue|
|
||||||
|
xml.item do
|
||||||
|
xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
|
||||||
|
url = url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
|
||||||
|
xml.link url
|
||||||
|
xml.description h(issue.description)
|
||||||
|
xml.pubDate CGI.rfc1123_date(issue.created_on)
|
||||||
|
xml.guid url
|
||||||
|
xml.author h(issue.author.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
xml.instruct!
|
||||||
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||||
|
xml.title @title
|
||||||
|
xml.link "rel" => "self", "href" => url_for(:controller => 'feeds', :action => 'issues', :format => 'atom', :only_path => false)
|
||||||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.updated CGI.rfc1123_date(@issues.first.updated_on) if @issues.any?
|
||||||
|
xml.author { xml.name "#{Setting.app_title}" }
|
||||||
|
@issues.each do |issue|
|
||||||
|
xml.entry do
|
||||||
|
xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
|
||||||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
|
||||||
|
xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
|
||||||
|
xml.updated CGI.rfc1123_date(issue.updated_on)
|
||||||
|
xml.author { xml.name issue.author.name }
|
||||||
|
xml.summary issue.description
|
||||||
|
xml.content "type" => "html" do
|
||||||
|
xml.text! issue.description
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
xml.instruct!
|
||||||
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||||
|
xml.title "#{Setting.app_title}: #{l(:label_news_latest)}"
|
||||||
|
xml.link "rel" => "self", "href" => url_for(:controller => 'feeds', :action => 'news', :format => 'atom', :only_path => false)
|
||||||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||||||
|
xml.updated CGI.rfc1123_date(@news.first.created_on) if @news.any?
|
||||||
|
xml.author { xml.name "#{Setting.app_title}" }
|
||||||
|
@news.each do |news|
|
||||||
|
xml.entry do
|
||||||
|
xml.title news.title
|
||||||
|
xml.link "rel" => "alternate", "href" => url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false)
|
||||||
|
xml.id url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false)
|
||||||
|
xml.updated CGI.rfc1123_date(news.created_on)
|
||||||
|
xml.author { xml.name news.author.name }
|
||||||
|
xml.summary h(news.summary)
|
||||||
|
xml.content "type" => "html" do
|
||||||
|
xml.text! news.description
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,33 @@
|
||||||
|
<h2><%= l(:label_feed_plural) %> (<%=h @project.name %>)</h2>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<tr><td colspan="3"><h3><%= l(:label_issue_plural) %></h3></td></tr>
|
||||||
|
<tr><td><%= l(:label_reported_issues) %></td>
|
||||||
|
<td><%= link_to 'RSS', {:controller => 'feeds', :action => 'issues', :project_id => @project, :key => @key}, :class => 'icon icon-feed' %></td>
|
||||||
|
<td><%= link_to 'Atom', {:controller => 'feeds', :action => 'issues', :project_id => @project, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %></td>
|
||||||
|
</tr>
|
||||||
|
<tr><td><%= l(:label_changes_details) %></td>
|
||||||
|
<td><%= link_to 'RSS', {:controller => 'feeds', :action => 'history', :project_id => @project, :key => @key}, :class => 'icon icon-feed' %></td>
|
||||||
|
<td><%= link_to 'Atom', {:controller => 'feeds', :action => 'history', :project_id => @project, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @queries.each do |query| %>
|
||||||
|
<tr><td colspan="3"><h4><%=h query.name %></h4></td></tr>
|
||||||
|
<tr><td><%= l(:label_reported_issues) %></td>
|
||||||
|
<td><%= link_to 'RSS', {:controller => 'feeds', :action => 'issues', :project_id => @project, :query_id => query, :key => @key}, :class => 'icon icon-feed' %></td>
|
||||||
|
<td><%= link_to 'Atom', {:controller => 'feeds', :action => 'issues', :project_id => @project, :query_id => query, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %></td>
|
||||||
|
</tr>
|
||||||
|
<tr><td><%= l(:label_changes_details) %></td>
|
||||||
|
<td><%= link_to 'RSS', {:controller => 'feeds', :action => 'history', :project_id => @project, :query_id => query, :key => @key}, :class => 'icon icon-feed' %></td>
|
||||||
|
<td><%= link_to 'Atom', {:controller => 'feeds', :action => 'history', :project_id => @project, :query_id => query, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr><td colspan="3"> <h3><%= l(:label_news_plural) %></h3></td></tr>
|
||||||
|
<tr><td><%= l(:label_news_latest) %></td>
|
||||||
|
<td><%= link_to 'RSS', {:controller => 'feeds', :action => 'news', :project_id => @project, :key => @key}, :class => 'icon icon-feed' %></td>
|
||||||
|
<td><%= link_to 'Atom', {:controller => 'feeds', :action => 'news', :project_id => @project, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
|
@ -1,3 +1,7 @@
|
||||||
|
<div class="contextual">
|
||||||
|
<%= link_to l(:label_feed_plural), {:action => 'feeds', :id => @project}, :class => 'icon icon-feed' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2><%=l(:label_overview)%></h2>
|
<h2><%=l(:label_overview)%></h2>
|
||||||
|
|
||||||
<div class="splitcontentleft">
|
<div class="splitcontentleft">
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AddProjectsFeedsPermissions < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
Permission.create :controller => "projects", :action => "feeds", :description => "label_feed_plural", :sort => 132, :is_public => true, :mail_option => 0, :mail_enabled => 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
Permission.find_by_controller_and_action('projects', 'feeds').destroy
|
||||||
|
end
|
||||||
|
end
|
|
@ -328,6 +328,8 @@ label_wiki: Wiki
|
||||||
label_page_index: Index
|
label_page_index: Index
|
||||||
label_current_version: Gegenwärtige Version
|
label_current_version: Gegenwärtige Version
|
||||||
label_preview: Vorbetrachtung
|
label_preview: Vorbetrachtung
|
||||||
|
label_feed_plural: Feeds
|
||||||
|
label_changes_details: Details of all changes
|
||||||
|
|
||||||
button_login: Einloggen
|
button_login: Einloggen
|
||||||
button_submit: Einreichen
|
button_submit: Einreichen
|
||||||
|
|
|
@ -328,6 +328,8 @@ label_wiki: Wiki
|
||||||
label_page_index: Index
|
label_page_index: Index
|
||||||
label_current_version: Current version
|
label_current_version: Current version
|
||||||
label_preview: Preview
|
label_preview: Preview
|
||||||
|
label_feed_plural: Feeds
|
||||||
|
label_changes_details: Details of all changes
|
||||||
|
|
||||||
button_login: Login
|
button_login: Login
|
||||||
button_submit: Submit
|
button_submit: Submit
|
||||||
|
|
|
@ -328,6 +328,8 @@ label_wiki: Wiki
|
||||||
label_page_index: Índice
|
label_page_index: Índice
|
||||||
label_current_version: Versión actual
|
label_current_version: Versión actual
|
||||||
label_preview: Previo
|
label_preview: Previo
|
||||||
|
label_feed_plural: Feeds
|
||||||
|
label_changes_details: Detalles de todos los cambios
|
||||||
|
|
||||||
button_login: Conexión
|
button_login: Conexión
|
||||||
button_submit: Someter
|
button_submit: Someter
|
||||||
|
|
|
@ -328,6 +328,8 @@ label_wiki: Wiki
|
||||||
label_page_index: Index
|
label_page_index: Index
|
||||||
label_current_version: Version actuelle
|
label_current_version: Version actuelle
|
||||||
label_preview: Prévisualisation
|
label_preview: Prévisualisation
|
||||||
|
label_feed_plural: Flux RSS
|
||||||
|
label_changes_details: Détails de tous les changements
|
||||||
|
|
||||||
button_login: Connexion
|
button_login: Connexion
|
||||||
button_submit: Soumettre
|
button_submit: Soumettre
|
||||||
|
|
|
@ -328,6 +328,8 @@ label_wiki: Wiki
|
||||||
label_page_index: Indice
|
label_page_index: Indice
|
||||||
label_current_version: Versione corrente
|
label_current_version: Versione corrente
|
||||||
label_preview: Previsione
|
label_preview: Previsione
|
||||||
|
label_feed_plural: Feeds
|
||||||
|
label_changes_details: Particolari di tutti i cambiamenti
|
||||||
|
|
||||||
button_login: Login
|
button_login: Login
|
||||||
button_submit: Invia
|
button_submit: Invia
|
||||||
|
|
|
@ -329,6 +329,8 @@ label_wiki: Wiki
|
||||||
label_page_index: 索引
|
label_page_index: 索引
|
||||||
label_current_version: 最近版
|
label_current_version: 最近版
|
||||||
label_preview: 下検分
|
label_preview: 下検分
|
||||||
|
label_feed_plural: Feeds
|
||||||
|
label_changes_details: Details of all changes
|
||||||
|
|
||||||
button_login: ログイン
|
button_login: ログイン
|
||||||
button_submit: 変更
|
button_submit: 変更
|
||||||
|
|
|
@ -154,6 +154,7 @@ vertical-align: middle;
|
||||||
.icon-attachment { background-image: url(../images/attachment.png); }
|
.icon-attachment { background-image: url(../images/attachment.png); }
|
||||||
.icon-index { background-image: url(../images/index.png); }
|
.icon-index { background-image: url(../images/index.png); }
|
||||||
.icon-history { background-image: url(../images/history.png); }
|
.icon-history { background-image: url(../images/history.png); }
|
||||||
|
.icon-feed { background-image: url(../images/feed.png); }
|
||||||
|
|
||||||
.icon22-projects { background-image: url(../images/22x22/projects.png); }
|
.icon22-projects { background-image: url(../images/22x22/projects.png); }
|
||||||
.icon22-users { background-image: url(../images/22x22/users.png); }
|
.icon22-users { background-image: url(../images/22x22/users.png); }
|
||||||
|
@ -247,6 +248,7 @@ legend {color: #505050;}
|
||||||
.even {background-color: #fff;}
|
.even {background-color: #fff;}
|
||||||
hr { border:0; border-top: dotted 1px #fff; border-bottom: dotted 1px #c0c0c0; }
|
hr { border:0; border-top: dotted 1px #fff; border-bottom: dotted 1px #c0c0c0; }
|
||||||
table p {margin:0; padding:0;}
|
table p {margin:0; padding:0;}
|
||||||
|
table td {padding-right: 1em;}
|
||||||
|
|
||||||
.highlight { background-color: #FCFD8D;}
|
.highlight { background-color: #FCFD8D;}
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,10 @@ members_002:
|
||||||
role_id: 2
|
role_id: 2
|
||||||
id: 2
|
id: 2
|
||||||
user_id: 3
|
user_id: 3
|
||||||
|
members_003:
|
||||||
|
created_on: 2006-07-19 19:35:36 +02:00
|
||||||
|
project_id: 2
|
||||||
|
role_id: 2
|
||||||
|
id: 3
|
||||||
|
user_id: 2
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
# redMine - project management software
|
||||||
|
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
require 'feeds_controller'
|
||||||
|
|
||||||
|
# Re-raise errors caught by the controller.
|
||||||
|
class FeedsController; def rescue_action(e) raise e end; end
|
||||||
|
|
||||||
|
class FeedsControllerTest < Test::Unit::TestCase
|
||||||
|
fixtures :projects, :users, :members, :roles
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@controller = FeedsController.new
|
||||||
|
@request = ActionController::TestRequest.new
|
||||||
|
@response = ActionController::TestResponse.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_news
|
||||||
|
get :news
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'news'
|
||||||
|
assert_not_nil assigns(:news)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_issues
|
||||||
|
get :issues
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'issues'
|
||||||
|
assert_not_nil assigns(:issues)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_history
|
||||||
|
get :history
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'history'
|
||||||
|
assert_not_nil assigns(:journals)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_project_privacy
|
||||||
|
get :news, :project_id => 2
|
||||||
|
assert_response 403
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_rss_key
|
||||||
|
user = User.find(2)
|
||||||
|
key = user.get_or_create_rss_key.value
|
||||||
|
|
||||||
|
get :news, :project_id => 2, :key => key
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
|
@ -85,4 +85,17 @@ class UserTest < Test::Unit::TestCase
|
||||||
user = User.try_to_login("jsmith", "jsmith")
|
user = User.try_to_login("jsmith", "jsmith")
|
||||||
assert_equal nil, user
|
assert_equal nil, user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_rss_key
|
||||||
|
assert_nil @jsmith.rss_key
|
||||||
|
key = @jsmith.get_or_create_rss_key
|
||||||
|
assert_kind_of Token, key
|
||||||
|
assert_equal 40, key.value.length
|
||||||
|
|
||||||
|
@jsmith.reload
|
||||||
|
assert_equal key.value, @jsmith.get_or_create_rss_key.value
|
||||||
|
|
||||||
|
@jsmith.reload
|
||||||
|
assert_equal key.value, @jsmith.rss_key.value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue