Add stock_article_selection (deleting multiple stock articles at once)

This commit is contained in:
Julius 2013-01-12 16:14:06 +01:00
parent ecb7ce7cd3
commit 099e2b9b06
13 changed files with 217 additions and 34 deletions

View file

@ -142,7 +142,7 @@ module ApplicationHelper
# offers a link for writing message to user
# checks for nil (useful for relations)
def link_to_user_message_if_valid(user)
user.nil? ? '??' : ( link_to user.nick, user_message_path(user), :title => 'Nachricht schreiben' )
user.nil? ? '??' : ( link_to user.nick, new_message_path(:message => {:mail_to => user.id}), :title => 'Nachricht schreiben' )
end
def bootstrap_flash

View file

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

View file

@ -1,7 +1,18 @@
# encoding: utf-8
module StockitHelper
def stock_article_classes(article)
class_names = []
class_names << "unavailable" if article.quantity_available <= 0
class_names.join(" ")
end
def stock_article_delete_checkbox(article)
if article.quantity_available <= 0
check_box_tag "stock_article_selection[stock_article_ids][]", article.id, false,
{ :id => "checkbox_#{article.id}", :title => 'Zum löschen markieren' }
else
check_box_tag 'checkall', '1', false,
{ :disabled => true, :title => 'Verfügbare Artikel können nicht gelöscht werden.', :class => 'unavailable' }
end
end
end