mirror of
https://github.com/redmine/redmine.git
synced 2025-12-22 16:30:38 +01:00
Helper method for custom field title.
git-svn-id: http://svn.redmine.org/redmine/trunk@14751 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<%= 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 %>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<%= 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 } %>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<%= 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 } %>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<%= 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 %>
|
||||
|
||||
Reference in New Issue
Block a user