Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit 4cbecb8

Browse files
authored
Merge pull request #80 from annikoff/develop
Additional information
2 parents 684f1ae + 781477a commit 4cbecb8

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [1.0.3](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.3) - 2017-02-20
4+
### Added
5+
- An additional information for available fields list.
6+
37
## [1.0.2](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.2) - 2017-02-20
48
### Fixed
59
- Migration.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Valid formula is a valid Ruby code executed when customized object is updated.
1212
To put a field ID in the formula, double-click on an item in the list of available fields.
1313

1414

15-
![ComputedCustomField plugin for Redmine](https://raw.githubusercontent.com/annikoff/images/master/redmine_plugin_computed_custom_field_v_1_0_0.png)
15+
![ComputedCustomField plugin for Redmine](https://raw.githubusercontent.com/annikoff/images/master/redmine_plugin_computed_custom_field_v_1_0_3.png)
1616

1717
### Changelog:
1818

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
author 'Yakov Annikov'
44
url 'https://github.com/annikoff/redmine_plugin_computed_custom_field'
55
description ''
6-
version '1.0.2'
6+
version '1.0.3'
77
settings default: {}
88
end
99

lib/computed_custom_field/custom_fields_helper_patch.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
module ComputedCustomField
22
module CustomFieldsHelperPatch
33
def render_computed_custom_fields_select(custom_field)
4-
cfs = CustomField.where(type: custom_field.type)
5-
.where('custom_fields.id != ?', custom_field.id || 0)
4+
fields = CustomField.where(type: custom_field.type)
5+
.where('custom_fields.id != ?', custom_field.id || 0)
6+
options = fields.map do |field|
7+
is_computed = field.is_computed? ? ", #{l(:field_is_computed)}" : ''
8+
format = I18n.t(field.format.label)
9+
title = "#{field.name} (#{format}#{is_computed})"
10+
html_attributes = {
11+
value: field.id,
12+
title: title
13+
}
14+
content_tag_string(:option, title, html_attributes)
15+
end.join("\n").html_safe
616

7-
select_tag '',
8-
options_from_collection_for_select(cfs, 'id', 'name'),
9-
size: 5, multiple: true, id: 'available_cfs'
17+
select_tag '', options, size: 5,
18+
multiple: true, id: 'available_cfs'
1019
end
1120
end
1221
end

0 commit comments

Comments
 (0)