Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
7b23d3bd
Commit
7b23d3bd
authored
Apr 06, 2012
by
Francisco Juan
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'tags/v2.7.1'
parents
f1ff9c1a
9d32e68e
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
84 additions
and
45 deletions
+84
-45
documents_controller.rb
app/controllers/documents_controller.rb
+3
-2
issue_categories_controller.rb
app/controllers/issue_categories_controller.rb
+4
-2
members_controller.rb
app/controllers/members_controller.rb
+7
-5
messages_controller.rb
app/controllers/messages_controller.rb
+13
-16
news_controller.rb
app/controllers/news_controller.rb
+8
-9
projects_controller.rb
app/controllers/projects_controller.rb
+2
-1
timelog_controller.rb
app/controllers/timelog_controller.rb
+4
-4
versions_controller.rb
app/controllers/versions_controller.rb
+4
-3
wikis_controller.rb
app/controllers/wikis_controller.rb
+1
-1
document.rb
app/models/document.rb
+3
-0
issue_category.rb
app/models/issue_category.rb
+3
-0
message.rb
app/models/message.rb
+7
-0
news.rb
app/models/news.rb
+3
-0
time_entry.rb
app/models/time_entry.rb
+3
-0
user_preference.rb
app/models/user_preference.rb
+1
-1
version.rb
app/models/version.rb
+10
-0
wiki.rb
app/models/wiki.rb
+3
-0
CHANGELOG.rdoc
doc/CHANGELOG.rdoc
+4
-0
version.rb
lib/chili_project/version.rb
+1
-1
No files found.
app/controllers/documents_controller.rb
View file @
7b23d3bd
...
@@ -43,8 +43,9 @@ class DocumentsController < ApplicationController
...
@@ -43,8 +43,9 @@ class DocumentsController < ApplicationController
end
end
def
new
def
new
@document
=
@project
.
documents
.
build
(
params
[
:document
])
@document
=
@project
.
documents
.
build
if
request
.
post?
and
@document
.
save
@document
.
safe_attributes
=
params
[
:document
]
if
request
.
post?
&&
@document
.
save
attachments
=
Attachment
.
attach_files
(
@document
,
params
[
:attachments
])
attachments
=
Attachment
.
attach_files
(
@document
,
params
[
:attachments
])
render_attachment_warning_if_needed
(
@document
)
render_attachment_warning_if_needed
(
@document
)
flash
[
:notice
]
=
l
(
:notice_successful_create
)
flash
[
:notice
]
=
l
(
:notice_successful_create
)
...
...
app/controllers/issue_categories_controller.rb
View file @
7b23d3bd
...
@@ -23,7 +23,8 @@ class IssueCategoriesController < ApplicationController
...
@@ -23,7 +23,8 @@ class IssueCategoriesController < ApplicationController
verify
:method
=>
:post
,
:only
=>
:destroy
verify
:method
=>
:post
,
:only
=>
:destroy
def
new
def
new
@category
=
@project
.
issue_categories
.
build
(
params
[
:category
])
@category
=
@project
.
issue_categories
.
build
@category
.
safe_attributes
=
params
[
:category
]
if
request
.
post?
if
request
.
post?
if
@category
.
save
if
@category
.
save
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -50,7 +51,8 @@ class IssueCategoriesController < ApplicationController
...
@@ -50,7 +51,8 @@ class IssueCategoriesController < ApplicationController
end
end
def
edit
def
edit
if
request
.
post?
and
@category
.
update_attributes
(
params
[
:category
])
@category
.
safe_attributes
=
params
[
:category
]
if
request
.
post?
and
@category
.
save
flash
[
:notice
]
=
l
(
:notice_successful_update
)
flash
[
:notice
]
=
l
(
:notice_successful_update
)
redirect_to
:controller
=>
'projects'
,
:action
=>
'settings'
,
:tab
=>
'categories'
,
:id
=>
@project
redirect_to
:controller
=>
'projects'
,
:action
=>
'settings'
,
:tab
=>
'categories'
,
:id
=>
@project
end
end
...
...
app/controllers/members_controller.rb
View file @
7b23d3bd
...
@@ -21,17 +21,19 @@ class MembersController < ApplicationController
...
@@ -21,17 +21,19 @@ class MembersController < ApplicationController
def
new
def
new
members
=
[]
members
=
[]
if
params
[
:member
]
&&
request
.
post?
if
params
[
:member
]
attrs
=
params
[
:member
].
dup
if
params
[
:member
][
:user_ids
]
if
(
user_ids
=
attrs
.
delete
(
:user_ids
))
attrs
=
params
[
:member
].
dup
user_ids
=
attrs
.
delete
(
:user_ids
)
user_ids
.
each
do
|
user_id
|
user_ids
.
each
do
|
user_id
|
members
<<
Member
.
new
(
attrs
.
merge
(
:user_id
=>
user_id
)
)
members
<<
Member
.
new
(
:role_ids
=>
params
[
:member
][
:role_ids
],
:user_id
=>
user_id
)
end
end
else
else
members
<<
Member
.
new
(
attrs
)
members
<<
Member
.
new
(
:role_ids
=>
params
[
:member
][
:role_ids
],
:user_id
=>
params
[
:member
][
:user_id
]
)
end
end
@project
.
members
<<
members
@project
.
members
<<
members
end
end
respond_to
do
|
format
|
respond_to
do
|
format
|
if
members
.
present?
&&
members
.
all?
{
|
m
|
m
.
valid?
}
if
members
.
present?
&&
members
.
all?
{
|
m
|
m
.
valid?
}
...
...
app/controllers/messages_controller.rb
View file @
7b23d3bd
...
@@ -48,26 +48,26 @@ class MessagesController < ApplicationController
...
@@ -48,26 +48,26 @@ class MessagesController < ApplicationController
# Create a new topic
# Create a new topic
def
new
def
new
@message
=
Message
.
new
(
params
[
:message
])
@message
=
Message
.
new
@message
.
author
=
User
.
current
@message
.
author
=
User
.
current
@message
.
board
=
@board
@message
.
board
=
@board
if
params
[
:message
]
&&
User
.
current
.
allowed_to?
(
:edit_messages
,
@project
)
@message
.
safe_attributes
=
params
[
:message
]
@message
.
locked
=
params
[
:message
][
'locked'
]
if
request
.
post?
@message
.
sticky
=
params
[
:message
][
'sticky'
]
if
@message
.
save
end
call_hook
(
:controller_messages_new_after_save
,
{
:params
=>
params
,
:message
=>
@message
})
if
request
.
post?
&&
@message
.
save
attachments
=
Attachment
.
attach_files
(
@message
,
params
[
:attachments
])
call_hook
(
:controller_messages_new_after_save
,
{
:params
=>
params
,
:message
=>
@message
})
render_attachment_warning_if_needed
(
@message
)
attachments
=
Attachment
.
attach_files
(
@message
,
params
[
:attachments
])
redirect_to
:action
=>
'show'
,
:id
=>
@message
render_attachment_warning_if_needed
(
@message
)
end
redirect_to
:action
=>
'show'
,
:id
=>
@message
end
end
end
end
# Reply to a topic
# Reply to a topic
def
reply
def
reply
@reply
=
Message
.
new
(
params
[
:reply
])
@reply
=
Message
.
new
@reply
.
author
=
User
.
current
@reply
.
author
=
User
.
current
@reply
.
board
=
@board
@reply
.
board
=
@board
@reply
.
safe_attributes
=
params
[
:reply
]
@topic
.
children
<<
@reply
@topic
.
children
<<
@reply
if
!
@reply
.
new_record?
if
!
@reply
.
new_record?
call_hook
(
:controller_messages_reply_after_save
,
{
:params
=>
params
,
:message
=>
@reply
})
call_hook
(
:controller_messages_reply_after_save
,
{
:params
=>
params
,
:message
=>
@reply
})
...
@@ -80,11 +80,8 @@ class MessagesController < ApplicationController
...
@@ -80,11 +80,8 @@ class MessagesController < ApplicationController
# Edit a message
# Edit a message
def
edit
def
edit
(
render_403
;
return
false
)
unless
@message
.
editable_by?
(
User
.
current
)
(
render_403
;
return
false
)
unless
@message
.
editable_by?
(
User
.
current
)
if
params
[
:message
]
@message
.
safe_attributes
=
params
[
:message
]
@message
.
locked
=
params
[
:message
][
'locked'
]
if
request
.
post?
&&
@message
.
save
@message
.
sticky
=
params
[
:message
][
'sticky'
]
end
if
request
.
post?
&&
@message
.
update_attributes
(
params
[
:message
])
attachments
=
Attachment
.
attach_files
(
@message
,
params
[
:attachments
])
attachments
=
Attachment
.
attach_files
(
@message
,
params
[
:attachments
])
render_attachment_warning_if_needed
(
@message
)
render_attachment_warning_if_needed
(
@message
)
flash
[
:notice
]
=
l
(
:notice_successful_update
)
flash
[
:notice
]
=
l
(
:notice_successful_update
)
...
...
app/controllers/news_controller.rb
View file @
7b23d3bd
...
@@ -59,14 +59,12 @@ class NewsController < ApplicationController
...
@@ -59,14 +59,12 @@ class NewsController < ApplicationController
def
create
def
create
@news
=
News
.
new
(
:project
=>
@project
,
:author
=>
User
.
current
)
@news
=
News
.
new
(
:project
=>
@project
,
:author
=>
User
.
current
)
if
request
.
post?
@news
.
safe_attributes
=
params
[
:news
]
@news
.
attributes
=
params
[
:news
]
if
@news
.
save
if
@news
.
save
flash
[
:notice
]
=
l
(
:notice_successful_create
)
flash
[
:notice
]
=
l
(
:notice_successful_create
)
redirect_to
:controller
=>
'news'
,
:action
=>
'index'
,
:project_id
=>
@project
redirect_to
:controller
=>
'news'
,
:action
=>
'index'
,
:project_id
=>
@project
else
else
render
:action
=>
'new'
render
:action
=>
'new'
end
end
end
end
end
...
@@ -74,7 +72,8 @@ class NewsController < ApplicationController
...
@@ -74,7 +72,8 @@ class NewsController < ApplicationController
end
end
def
update
def
update
if
request
.
put?
and
@news
.
update_attributes
(
params
[
:news
])
@news
.
safe_attributes
=
params
[
:news
]
if
@news
.
save
flash
[
:notice
]
=
l
(
:notice_successful_update
)
flash
[
:notice
]
=
l
(
:notice_successful_update
)
redirect_to
:action
=>
'show'
,
:id
=>
@news
redirect_to
:action
=>
'show'
,
:id
=>
@news
else
else
...
...
app/controllers/projects_controller.rb
View file @
7b23d3bd
...
@@ -59,7 +59,8 @@ class ProjectsController < ApplicationController
...
@@ -59,7 +59,8 @@ class ProjectsController < ApplicationController
def
new
def
new
@issue_custom_fields
=
IssueCustomField
.
find
(
:all
,
:order
=>
"
#{
CustomField
.
table_name
}
.position"
)
@issue_custom_fields
=
IssueCustomField
.
find
(
:all
,
:order
=>
"
#{
CustomField
.
table_name
}
.position"
)
@trackers
=
Tracker
.
all
@trackers
=
Tracker
.
all
@project
=
Project
.
new
(
params
[
:project
])
@project
=
Project
.
new
@project
.
safe_attributes
=
params
[
:project
]
end
end
verify
:method
=>
:post
,
:only
=>
:create
,
:render
=>
{
:nothing
=>
true
,
:status
=>
:method_not_allowed
}
verify
:method
=>
:post
,
:only
=>
:create
,
:render
=>
{
:nothing
=>
true
,
:status
=>
:method_not_allowed
}
...
...
app/controllers/timelog_controller.rb
View file @
7b23d3bd
...
@@ -97,7 +97,7 @@ class TimelogController < ApplicationController
...
@@ -97,7 +97,7 @@ class TimelogController < ApplicationController
def
new
def
new
@time_entry
||=
TimeEntry
.
new
(
:project
=>
@project
,
:issue
=>
@issue
,
:user
=>
User
.
current
,
:spent_on
=>
User
.
current
.
today
)
@time_entry
||=
TimeEntry
.
new
(
:project
=>
@project
,
:issue
=>
@issue
,
:user
=>
User
.
current
,
:spent_on
=>
User
.
current
.
today
)
@time_entry
.
attributes
=
params
[
:time_entry
]
@time_entry
.
safe_
attributes
=
params
[
:time_entry
]
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
render
:action
=>
'edit'
render
:action
=>
'edit'
...
@@ -106,7 +106,7 @@ class TimelogController < ApplicationController
...
@@ -106,7 +106,7 @@ class TimelogController < ApplicationController
verify
:method
=>
:post
,
:only
=>
:create
,
:render
=>
{
:nothing
=>
true
,
:status
=>
:method_not_allowed
}
verify
:method
=>
:post
,
:only
=>
:create
,
:render
=>
{
:nothing
=>
true
,
:status
=>
:method_not_allowed
}
def
create
def
create
@time_entry
||=
TimeEntry
.
new
(
:project
=>
@project
,
:issue
=>
@issue
,
:user
=>
User
.
current
,
:spent_on
=>
User
.
current
.
today
)
@time_entry
||=
TimeEntry
.
new
(
:project
=>
@project
,
:issue
=>
@issue
,
:user
=>
User
.
current
,
:spent_on
=>
User
.
current
.
today
)
@time_entry
.
attributes
=
params
[
:time_entry
]
@time_entry
.
safe_
attributes
=
params
[
:time_entry
]
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
...
@@ -127,14 +127,14 @@ class TimelogController < ApplicationController
...
@@ -127,14 +127,14 @@ class TimelogController < ApplicationController
end
end
def
edit
def
edit
@time_entry
.
attributes
=
params
[
:time_entry
]
@time_entry
.
safe_
attributes
=
params
[
:time_entry
]
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
end
end
verify
:method
=>
:put
,
:only
=>
:update
,
:render
=>
{
:nothing
=>
true
,
:status
=>
:method_not_allowed
}
verify
:method
=>
:put
,
:only
=>
:update
,
:render
=>
{
:nothing
=>
true
,
:status
=>
:method_not_allowed
}
def
update
def
update
@time_entry
.
attributes
=
params
[
:time_entry
]
@time_entry
.
safe_
attributes
=
params
[
:time_entry
]
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
call_hook
(
:controller_timelog_edit_before_save
,
{
:params
=>
params
,
:time_entry
=>
@time_entry
})
...
...
app/controllers/versions_controller.rb
View file @
7b23d3bd
...
@@ -56,7 +56,7 @@ class VersionsController < ApplicationController
...
@@ -56,7 +56,7 @@ class VersionsController < ApplicationController
if
params
[
:version
]
if
params
[
:version
]
attributes
=
params
[
:version
].
dup
attributes
=
params
[
:version
].
dup
attributes
.
delete
(
'sharing'
)
unless
attributes
.
nil?
||
@version
.
allowed_sharings
.
include?
(
attributes
[
'sharing'
])
attributes
.
delete
(
'sharing'
)
unless
attributes
.
nil?
||
@version
.
allowed_sharings
.
include?
(
attributes
[
'sharing'
])
@version
.
attributes
=
attributes
@version
.
safe_
attributes
=
attributes
end
end
end
end
...
@@ -66,7 +66,7 @@ class VersionsController < ApplicationController
...
@@ -66,7 +66,7 @@ class VersionsController < ApplicationController
if
params
[
:version
]
if
params
[
:version
]
attributes
=
params
[
:version
].
dup
attributes
=
params
[
:version
].
dup
attributes
.
delete
(
'sharing'
)
unless
attributes
.
nil?
||
@version
.
allowed_sharings
.
include?
(
attributes
[
'sharing'
])
attributes
.
delete
(
'sharing'
)
unless
attributes
.
nil?
||
@version
.
allowed_sharings
.
include?
(
attributes
[
'sharing'
])
@version
.
attributes
=
attributes
@version
.
safe_
attributes
=
attributes
end
end
if
request
.
post?
if
request
.
post?
...
@@ -101,7 +101,8 @@ class VersionsController < ApplicationController
...
@@ -101,7 +101,8 @@ class VersionsController < ApplicationController
if
request
.
put?
&&
params
[
:version
]
if
request
.
put?
&&
params
[
:version
]
attributes
=
params
[
:version
].
dup
attributes
=
params
[
:version
].
dup
attributes
.
delete
(
'sharing'
)
unless
@version
.
allowed_sharings
.
include?
(
attributes
[
'sharing'
])
attributes
.
delete
(
'sharing'
)
unless
@version
.
allowed_sharings
.
include?
(
attributes
[
'sharing'
])
if
@version
.
update_attributes
(
attributes
)
@version
.
safe_attributes
=
attributes
if
@version
.
save
flash
[
:notice
]
=
l
(
:notice_successful_update
)
flash
[
:notice
]
=
l
(
:notice_successful_update
)
redirect_to
:controller
=>
'projects'
,
:action
=>
'settings'
,
:tab
=>
'versions'
,
:id
=>
@project
redirect_to
:controller
=>
'projects'
,
:action
=>
'settings'
,
:tab
=>
'versions'
,
:id
=>
@project
else
else
...
...
app/controllers/wikis_controller.rb
View file @
7b23d3bd
...
@@ -19,7 +19,7 @@ class WikisController < ApplicationController
...
@@ -19,7 +19,7 @@ class WikisController < ApplicationController
# Create or update a project's wiki
# Create or update a project's wiki
def
edit
def
edit
@wiki
=
@project
.
wiki
||
Wiki
.
new
(
:project
=>
@project
)
@wiki
=
@project
.
wiki
||
Wiki
.
new
(
:project
=>
@project
)
@wiki
.
attributes
=
params
[
:wiki
]
@wiki
.
safe_
attributes
=
params
[
:wiki
]
@wiki
.
save
if
request
.
post?
@wiki
.
save
if
request
.
post?
render
(
:update
)
{
|
page
|
page
.
replace_html
"tab-content-wiki"
,
:partial
=>
'projects/settings/wiki'
}
render
(
:update
)
{
|
page
|
page
.
replace_html
"tab-content-wiki"
,
:partial
=>
'projects/settings/wiki'
}
end
end
...
...
app/models/document.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
Document
<
ActiveRecord
::
Base
class
Document
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
belongs_to
:project
belongs_to
:project
belongs_to
:category
,
:class_name
=>
"DocumentCategory"
,
:foreign_key
=>
"category_id"
belongs_to
:category
,
:class_name
=>
"DocumentCategory"
,
:foreign_key
=>
"category_id"
acts_as_attachable
:delete_permission
=>
:manage_documents
acts_as_attachable
:delete_permission
=>
:manage_documents
...
@@ -31,6 +32,8 @@ class Document < ActiveRecord::Base
...
@@ -31,6 +32,8 @@ class Document < ActiveRecord::Base
named_scope
:visible
,
lambda
{
|*
args
|
{
:include
=>
:project
,
named_scope
:visible
,
lambda
{
|*
args
|
{
:include
=>
:project
,
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_documents
)
}
}
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_documents
)
}
}
safe_attributes
'category_id'
,
'title'
,
'description'
def
visible?
(
user
=
User
.
current
)
def
visible?
(
user
=
User
.
current
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_documents
,
project
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_documents
,
project
)
end
end
...
...
app/models/issue_category.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
IssueCategory
<
ActiveRecord
::
Base
class
IssueCategory
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
belongs_to
:project
belongs_to
:project
belongs_to
:assigned_to
,
:class_name
=>
'User'
,
:foreign_key
=>
'assigned_to_id'
belongs_to
:assigned_to
,
:class_name
=>
'User'
,
:foreign_key
=>
'assigned_to_id'
has_many
:issues
,
:foreign_key
=>
'category_id'
,
:dependent
=>
:nullify
has_many
:issues
,
:foreign_key
=>
'category_id'
,
:dependent
=>
:nullify
...
@@ -21,6 +22,8 @@ class IssueCategory < ActiveRecord::Base
...
@@ -21,6 +22,8 @@ class IssueCategory < ActiveRecord::Base
validates_uniqueness_of
:name
,
:scope
=>
[
:project_id
]
validates_uniqueness_of
:name
,
:scope
=>
[
:project_id
]
validates_length_of
:name
,
:maximum
=>
30
validates_length_of
:name
,
:maximum
=>
30
safe_attributes
'name'
,
'assigned_to_id'
alias
:destroy_without_reassign
:destroy
alias
:destroy_without_reassign
:destroy
# Destroy the category
# Destroy the category
...
...
app/models/message.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
Message
<
ActiveRecord
::
Base
class
Message
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
belongs_to
:board
belongs_to
:board
belongs_to
:author
,
:class_name
=>
'User'
,
:foreign_key
=>
'author_id'
belongs_to
:author
,
:class_name
=>
'User'
,
:foreign_key
=>
'author_id'
acts_as_tree
:counter_cache
=>
:replies_count
,
:order
=>
"
#{
Message
.
table_name
}
.created_on ASC"
acts_as_tree
:counter_cache
=>
:replies_count
,
:order
=>
"
#{
Message
.
table_name
}
.created_on ASC"
...
@@ -49,6 +50,12 @@ class Message < ActiveRecord::Base
...
@@ -49,6 +50,12 @@ class Message < ActiveRecord::Base
named_scope
:visible
,
lambda
{
|*
args
|
{
:include
=>
{
:board
=>
:project
},
named_scope
:visible
,
lambda
{
|*
args
|
{
:include
=>
{
:board
=>
:project
},
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_messages
)
}
}
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_messages
)
}
}
safe_attributes
'subject'
,
'content'
safe_attributes
'locked'
,
'sticky'
,
:if
=>
lambda
{
|
message
,
user
|
user
.
allowed_to?
(
:edit_messages
,
message
.
project
)
}
def
visible?
(
user
=
User
.
current
)
def
visible?
(
user
=
User
.
current
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_messages
,
project
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_messages
,
project
)
end
end
...
...
app/models/news.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
News
<
ActiveRecord
::
Base
class
News
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
belongs_to
:project
belongs_to
:project
belongs_to
:author
,
:class_name
=>
'User'
,
:foreign_key
=>
'author_id'
belongs_to
:author
,
:class_name
=>
'User'
,
:foreign_key
=>
'author_id'
has_many
:comments
,
:as
=>
:commented
,
:dependent
=>
:delete_all
,
:order
=>
"created_on"
has_many
:comments
,
:as
=>
:commented
,
:dependent
=>
:delete_all
,
:order
=>
"created_on"
...
@@ -32,6 +33,8 @@ class News < ActiveRecord::Base
...
@@ -32,6 +33,8 @@ class News < ActiveRecord::Base
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_news
)
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_news
)
}}
}}
safe_attributes
'title'
,
'summary'
,
'description'
def
visible?
(
user
=
User
.
current
)
def
visible?
(
user
=
User
.
current
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_news
,
project
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_news
,
project
)
end
end
...
...
app/models/time_entry.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
TimeEntry
<
ActiveRecord
::
Base
class
TimeEntry
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
# could have used polymorphic association
# could have used polymorphic association
# project association here allows easy loading of time entries at project level with one database trip
# project association here allows easy loading of time entries at project level with one database trip
belongs_to
:project
belongs_to
:project
...
@@ -37,6 +38,8 @@ class TimeEntry < ActiveRecord::Base
...
@@ -37,6 +38,8 @@ class TimeEntry < ActiveRecord::Base
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_time_entries
)
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_time_entries
)
}}
}}
safe_attributes
'hours'
,
'comments'
,
'issue_id'
,
'activity_id'
,
'spent_on'
,
'custom_field_values'
def
after_initialize
def
after_initialize
if
new_record?
&&
self
.
activity
.
nil?
if
new_record?
&&
self
.
activity
.
nil?
if
default_activity
=
TimeEntryActivity
.
default
if
default_activity
=
TimeEntryActivity
.
default
...
...
app/models/user_preference.rb
View file @
7b23d3bd
...
@@ -16,7 +16,7 @@ class UserPreference < ActiveRecord::Base
...
@@ -16,7 +16,7 @@ class UserPreference < ActiveRecord::Base
belongs_to
:user
belongs_to
:user
serialize
:others
serialize
:others
attr_protected
:others
attr_protected
:others
,
:user_id
def
initialize
(
attributes
=
nil
)
def
initialize
(
attributes
=
nil
)
super
super
...
...
app/models/version.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
Version
<
ActiveRecord
::
Base
class
Version
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
after_update
:update_issues_from_sharing_change
after_update
:update_issues_from_sharing_change
belongs_to
:project
belongs_to
:project
has_many
:fixed_issues
,
:class_name
=>
'Issue'
,
:foreign_key
=>
'fixed_version_id'
,
:dependent
=>
:nullify
has_many
:fixed_issues
,
:class_name
=>
'Issue'
,
:foreign_key
=>
'fixed_version_id'
,
:dependent
=>
:nullify
...
@@ -34,6 +35,15 @@ class Version < ActiveRecord::Base
...
@@ -34,6 +35,15 @@ class Version < ActiveRecord::Base
named_scope
:visible
,
lambda
{
|*
args
|
{
:include
=>
:project
,
named_scope
:visible
,
lambda
{
|*
args
|
{
:include
=>
:project
,
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_issues
)
}
}
:conditions
=>
Project
.
allowed_to_condition
(
args
.
first
||
User
.
current
,
:view_issues
)
}
}
safe_attributes
'name'
,
'description'
,
'effective_date'
,
'due_date'
,
'wiki_page_title'
,
'status'
,
'sharing'
,
'custom_field_values'
# Returns true if +user+ or current user is allowed to view the version
# Returns true if +user+ or current user is allowed to view the version
def
visible?
(
user
=
User
.
current
)
def
visible?
(
user
=
User
.
current
)
user
.
allowed_to?
(
:view_issues
,
self
.
project
)
user
.
allowed_to?
(
:view_issues
,
self
.
project
)
...
...
app/models/wiki.rb
View file @
7b23d3bd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#++
#++
class
Wiki
<
ActiveRecord
::
Base
class
Wiki
<
ActiveRecord
::
Base
include
Redmine
::
SafeAttributes
belongs_to
:project
belongs_to
:project
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
...
@@ -22,6 +23,8 @@ class Wiki < ActiveRecord::Base
...
@@ -22,6 +23,8 @@ class Wiki < ActiveRecord::Base
validates_presence_of
:start_page
validates_presence_of
:start_page
validates_format_of
:start_page
,
:with
=>
/^[^,\.\/\?\;\|\:]*$/
validates_format_of
:start_page
,
:with
=>
/^[^,\.\/\?\;\|\:]*$/
safe_attributes
'start_page'
def
visible?
(
user
=
User
.
current
)
def
visible?
(
user
=
User
.
current
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_wiki_pages
,
project
)
!
user
.
nil?
&&
user
.
allowed_to?
(
:view_wiki_pages
,
project
)
end
end
...
...
doc/CHANGELOG.rdoc
View file @
7b23d3bd
= ChiliProject changelog
= ChiliProject changelog
== 2012-04-04 v2.7.1
* Bug #922: Mass assignment
== 2012-02-06 v2.7.0
== 2012-02-06 v2.7.0
* Bug #593: Notification Mail for Wiki-Changes has wrong Diff
* Bug #593: Notification Mail for Wiki-Changes has wrong Diff
...
...
lib/chili_project/version.rb
View file @
7b23d3bd
...
@@ -19,7 +19,7 @@ module ChiliProject
...
@@ -19,7 +19,7 @@ module ChiliProject
MAJOR
=
2
MAJOR
=
2
MINOR
=
7
MINOR
=
7
PATCH
=
0
PATCH
=
1
TINY
=
PATCH
# Redmine compat
TINY
=
PATCH
# Redmine compat
# Used by semver to define the special version (if any).
# Used by semver to define the special version (if any).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment