プロジェクト

全般

プロフィール

Vote #81525

未完了

Fix position when rendering custom field enumerations

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Confirmed
優先度:
通常
担当者:
-
カテゴリ:
Custom fields_14
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
14
version_id:
32
issue_org_id:
35557
author_id:
361769
assigned_to_id:
0
comments:
2
status_id:
9
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
165
ステータス-->[Confirmed]

説明

The position of each custom field enumeration is integrated as hidden
field in the corresponding index.html.erb file.

When iterating over all enumerations for a certain field, the iteration
is done with an index information of the array, what contains all enumerations.

This index information again is used as the value for the position.

This is wrong, since the (array) index starts counting from zero whereas the position
numbers start counting from 1.

This is fixed now by increasing the position by 1 as stated below.

diff --git a/app/views/custom_field_enumerations/index.html.erb b/app/views/custom_field_enumerations/index.html.erb
index 83e9d59c9..45398728f 100755
--- a/app/views/custom_field_enumerations/index.html.erb
+++ b/app/views/custom_field_enumerations/index.html.erb
@@ -7,7 +7,7 @@
   <% @custom_field.enumerations.each_with_index do |value, position| %>
     
  • - <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position, :class => 'position' %> + <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position + 1, :class => 'position' %> <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40 %> <%= hidden_field_tag "custom_field_enumerations[#{value.id}][active]", 0 %>

  • journals

    The topmost position value is 0 when you open /custom_fields/*/enumerations, but it changes to 1 if you reorder values by drag and drop.
    --------------------------------------------------------------------------------

    --------------------------------------------------------------------------------

    Admin Redmine さんが約2年前に更新

    • カテゴリCustom fields_14 にセット
    • 対象バージョンCandidate for next major release_32 にセット

    他の形式にエクスポート: Atom PDF

    いいね!0
    いいね!0