Refactored article_categories.
This commit is contained in:
parent
0b1682af7c
commit
0decbb36e1
12 changed files with 39 additions and 118 deletions
4
app/views/article_categories/_form.html.haml
Normal file
4
app/views/article_categories/_form.html.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
= simple_form_for @article_category do |f|
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
= f.submit
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<% remote_form_for @article_category,
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" do |@f| %>
|
||||
|
||||
<%= @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 %>
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<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 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 -%>
|
||||
</table>
|
||||
<br />
|
||||
<%= link_to_remote 'Neue Kategorie', :url => new_article_category_path,
|
||||
:method => :get,
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
3
app/views/article_categories/edit.html.haml
Normal file
3
app/views/article_categories/edit.html.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
- title "Kategorie ändern"
|
||||
|
||||
= render 'form'
|
||||
|
|
@ -4,5 +4,16 @@
|
|||
.box_title
|
||||
%h2 Artikelkategorien
|
||||
.column_content#categories
|
||||
#category_form.box.edit_form{:style => "display:none;margin-bottom:1em;"}
|
||||
#category_list= render :partial => 'article_categories/list'
|
||||
%table
|
||||
%tr
|
||||
%th Name
|
||||
%th Beschreibung
|
||||
%th
|
||||
- for article_category in ArticleCategory.all
|
||||
%tr{:class => cycle("even","odd", :name => 'category')}[article_category]
|
||||
%td= article_category.name
|
||||
%td= article_category.description
|
||||
%td
|
||||
= link_to icon(:edit), edit_article_category_path(article_category)
|
||||
= link_to icon(:delete), article_category, :method => :delete, :confirm => 'Are you sure?'
|
||||
%p= link_to 'Neue Kategorie anlegen', new_article_category_path
|
||||
|
|
|
|||
3
app/views/article_categories/new.html.haml
Normal file
3
app/views/article_categories/new.html.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
- title "Neue Kategorie anlegen"
|
||||
|
||||
= render 'form'
|
||||
Loading…
Add table
Add a link
Reference in a new issue