Refactoring of articles and article_categories. articles are now a nested resource of supplier.

This commit is contained in:
Benjamin Meichsner 2009-01-16 16:19:26 +01:00
parent b38025869a
commit 936e6ef69a
36 changed files with 597 additions and 589 deletions

View file

@ -1,7 +0,0 @@
<% remote_form_for :article_category, :url => { :action => 'updateCategory', :id => @article_category },
:before => "Element.show('loader')",
:success => "Element.hide('loader')" do |@f| %>
<%= render :partial => '/article_categories/form' %>
<br />
<%= submit_tag "Speichern" %> | <%= link_to_function("Abbrechen", "Element.hide('category_form')") %>
<% end %>

View file

@ -1,17 +1,24 @@
<%= error_messages_for 'article_category' %>
<% remote_form_for @article_category,
:before => "Element.show('loader')",
:success => "Element.hide('loader')" do |@f| %>
<!--[form:article_category]-->
<table>
<tr>
<th>Name</th>
<th>Beschreibung</th>
</tr>
<tr>
<td><label for="article_category_name">
<%= @f.text_field 'name', :size => 20 %></label></td>
<td><label for="article_category_description">
<%= @f.text_field 'description', :size => 30 %></label></td>
</tr>
</tabel>
<!--[eoform:article_category]-->
<%= @f.error_messages %>
<table>
<tr>
<th>Name</th>
<th>Beschreibung</th>
</tr>
<tr>
<td>
<%= @f.text_field :name, :size => 20 %>
</td>
<td>
<%= @f.text_field :description, :size => 30 %>
</td>
</tr>
</table>
<br />
<%= submit_tag "Speichern" %> | <%= link_to_function("Abbrechen", "Element.hide('category_form')") %>
<% end %>

View file

@ -4,19 +4,24 @@
<th>Beschreibung</th>
<th colspan="2"></th>
</tr>
<% for article_category in ArticleCategory.find(:all) %>
<tr class="<%= cycle("even","odd", :name => 'category') %>" id="category_<%= article_category.id %>">
<td><%=h article_category.name %></td>
<td><%=h article_category.description %></td>
<td><%= link_to_remote(image_tag('b_edit.png', :size => "16x16", :border => "0", :alt => 'Katgerie bearbeiten'),
:url => {:action => 'editCategory', :id => article_category},
:before => "Element.show('loader')",
:success => "Element.hide('loader')" ) %></td>
<td><%= link_to_remote(image_tag('b_drop.png', :size => "16x16", :border => "0", :alt => 'Kategorie löschen'), :url => {:action => 'destroyCategory', :id => article_category }, :confirm => 'Are you sure?' )%></td>
<% for article_category in ArticleCategory.find(:all) -%>
<tr class="<%= cycle("even","odd", :name => 'category') -%>" id="category_<%= article_category.id -%>">
<td><%=h article_category.name -%></td>
<td><%=h article_category.description -%></td>
<td><%= link_to_remote icon(:edit),
:url => edit_article_category_path(article_category),
:method => :get,
:before => "Element.show('loader')",
:success => "Element.hide('loader')" -%></td>
<td><%= link_to_remote icon(:delete),
:url => article_category,
:method => :delete,
:confirm => 'Are you sure?' -%></td>
</tr>
<% end %>
<% end -%>
</table>
<br />
<%= link_to_remote('Neue Kategorie', :url => {:action => :newCategory},
:before => "Element.show('loader')",
:success => "Element.hide('loader')") -%>
<%= link_to_remote 'Neue Kategorie', :url => new_article_category_path,
:method => :get,
:before => "Element.show('loader')",
:success => "Element.hide('loader')" %>

View file

@ -1,7 +0,0 @@
<% remote_form_for :article_category, :url => { :action => 'createCategory', :id => @article_category },
:before => "Element.show('loader')",
:success => "Element.hide('loader')" do |@f| %>
<%= render :partial => '/article_categories/form' %>
<br />
<%= submit_tag "Speichern" %> | <%= link_to_function("Abbrechen", "Element.hide('category_form')") %>
<% end %>