@@ -22,6 +22,8 class CustomFieldEnumerationsController < ApplicationController | |||||
22 | before_filter :find_custom_field |
|
22 | before_filter :find_custom_field | |
23 | before_filter :find_enumeration, :only => :destroy |
|
23 | before_filter :find_enumeration, :only => :destroy | |
24 |
|
24 | |||
|
25 | helper :custom_fields | |||
|
26 | ||||
25 | def index |
|
27 | def index | |
26 | @values = @custom_field.enumerations.order(:position) |
|
28 | @values = @custom_field.enumerations.order(:position) | |
27 | end |
|
29 | end |
@@ -51,6 +51,15 module CustomFieldsHelper | |||||
51 | CUSTOM_FIELDS_TABS.map {|h| [l(h[:label]), h[:name]]} |
|
51 | CUSTOM_FIELDS_TABS.map {|h| [l(h[:label]), h[:name]]} | |
52 | end |
|
52 | end | |
53 |
|
53 | |||
|
54 | def custom_field_title(custom_field) | |||
|
55 | items = [] | |||
|
56 | items << [l(:label_custom_field_plural), custom_fields_path] | |||
|
57 | items << [l(custom_field.type_name), custom_fields_path(:tab => custom_field.class.name)] if custom_field | |||
|
58 | items << (custom_field.nil? || custom_field.new_record? ? l(:label_custom_field_new) : custom_field.name) | |||
|
59 | ||||
|
60 | title(*items) | |||
|
61 | end | |||
|
62 | ||||
54 | def render_custom_field_format_partial(form, custom_field) |
|
63 | def render_custom_field_format_partial(form, custom_field) | |
55 | partial = custom_field.format.form_partial |
|
64 | partial = custom_field.format.form_partial | |
56 | if partial |
|
65 | if partial |
@@ -1,6 +1,4 | |||||
1 |
<%= |
|
1 | <%= custom_field_title @custom_field %> | |
2 | [l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)], |
|
|||
3 | @custom_field.name %> |
|
|||
4 |
|
2 | |||
5 | <% if @custom_field.enumerations.any? %> |
|
3 | <% if @custom_field.enumerations.any? %> | |
6 | <%= form_tag custom_field_enumerations_path(@custom_field), :method => 'put' do %> |
|
4 | <%= form_tag custom_field_enumerations_path(@custom_field), :method => 'put' do %> |
@@ -1,6 +1,4 | |||||
1 |
<%= |
|
1 | <%= custom_field_title @custom_field %> | |
2 | [l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)], |
|
|||
3 | @custom_field.name %> |
|
|||
4 |
|
2 | |||
5 | <%= labelled_form_for :custom_field, @custom_field, :url => custom_field_path(@custom_field), :html => {:method => :put, :id => 'custom_field_form'} do |f| %> |
|
3 | <%= labelled_form_for :custom_field, @custom_field, :url => custom_field_path(@custom_field), :html => {:method => :put, :id => 'custom_field_form'} do |f| %> | |
6 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
4 | <%= render :partial => 'form', :locals => { :f => f } %> |
@@ -1,6 +1,4 | |||||
1 |
<%= |
|
1 | <%= custom_field_title @custom_field %> | |
2 | [l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)], |
|
|||
3 | l(:label_custom_field_new) %> |
|
|||
4 |
|
2 | |||
5 | <%= labelled_form_for :custom_field, @custom_field, :url => custom_fields_path, :html => {:id => 'custom_field_form'} do |f| %> |
|
3 | <%= labelled_form_for :custom_field, @custom_field, :url => custom_fields_path, :html => {:id => 'custom_field_form'} do |f| %> | |
6 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
4 | <%= render :partial => 'form', :locals => { :f => f } %> |
@@ -1,5 +1,4 | |||||
1 |
<%= |
|
1 | <%= custom_field_title @custom_field %> | |
2 | l(:label_custom_field_new) %> |
|
|||
3 |
|
2 | |||
4 | <% selected = 0 %> |
|
3 | <% selected = 0 %> | |
5 | <%= form_tag new_custom_field_path, :method => 'get' do %> |
|
4 | <%= form_tag new_custom_field_path, :method => 'get' do %> |
General Comments 0
You need to be logged in to leave comments.
Login now