include CustomFieldsHelper
def index
- list
- render :action => 'list'
end
- # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
- :redirect_to => { :action => :list }
-
- def list
- end
+ :redirect_to => { :action => :index }
def new
begin
@enumeration.type = params[:enumeration][:type]
if @enumeration.save
flash[:notice] = l(:notice_successful_create)
- redirect_to :action => 'list', :type => @enumeration.type
+ redirect_to :action => 'index', :type => @enumeration.type
else
render :action => 'new'
end
@enumeration.type = params[:enumeration][:type] if params[:enumeration][:type]
if @enumeration.update_attributes(params[:enumeration])
flash[:notice] = l(:notice_successful_update)
- redirect_to :action => 'list', :type => @enumeration.type
+ redirect_to :action => 'index', :type => @enumeration.type
else
render :action => 'edit'
end
--- /dev/null
+<h2><%=l(:label_enumerations)%></h2>
+
+<% Enumeration.get_subclasses.each do |klass| %>
+<h3><%= l(klass::OptionName) %></h3>
+
+<% enumerations = klass.shared %>
+<% if enumerations.any? %>
+<table class="list"><thead>
+<tr>
+ <th><%= l(:field_name) %></th>
+ <th style="width:15%;"><%= l(:field_is_default) %></th>
+ <th style="width:15%;"><%= l(:field_active) %></th>
+ <th style="width:15%;"></th>
+ <th align="center" style="width:10%;"> </th>
+</tr></thead>
+<% enumerations.each do |enumeration| %>
+<tr class="<%= cycle('odd', 'even') %>">
+ <td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td>
+ <td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td>
+ <td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
+ <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td>
+ <td class="buttons">
+ <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration },
+ :method => :post,
+ :confirm => l(:text_are_you_sure),
+ :class => 'icon icon-del' %>
+ </td>
+</tr>
+<% end %>
+</table>
+<% reset_cycle %>
+<% end %>
+
+<p><%= link_to l(:label_enumeration_new), { :action => 'new', :type => klass.name } %></p>
+<% end %>
+
+<% html_title(l(:label_enumerations)) -%>
+++ /dev/null
-<h2><%=l(:label_enumerations)%></h2>
-
-<% Enumeration.get_subclasses.each do |klass| %>
-<h3><%= l(klass::OptionName) %></h3>
-
-<% enumerations = klass.shared %>
-<% if enumerations.any? %>
-<table class="list"><thead>
-<tr>
- <th><%= l(:field_name) %></th>
- <th style="width:15%;"><%= l(:field_is_default) %></th>
- <th style="width:15%;"><%= l(:field_active) %></th>
- <th style="width:15%;"></th>
- <th align="center" style="width:10%;"> </th>
-</tr></thead>
-<% enumerations.each do |enumeration| %>
-<tr class="<%= cycle('odd', 'even') %>">
- <td><%= link_to h(enumeration), :action => 'edit', :id => enumeration %></td>
- <td class="center" style="width:15%;"><%= checked_image enumeration.is_default? %></td>
- <td class="center" style="width:15%;"><%= checked_image enumeration.active? %></td>
- <td style="width:15%;"><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %></td>
- <td class="buttons">
- <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration },
- :method => :post,
- :confirm => l(:text_are_you_sure),
- :class => 'icon icon-del' %>
- </td>
-</tr>
-<% end %>
-</table>
-<% reset_cycle %>
-<% end %>
-
-<p><%= link_to l(:label_enumeration_new), { :action => 'new', :type => klass.name } %></p>
-<% end %>
-
-<% html_title(l(:label_enumerations)) -%>
def test_index
get :index
assert_response :success
- assert_template 'list'
+ assert_template 'index'
end
def test_destroy_enumeration_not_in_use