mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-20 15:31:12 +00:00
Merged r1399, r1403, r1405 and r1406 from trunk.
git-svn-id: http://redmine.rubyforge.org/svn/branches/0.7-stable@1407 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
914d1e6645
commit
8bc721c264
@ -87,7 +87,7 @@ class ProjectsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
@custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position")
|
@custom_values = @project.custom_values.find(:all, :include => :custom_field, :order => "#{CustomField.table_name}.position")
|
||||||
@members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
@members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
|
||||||
@subprojects = @project.active_children
|
@subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current))
|
||||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||||||
@trackers = @project.rolled_up_trackers
|
@trackers = @project.rolled_up_trackers
|
||||||
|
|
||||||
|
|||||||
@ -1134,7 +1134,7 @@ class RedCloth < String
|
|||||||
ALLOWED_TAGS = %w(redpre pre code)
|
ALLOWED_TAGS = %w(redpre pre code)
|
||||||
|
|
||||||
def escape_html_tags(text)
|
def escape_html_tags(text)
|
||||||
text.gsub!(%r{<(\/?(\w+)[^>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' if $3}" }
|
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ module Redmine
|
|||||||
content = @pre_list[$1.to_i]
|
content = @pre_list[$1.to_i]
|
||||||
if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
|
if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
|
||||||
content = "<code class=\"#{$1} CodeRay\">" +
|
content = "<code class=\"#{$1} CodeRay\">" +
|
||||||
CodeRay.scan($2, $1).html(:escape => false, :line_numbers => :inline)
|
CodeRay.scan($2, $1.downcase).html(:escape => false, :line_numbers => :inline)
|
||||||
end
|
end
|
||||||
content
|
content
|
||||||
end
|
end
|
||||||
|
|||||||
@ -92,7 +92,7 @@ namespace :redmine do
|
|||||||
set_table_name :milestone
|
set_table_name :milestone
|
||||||
|
|
||||||
def due
|
def due
|
||||||
if read_attribute(:due) > 0
|
if read_attribute(:due) && read_attribute(:due) > 0
|
||||||
Time.at(read_attribute(:due)).to_date
|
Time.at(read_attribute(:due)).to_date
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
|||||||
6
test/fixtures/members.yml
vendored
6
test/fixtures/members.yml
vendored
@ -24,4 +24,10 @@ members_004:
|
|||||||
role_id: 2
|
role_id: 2
|
||||||
# Locked user
|
# Locked user
|
||||||
user_id: 5
|
user_id: 5
|
||||||
|
members_005:
|
||||||
|
id: 5
|
||||||
|
created_on: 2006-07-19 19:35:33 +02:00
|
||||||
|
project_id: 5
|
||||||
|
role_id: 1
|
||||||
|
user_id: 2
|
||||||
|
|
||||||
14
test/fixtures/projects.yml
vendored
14
test/fixtures/projects.yml
vendored
@ -3,7 +3,7 @@ projects_001:
|
|||||||
created_on: 2006-07-19 19:13:59 +02:00
|
created_on: 2006-07-19 19:13:59 +02:00
|
||||||
name: eCookbook
|
name: eCookbook
|
||||||
updated_on: 2006-07-19 22:53:01 +02:00
|
updated_on: 2006-07-19 22:53:01 +02:00
|
||||||
projects_count: 2
|
projects_count: 3
|
||||||
id: 1
|
id: 1
|
||||||
description: Recipes management application
|
description: Recipes management application
|
||||||
homepage: http://ecookbook.somenet.foo/
|
homepage: http://ecookbook.somenet.foo/
|
||||||
@ -43,3 +43,15 @@ projects_004:
|
|||||||
is_public: true
|
is_public: true
|
||||||
identifier: subproject2
|
identifier: subproject2
|
||||||
parent_id: 1
|
parent_id: 1
|
||||||
|
projects_005:
|
||||||
|
created_on: 2006-07-19 19:15:51 +02:00
|
||||||
|
name: Private child of eCookbook
|
||||||
|
updated_on: 2006-07-19 19:17:07 +02:00
|
||||||
|
projects_count: 0
|
||||||
|
id: 5
|
||||||
|
description: This is a private subproject of a public project
|
||||||
|
homepage: ""
|
||||||
|
is_public: false
|
||||||
|
identifier: private_child
|
||||||
|
parent_id: 1
|
||||||
|
|
||||||
@ -63,6 +63,21 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
|||||||
assert_equal Project.find_by_identifier('ecookbook'), assigns(:project)
|
assert_equal Project.find_by_identifier('ecookbook'), assigns(:project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_private_subprojects_hidden
|
||||||
|
get :show, :id => 'ecookbook'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'show'
|
||||||
|
assert_no_tag :tag => 'a', :content => /Private child/
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_private_subprojects_visible
|
||||||
|
@request.session[:user_id] = 2 # manager who is a member of the private subproject
|
||||||
|
get :show, :id => 'ecookbook'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'show'
|
||||||
|
assert_tag :tag => 'a', :content => /Private child/
|
||||||
|
end
|
||||||
|
|
||||||
def test_settings
|
def test_settings
|
||||||
@request.session[:user_id] = 2 # manager
|
@request.session[:user_id] = 2 # manager
|
||||||
get :settings, :id => 1
|
get :settings, :id => 1
|
||||||
|
|||||||
@ -141,6 +141,8 @@ class ApplicationHelperTest < HelperTestCase
|
|||||||
"<pre>\nline 1\nline2</pre>" => "<pre>\nline 1\nline2</pre>",
|
"<pre>\nline 1\nline2</pre>" => "<pre>\nline 1\nline2</pre>",
|
||||||
"<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>",
|
"<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>",
|
||||||
"<pre><div>content</div></pre>" => "<pre><div>content</div></pre>",
|
"<pre><div>content</div></pre>" => "<pre><div>content</div></pre>",
|
||||||
|
"HTML comment: <!-- no comments -->" => "<p>HTML comment: <!-- no comments --></p>",
|
||||||
|
"<!-- opening comment" => "<p><!-- opening comment</p>"
|
||||||
}
|
}
|
||||||
to_test.each { |text, result| assert_equal result, textilizable(text) }
|
to_test.each { |text, result| assert_equal result, textilizable(text) }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -101,7 +101,7 @@ class ProjectTest < Test::Unit::TestCase
|
|||||||
assert sub.save
|
assert sub.save
|
||||||
assert_equal @ecookbook.id, sub.parent.id
|
assert_equal @ecookbook.id, sub.parent.id
|
||||||
@ecookbook.reload
|
@ecookbook.reload
|
||||||
assert_equal 3, @ecookbook.children.size
|
assert_equal 4, @ecookbook.children.size
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_subproject_invalid
|
def test_subproject_invalid
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user