parent
a1a4dc8a67
commit
3159d3c893
@ -315,6 +315,9 @@ class DmsfFolder < ActiveRecord::Base
|
||||
# 1 - id
|
||||
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('id')
|
||||
pos += 1
|
||||
return pos if column == 'id'
|
||||
else
|
||||
return nil if column == 'id'
|
||||
end
|
||||
# 2 - title
|
||||
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('title')
|
||||
@ -326,6 +329,9 @@ class DmsfFolder < ActiveRecord::Base
|
||||
# 3 - extension
|
||||
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('extension')
|
||||
pos += 1
|
||||
return pos if column == 'extension'
|
||||
else
|
||||
return nil if column == 'extension'
|
||||
end
|
||||
# 4 - size
|
||||
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('size')
|
||||
@ -351,10 +357,16 @@ class DmsfFolder < ActiveRecord::Base
|
||||
# 7 - workflow
|
||||
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('workflow')
|
||||
pos += 1
|
||||
return pos if column == 'workflow'
|
||||
else
|
||||
return nil if column == 'workflow'
|
||||
end
|
||||
# 8 - author
|
||||
if Setting.plugin_redmine_dmsf['dmsf_columns'].include?('author')
|
||||
pos += 1
|
||||
return pos if column == 'author'
|
||||
else
|
||||
return nil if column == 'author'
|
||||
end
|
||||
# 9 - custom fields
|
||||
cfs = CustomField.where(:type => 'DmsfFileRevisionCustomField')
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
|
||||
# Copyright (C) 2011-17 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -22,8 +22,7 @@
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
class DmsfFolderTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :projects, :users, :email_addresses, :dmsf_folders, :roles,
|
||||
:members, :member_roles
|
||||
fixtures :projects, :users, :email_addresses, :dmsf_folders, :roles, :members, :member_roles
|
||||
|
||||
def setup
|
||||
@folder6 = DmsfFolder.find_by_id 6
|
||||
@ -49,5 +48,53 @@ class DmsfFolderTest < RedmineDmsf::Test::UnitTest
|
||||
@folder6.delete true
|
||||
assert_nil DmsfFolder.find_by_id(@folder6.id)
|
||||
end
|
||||
|
||||
def test_is_column_on_default
|
||||
DmsfFolder::DEFAULT_COLUMNS.each do |column|
|
||||
assert DmsfFolder.is_column_on?(column), "The column #{column} is not on?"
|
||||
end
|
||||
end
|
||||
|
||||
def test_is_column_on_available
|
||||
(DmsfFolder::AVAILABLE_COLUMNS - DmsfFolder::DEFAULT_COLUMNS).each do |column|
|
||||
assert !DmsfFolder.is_column_on?(column), "The column #{column} is on?"
|
||||
end
|
||||
end
|
||||
|
||||
def test_get_column_position_default
|
||||
# 0 - checkbox
|
||||
assert_nil DmsfFolder.get_column_position('checkbox'), "The column 'checkbox' is on?"
|
||||
# 1 - id
|
||||
assert_nil DmsfFolder.get_column_position('id'), "The column 'id' is on?"
|
||||
# 2 - title
|
||||
assert_equal DmsfFolder.get_column_position('title'), 1, "The expected position of the 'title' column is 2"
|
||||
# 3 - extension
|
||||
assert_nil DmsfFolder.get_column_position('extensions'), "The column 'extensions' is on?"
|
||||
# 4 - size
|
||||
assert_equal DmsfFolder.get_column_position('size'), 2, "The expected position of the 'size' column is 4"
|
||||
# 5 - modified
|
||||
assert_equal DmsfFolder.get_column_position('modified'), 3, "The expected position of the 'modified' column is 5"
|
||||
# 6 - version
|
||||
assert_equal DmsfFolder.get_column_position('version'), 4, "The expected position of the 'version' column is 6"
|
||||
# 7 - workflow
|
||||
assert_equal DmsfFolder.get_column_position('workflow'), 5, "The expected position of the 'workflow' column is 7"
|
||||
# 8 - author
|
||||
assert_equal DmsfFolder.get_column_position('author'), 6, "The expected position of the 'workflow' column is 8"
|
||||
# 9 - custom fields
|
||||
assert_nil DmsfFolder.get_column_position('Tag'), "The column 'Tag' is on?"
|
||||
# 10- commands
|
||||
assert_equal DmsfFolder.get_column_position('commands'), 7, "The expected position of the 'commands' column is 10"
|
||||
# 11- (position)
|
||||
assert_equal DmsfFolder.get_column_position('position'), 8, "The expected position of the 'position' column is 11"
|
||||
# 12- (size)
|
||||
assert_equal DmsfFolder.get_column_position('size_calculated'), 9,
|
||||
"The expected position of the 'size_calculated' column is 12"
|
||||
# 13- (modified)
|
||||
assert_equal DmsfFolder.get_column_position('modified_calculated'), 10,
|
||||
"The expected position of the 'modified_calculated' column is 13"
|
||||
# 14- (version)
|
||||
assert_equal DmsfFolder.get_column_position('version_calculated'), 11,
|
||||
"The expected position of the 'version_calculated' column is 14"
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user