Project

General

Profile

Feature #27097 ยป 27097-raise_key_value_list_name_limit.patch

Go MAEDA, 2026-09-20 10:39

View differences:

app/models/custom_field_enumeration.rb
21 21
  belongs_to :custom_field
22 22

  
23 23
  validates_presence_of :name, :position, :custom_field_id
24
  validates_length_of :name, :maximum => 60
24
  validates_length_of :name, :maximum => 255
25 25
  validates_numericality_of :position, :only_integer => true
26 26
  before_create :set_position
27 27

  
app/views/custom_field_enumerations/index.html.erb
8 8
    <li>
9 9
      <%= tag.span(sprite_icon('reorder', ''), :class => 'icon-only icon-sort-handle sort-handle', :title => l(:button_move)) %>
10 10
      <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position, :class => 'position' %>
11
      <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40 %>
11
      <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40, :maxlength => 255 %>
12 12
      <%= hidden_field_tag "custom_field_enumerations[#{value.id}][active]", 0 %>
13 13
      <label>
14 14
        <%= check_box_tag "custom_field_enumerations[#{value.id}][active]", 1, value.active? %>
......
29 29
<%= form_tag custom_field_enumerations_path(@custom_field), :method => 'post', :remote => true, id: 'add-element' do %>
30 30
  <p><%= l(:label_enumeration_new) %></p>
31 31

  
32
  <p><%= text_field_tag 'custom_field_enumeration[name]', '', :size => 40 %>
32
  <p><%= text_field_tag 'custom_field_enumeration[name]', '', :size => 40, :maxlength => 255 %>
33 33
  <%= submit_tag(l(:button_add)) %></p>
34 34
<% end %>
35 35

  
test/unit/custom_field_enumeration_test.rb
1
# frozen_string_literal: true
2

  
3
# Redmine - project management software
4
# Copyright (C) 2006-  Jean-Philippe Lang
5
#
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; either version 2
9
# of the License, or (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19

  
20
require_relative '../test_helper'
21

  
22
class CustomFieldEnumerationTest < ActiveSupport::TestCase
23
  def setup
24
    User.current = nil
25
    @field = IssueCustomField.create!(:name => 'List', :field_format => 'enumeration', :is_required => false)
26
  end
27

  
28
  def test_name_should_accept_255_characters
29
    enumeration = @field.enumerations.build(:name => 'a' * 255)
30
    assert enumeration.save
31
    assert_equal 'a' * 255, enumeration.reload.name
32
  end
33
end
    (1-1/1)