Commit 524c6f2c authored by jplang's avatar jplang

Helper method for custom field title.

git-svn-id: https://svn.redmine.org/redmine/trunk@14751 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 10e87d51
......@@ -22,6 +22,8 @@ class CustomFieldEnumerationsController < ApplicationController
before_filter :find_custom_field
before_filter :find_enumeration, :only => :destroy
helper :custom_fields
def index
@values = @custom_field.enumerations.order(:position)
end
......
......@@ -51,6 +51,15 @@ module CustomFieldsHelper
CUSTOM_FIELDS_TABS.map {|h| [l(h[:label]), h[:name]]}
end
def custom_field_title(custom_field)
items = []
items << [l(:label_custom_field_plural), custom_fields_path]
items << [l(custom_field.type_name), custom_fields_path(:tab => custom_field.class.name)] if custom_field
items << (custom_field.nil? || custom_field.new_record? ? l(:label_custom_field_new) : custom_field.name)
title(*items)
end
def render_custom_field_format_partial(form, custom_field)
partial = custom_field.format.form_partial
if partial
......
<%= title [l(:label_custom_field_plural), custom_fields_path],
[l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)],
@custom_field.name %>
<%= custom_field_title @custom_field %>
<% if @custom_field.enumerations.any? %>
<%= form_tag custom_field_enumerations_path(@custom_field), :method => 'put' do %>
......
<%= title [l(:label_custom_field_plural), custom_fields_path],
[l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)],
@custom_field.name %>
<%= custom_field_title @custom_field %>
<%= labelled_form_for :custom_field, @custom_field, :url => custom_field_path(@custom_field), :html => {:method => :put, :id => 'custom_field_form'} do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
......
<%= title [l(:label_custom_field_plural), custom_fields_path],
[l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)],
l(:label_custom_field_new) %>
<%= custom_field_title @custom_field %>
<%= labelled_form_for :custom_field, @custom_field, :url => custom_fields_path, :html => {:id => 'custom_field_form'} do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
......
<%= title [l(:label_custom_field_plural), custom_fields_path],
l(:label_custom_field_new) %>
<%= custom_field_title @custom_field %>
<% selected = 0 %>
<%= form_tag new_custom_field_path, :method => 'get' do %>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment