Description length limit

This commit is contained in:
Karel Picman 2017-03-23 13:39:21 +01:00
parent d3cd1435cf
commit a8eb0f8cc1
3 changed files with 34 additions and 0 deletions

View File

@ -72,6 +72,7 @@ class DmsfFolder < ActiveRecord::Base
validates_format_of :title, :with => INVALID_CHARACTERS, validates_format_of :title, :with => INVALID_CHARACTERS,
:message => l(:error_contains_invalid_character) :message => l(:error_contains_invalid_character)
validate :check_cycle validate :check_cycle
validates_length_of :description, :maximum => 65535
before_create :default_values before_create :default_values
def default_values def default_values

View File

@ -0,0 +1,31 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# 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
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class DmsfDescriptionLimit < ActiveRecord::Migration
def up
change_column :projects, :dmsf_description, :text, :null => true, :limit => 65535
change_column :dmsf_folders, :description, :text,:null => true, :limit => 65535
end
def down
change_column :projects, :dmsf_description, :text
change_column :dmsf_folders, :description, :text
end
end

View File

@ -46,6 +46,8 @@ module RedmineDmsf
:class_name => 'DmsfLink', :foreign_key => 'project_id', :dependent => :destroy :class_name => 'DmsfLink', :foreign_key => 'project_id', :dependent => :destroy
before_save :set_default_dmsf_notification before_save :set_default_dmsf_notification
validates_length_of :dmsf_description, :maximum => 65535
end end
end end