diff options
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 |