Created
January 23, 2014 19:37
-
-
Save svoboda-jan/8585342 to your computer and use it in GitHub Desktop.
This is a simple example of how to create a redmine plugin, which adds a new custom field format to allow dynamic values to be used as options for custom fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# redmine/plugins/project_author/app/models/all_users_field_format.rb | |
class AllUsersFieldFormat < Redmine::FieldFormat::List | |
def possible_values_options(custom_field, object=nil) | |
User.all.collect { |u| [ u.to_s, u.id.to_s ] } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Redmine::Plugin.register :project_author do | |
name 'Project Author plugin' | |
author 'Jan Svoboda' | |
description 'This is a plugin for Redmine to specify author for each project' | |
version '0.0.1' | |
author_url 'https://github.com/svoboda-jan' | |
end | |
Redmine::FieldFormat.add 'all_users', AllUsersFieldFormat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment