diff --git a/app/controllers/article_categories_controller.rb b/app/controllers/article_categories_controller.rb index 21ee691f..514bf725 100644 --- a/app/controllers/article_categories_controller.rb +++ b/app/controllers/article_categories_controller.rb @@ -12,4 +12,10 @@ class ArticleCategoriesController < ApplicationController update!(:notice => "Die Kategorie wurde aktualisiert") { article_categories_path } end + protected + + def collection + @article_categories = ArticleCategory.order('name') + end + end diff --git a/app/views/article_categories/index.html.haml b/app/views/article_categories/index.html.haml index 73f13d92..581493f4 100644 --- a/app/views/article_categories/index.html.haml +++ b/app/views/article_categories/index.html.haml @@ -3,15 +3,17 @@ %p= link_to "Neue Kategorie anlegen", new_article_category_path, class: 'btn btn-primary' %table.table.table-striped - %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 "Bearbeiten", edit_article_category_path(article_category), class: 'btn btn-mini' - = link_to "Löschen", article_category, :method => :delete, :confirm => 'Are you sure?', - class: 'btn btn-mini btn-danger' + %thead + %tr + %th Name + %th Beschreibung + %th + %tbody + - @article_categories.each do |article_category| + %tr + %td= article_category.name + %td= article_category.description + %td + = link_to "Bearbeiten", edit_article_category_path(article_category), class: 'btn btn-mini' + = link_to "Löschen", article_category, :method => :delete, :confirm => 'Are you sure?', + class: 'btn btn-mini btn-danger'