Skip to content

Commit

Permalink
#1534 Comment column formating
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Jul 11, 2024
1 parent 01a6fd0 commit bcc1535
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app/helpers/dmsf_queries_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def column_value(column, item, value)
else
super column, item, value
end
when :comment
value.present? ? content_tag('div', textilizable(value), class: 'wiki') : ''
else
super column, item, value
end
Expand Down
22 changes: 15 additions & 7 deletions test/helpers/dmsf_queries_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,32 @@
# Queries helper
class DmsfQueriesHelperTest < RedmineDmsf::Test::HelperTest
include DmsfQueriesHelper
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::TagHelper

fixtures :dmsf_folders
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions

def setup
@folder1 = DmsfFolder.find 1
super
end

def test_csv_value
c_size = QueryColumn.new(:size)
c_author = QueryColumn.new(:author)
assert_equal '1 KB', csv_value(c_size, nil, 1024)
assert_equal 'John Smith', csv_value(c_author, @jsmith, @jsmith.id)
# Size
column = QueryColumn.new(:size)
assert_equal '1 KB', csv_value(column, nil, 1024)
# Author
column = QueryColumn.new(:author)
assert_equal 'John Smith', csv_value(column, @jsmith, @jsmith.id)
end

def test_column_value
c_size = QueryColumn.new(:size)
assert_equal '1 KB', csv_value(c_size, @folder1, 1024)
# Size
column = QueryColumn.new(:size)
assert_equal '1 KB', column_value(column, @folder1, 1024)
# Comment
column = QueryColumn.new(:comment)
assert column_value(column, @folder1, '*Comment*').include?('wiki')
end

def test_previewable
Expand Down

0 comments on commit bcc1535

Please sign in to comment.