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

Commit

Permalink
Merge pull request #80 from annikoff/develop
Browse files Browse the repository at this point in the history
Additional information
  • Loading branch information
annikoff authored Feb 20, 2017
2 parents 684f1ae + 781477a commit 4cbecb8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [1.0.3](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.3) - 2017-02-20
### Added
- An additional information for available fields list.

## [1.0.2](https://github.com/annikoff/redmine_plugin_computed_custom_field/releases/tag/v1.0.2) - 2017-02-20
### Fixed
- Migration.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Valid formula is a valid Ruby code executed when customized object is updated.
To put a field ID in the formula, double-click on an item in the list of available fields.


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

### Changelog:

Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
author 'Yakov Annikov'
url 'https://github.com/annikoff/redmine_plugin_computed_custom_field'
description ''
version '1.0.2'
version '1.0.3'
settings default: {}
end

Expand Down
19 changes: 14 additions & 5 deletions lib/computed_custom_field/custom_fields_helper_patch.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
module ComputedCustomField
module CustomFieldsHelperPatch
def render_computed_custom_fields_select(custom_field)
cfs = CustomField.where(type: custom_field.type)
.where('custom_fields.id != ?', custom_field.id || 0)
fields = CustomField.where(type: custom_field.type)
.where('custom_fields.id != ?', custom_field.id || 0)
options = fields.map do |field|
is_computed = field.is_computed? ? ", #{l(:field_is_computed)}" : ''
format = I18n.t(field.format.label)
title = "#{field.name} (#{format}#{is_computed})"
html_attributes = {
value: field.id,
title: title
}
content_tag_string(:option, title, html_attributes)
end.join("\n").html_safe

select_tag '',
options_from_collection_for_select(cfs, 'id', 'name'),
size: 5, multiple: true, id: 'available_cfs'
select_tag '', options, size: 5,
multiple: true, id: 'available_cfs'
end
end
end
Expand Down

0 comments on commit 4cbecb8

Please sign in to comment.