diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-15 14:12:17 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-15 14:12:17 +0000 |
commit | d7b669e50b1c863b748231dc8fb66a692a33cdd1 (patch) | |
tree | 59001bb1ae7cb03a9c8ce92e8ffb9b874c56f4af /app/helpers | |
parent | 54d55a360a21569b4a76070b52177e778d5521c7 (diff) | |
download | redmine-d7b669e50b1c863b748231dc8fb66a692a33cdd1.tar.gz redmine-d7b669e50b1c863b748231dc8fb66a692a33cdd1.zip |
Workflow enhancement: editable and required fields configurable by role, tracker and status (#703, #3521).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9977 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 12 | ||||
-rw-r--r-- | app/helpers/workflows_helper.rb | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index ff953d857..c55943b32 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -73,15 +73,17 @@ module CustomFieldsHelper end # Return custom field label tag - def custom_field_label_tag(name, custom_value) + def custom_field_label_tag(name, custom_value, options={}) + required = options[:required] || custom_value.custom_field.is_required? + content_tag "label", h(custom_value.custom_field.name) + - (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>".html_safe : ""), - :for => "#{name}_custom_field_values_#{custom_value.custom_field.id}" + (required ? " <span class=\"required\">*</span>".html_safe : ""), + :for => "#{name}_custom_field_values_#{custom_value.custom_field.id}" end # Return custom field tag with its label tag - def custom_field_tag_with_label(name, custom_value) - custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) + def custom_field_tag_with_label(name, custom_value, options={}) + custom_field_label_tag(name, custom_value, options) + custom_field_tag(name, custom_value) end def custom_field_tag_for_bulk_edit(name, custom_field, projects=nil) diff --git a/app/helpers/workflows_helper.rb b/app/helpers/workflows_helper.rb index 59b31d2ea..3dd514042 100644 --- a/app/helpers/workflows_helper.rb +++ b/app/helpers/workflows_helper.rb @@ -18,4 +18,10 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module WorkflowsHelper + def field_permission_tag(permissions, status, field) + name = field.is_a?(CustomField) ? field.id.to_s : field + select_tag("permissions[#{name}][#{status.id}]", + options_for_select([["", ""], ["Read-only", "readonly"], ["Required", "required"]], permissions[status.id][name]) + ) + end end |