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
dd6d9d1c
Commit
dd6d9d1c
authored
Jul 12, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#513] Fix links to attachments in the issue history
parent
df0c75c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
issues_test.rb
test/integration/issues_test.rb
+7
-0
journal_formatter.rb
vendor/plugins/acts_as_journalized/lib/journal_formatter.rb
+11
-3
No files found.
test/integration/issues_test.rb
View file @
dd6d9d1c
...
@@ -68,6 +68,7 @@ class IssuesTest < ActionController::IntegrationTest
...
@@ -68,6 +68,7 @@ class IssuesTest < ActionController::IntegrationTest
:notes
=>
'Some notes'
,
:notes
=>
'Some notes'
,
:attachments
=>
{
'1'
=>
{
'file'
=>
uploaded_test_file
(
'testfile.txt'
,
'text/plain'
),
'description'
=>
'This is an attachment'
}}
:attachments
=>
{
'1'
=>
{
'file'
=>
uploaded_test_file
(
'testfile.txt'
,
'text/plain'
),
'description'
=>
'This is an attachment'
}}
assert_redirected_to
"/issues/1"
assert_redirected_to
"/issues/1"
follow_redirect!
# make sure attachment was saved
# make sure attachment was saved
attachment
=
Issue
.
find
(
1
).
attachments
.
find_by_filename
(
"testfile.txt"
)
attachment
=
Issue
.
find
(
1
).
attachments
.
find_by_filename
(
"testfile.txt"
)
...
@@ -79,6 +80,12 @@ class IssuesTest < ActionController::IntegrationTest
...
@@ -79,6 +80,12 @@ class IssuesTest < ActionController::IntegrationTest
# verify that the attachment was written to disk
# verify that the attachment was written to disk
assert
File
.
exist?
(
attachment
.
diskfile
)
assert
File
.
exist?
(
attachment
.
diskfile
)
assert_select
"#history"
do
assert_select
".journal .details"
do
assert_select
"a"
,
:text
=>
/testfile.txt/
end
end
# remove the attachments
# remove the attachments
Issue
.
find
(
1
).
attachments
.
each
(
&
:destroy
)
Issue
.
find
(
1
).
attachments
.
each
(
&
:destroy
)
assert_equal
0
,
Issue
.
find
(
1
).
attachments
.
length
assert_equal
0
,
Issue
.
find
(
1
).
attachments
.
length
...
...
vendor/plugins/acts_as_journalized/lib/journal_formatter.rb
View file @
dd6d9d1c
...
@@ -27,8 +27,18 @@ module JournalFormatter
...
@@ -27,8 +27,18 @@ module JournalFormatter
include
CustomFieldsHelper
include
CustomFieldsHelper
include
ActionView
::
Helpers
::
TagHelper
include
ActionView
::
Helpers
::
TagHelper
include
ActionView
::
Helpers
::
UrlHelper
include
ActionView
::
Helpers
::
UrlHelper
include
ActionController
::
UrlWriter
extend
Redmine
::
I18n
extend
Redmine
::
I18n
def
self
.
included
(
base
)
base
.
class_eval
do
# Required to use any link_to in the formatters
def
self
.
default_url_options
{
:only_path
=>
true
}
end
end
end
def
self
.
register
(
hash
)
def
self
.
register
(
hash
)
if
hash
[
:class
]
if
hash
[
:class
]
klazz
=
hash
.
delete
(
:class
)
klazz
=
hash
.
delete
(
:class
)
...
@@ -90,9 +100,7 @@ module JournalFormatter
...
@@ -90,9 +100,7 @@ module JournalFormatter
def
format_html_attachment_detail
(
key
,
value
)
def
format_html_attachment_detail
(
key
,
value
)
if
!
value
.
blank?
&&
a
=
Attachment
.
find_by_id
(
key
.
to_i
)
if
!
value
.
blank?
&&
a
=
Attachment
.
find_by_id
(
key
.
to_i
)
# Link to the attachment if it has not been removed
link_to_attachment
(
a
)
# FIXME: this is broken => link_to_attachment(a)
a
.
filename
else
else
content_tag
(
"i"
,
h
(
value
))
if
value
.
present?
content_tag
(
"i"
,
h
(
value
))
if
value
.
present?
end
end
...
...
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