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

@ -58,11 +58,11 @@ module ApplicationHelper
return result
end
def sort_link_helper(text, param, per_page = 10)
def sort_link_helper(text, param, per_page = (@per_page || 10) )
key = param
key += "_reverse" if params[:sort] == param
options = {
:url => {:action => 'list', :params => params.merge({:sort => key, :page => nil, :per_page => per_page})},
:url => url_for(:params => params.merge({:sort => key, :page => nil, :per_page => per_page})),
:before => "Element.show('loader')",
:success => "Element.hide('loader')",
:method => :get
@ -102,4 +102,13 @@ module ApplicationHelper
def tab_is_active?(tab)
tab[:active].detect {|c| c == controller.controller_path }
end
def icon(name, options={})
icons = { :delete => { :file => 'b_drop.png', :alt => 'Löschen'},
:edit => { :file => 'b_edit.png', :alt => 'Bearbeiten'}}
options.merge!({:size => '16x16',:border => "0"})
options.merge!({:alt => icons[name][:alt]}) unless options[:alt]
image_tag icons[name][:file], options
end
end

View file

@ -0,0 +1,2 @@
module ArticleCategoriesHelper
end

View file

@ -4,4 +4,11 @@ module ArticlesHelper
def highlight_new(unequal_attributes, attribute)
unequal_attributes.detect {|a| a == attribute} ? "background-color: yellow" : ""
end
def row_classes(article)
classes = ""
classes += ' unavailable' if article.availability
classes += " just_updated" if @article.recently_updated && @article.availability
classes
end
end