Merge pull request #28 from JuliusR/rails3

stock_article_selection ready for testing
This commit is contained in:
JuliusR 2013-01-28 11:51:32 -08:00
commit 00d2847f9d
21 changed files with 177 additions and 80 deletions

View file

@ -53,4 +53,7 @@ group :development do
# Re-enable rails benchmarker/profiler # Re-enable rails benchmarker/profiler
gem 'ruby-prof' gem 'ruby-prof'
gem 'test-unit' gem 'test-unit'
# Get infos when not using proper eager loading
gem 'bullet'
end end

View file

@ -57,6 +57,8 @@ GEM
erubis (>= 2.7.0) erubis (>= 2.7.0)
binding_of_caller (0.6.8) binding_of_caller (0.6.8)
builder (3.0.4) builder (3.0.4)
bullet (4.3.0)
uniform_notifier
chronic (0.9.0) chronic (0.9.0)
client_side_validations (3.1.4) client_side_validations (3.1.4)
coderay (1.0.8) coderay (1.0.8)
@ -205,6 +207,7 @@ GEM
uglifier (1.3.0) uglifier (1.3.0)
execjs (>= 0.3.0) execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2) multi_json (~> 1.0, >= 1.0.2)
uniform_notifier (1.1.1)
vegas (0.1.11) vegas (0.1.11)
rack (>= 1.0.0) rack (>= 1.0.0)
whenever (0.8.1) whenever (0.8.1)
@ -223,6 +226,7 @@ DEPENDENCIES
acts_as_versioned! acts_as_versioned!
better_errors better_errors
binding_of_caller binding_of_caller
bullet
client_side_validations client_side_validations
coffee-rails (~> 3.2.1) coffee-rails (~> 3.2.1)
daemons daemons

View file

@ -157,13 +157,13 @@ function updateBalance() {
var bgcolor = ''; var bgcolor = '';
if (balance < 0) { if (balance < 0) {
bgcolor = '#FF0000'; bgcolor = '#FF0000';
$('#submit_button').disabled = true; $('#submit_button').attr('disabled', 'disabled')
} else { } else {
$('#submit_button').disabled = false; $('#submit_button').removeAttr('disabled')
} }
// update bgcolor // update bgcolor
for (i in itemTotal) { for (i in itemTotal) {
$('#ltd_price_' + i).css('background-color', bgcolor); $('#td_price_' + i).css('background-color', bgcolor);
} }
} }

View file

@ -1,8 +1,7 @@
class StockitController < ApplicationController class StockitController < ApplicationController
def index def index
@stock_articles = StockArticle.includes(:supplier, :article_category). @stock_articles = StockArticle.elements_for_index
order('suppliers.name, article_categories.name, articles.name')
@stock_article_selection = StockArticleSelection.new @stock_article_selection = StockArticleSelection.new
end end

View file

@ -2,7 +2,7 @@
class StockitSelectionsController < ApplicationController class StockitSelectionsController < ApplicationController
def index def index
@stock_article_selections = StockArticleSelection.all @stock_article_selections = StockArticleSelection.find(:all, :order => 'created_at DESC')
end end
def show def show
@ -14,43 +14,48 @@ class StockitSelectionsController < ApplicationController
@stock_article_selection.created_by = current_user @stock_article_selection.created_by = current_user
if @stock_article_selection.save if @stock_article_selection.save
redirect_to(@stock_article_selection, :notice => 'Löschvorschlag für gewählte Artikel wurde erstellt.') redirect_to(@stock_article_selection, :notice => 'Löschvorschlag für gewählte Artikel erstellt.')
else else
@stock_articles = StockArticle.includes(:supplier, :article_category). @stock_articles = StockArticle.elements_for_index
order('suppliers.name, article_categories.name, articles.name')
render 'stockit/index' render 'stockit/index'
end end
end end
def destroy # destroy (open or finished) selection without deleting articles def destroy # destroy selection without deleting articles
stock_article_selection = StockArticleSelection.find(params[:id]) stock_article_selection = StockArticleSelection.find(params[:id])
stock_article_selection.destroy stock_article_selection.destroy
redirect_to stock_article_selections_path, :notice => 'Löschvorschlag wurde verworfen.' redirect_to stock_article_selections_path, :notice => 'Löschvorschlag verworfen.'
end end
def articles # destroy articles, finish selection def articles # destroy articles
stock_article_selection = StockArticleSelection.find(params[:id]) stock_article_selection = StockArticleSelection.find(params[:id])
destroyed_articles_count = 0 destroyed_articles_count = 0
failed_articles_count = 0 failed_articles_count = 0
stock_article_selection.stock_articles.each do |article| stock_article_selection.stock_articles.each do |article|
begin begin
article.destroy # article.delete would save some effort, but validations are important article.destroy
destroyed_articles_count += 1 destroyed_articles_count += 1
rescue => error # recover if article.destroy fails and continue with next article rescue => error # recover if article.destroy fails and continue with next article
failed_articles_count += 1 failed_articles_count += 1
end end
end end
if destroyed_articles_count>0 # note that 1 successful article.destroy is enough to destroy selection if destroyed_articles_count > 0
stock_article_selection.destroy flash[:notice] = "#{destroyed_articles_count} gewählte Artikel gelöscht."
flash[:notice] = "#{destroyed_articles_count} gewählte Artikel sind nun gelöscht."
flash[:error] = "#{failed_articles_count} Artikel konnten nicht gelöscht werden." unless 0==failed_articles_count flash[:error] = "#{failed_articles_count} Artikel konnten nicht gelöscht werden." unless 0==failed_articles_count
else else
flash[:error] = "Löschvorgang fehlgeschlagen. Es wurden keine Artikel gelöscht." flash[:error] = 'Löschvorgang fehlgeschlagen. Keine Artikel gelöscht.'
end end
redirect_to stock_articles_path redirect_to stock_articles_path
end end
def finished # delete all finished selections
finished_selections = StockArticleSelection.all.select { |sel| sel.deletable_count + sel.nondeletable_count <= 0 }
finished_selections.each { |sel| sel.destroy }
redirect_to stock_article_selections_path, :notice => 'Alle erledigten Löschvorschläge entfernt.'
end
end end

View file

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

View file

@ -1,2 +1,18 @@
# encoding: utf-8
module StockArticleSelectionsHelper module StockArticleSelectionsHelper
def article_deletion_classes(article)
className = "label label-success" # usual deletable case, maybe modified below
className = "label label-important" if article.quantity_available > 0
className = "label" if article.deleted?
className
end
def article_deletion_title(article)
myTitle = "Löschbar" # usual deletable case, maybe modified below
myTitle = "Nicht löschbar, da im Lager vorhanden" if article.quantity_available > 0
myTitle = "Bereits gelöscht" if article.deleted?
myTitle
end
end end

View file

@ -38,20 +38,23 @@ class GroupOrder < ActiveRecord::Base
# load prices and other stuff.... # load prices and other stuff....
data[:order_articles] = {} data[:order_articles] = {}
order.order_articles.each do |order_article| #order.order_articles.each do |order_article|
data[:order_articles][order_article.id] = { order.articles_grouped_by_category.each do |article_category, order_articles|
:price => order_article.article.fc_price, order_articles.each do |order_article|
:unit => order_article.article.unit_quantity, data[:order_articles][order_article.id] = {
:quantity => (new_record? ? 0 : goas[order_article.id][:quantity]), :price => order_article.article.fc_price,
:others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]), :unit => order_article.article.unit_quantity,
:used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]), :quantity => (new_record? ? 0 : goas[order_article.id][:quantity]),
:tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]), :others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]),
:others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]), :used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]),
:used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]), :tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]),
:total_price => (new_record? ? 0 : goas[order_article.id][:total_price]), :others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]),
:missing_units => order_article.missing_units, :used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]),
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0) :total_price => (new_record? ? 0 : goas[order_article.id][:total_price]),
} :missing_units => order_article.missing_units,
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
}
end
end end
data data

View file

@ -82,9 +82,10 @@ class Order < ActiveRecord::Base
# The array has the following form: # The array has the following form:
# e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]] # e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]]
def articles_grouped_by_category def articles_grouped_by_category
order_articles.includes([:article_price, :group_order_articles, :article => :article_category]). @articles_grouped_by_category ||= order_articles.
includes([:article_price, :group_order_articles, :article => :article_category]).
order('articles.name'). order('articles.name').
group_by { |a| a.article.article_category.name }. group_by { |a| a.article.article_category.name }.
sort { |a, b| a[0] <=> b[0] } sort { |a, b| a[0] <=> b[0] }
end end

View file

@ -22,6 +22,11 @@ class StockArticle < Article
def self.stock_value def self.stock_value
available.collect { |a| a.quantity * a.gross_price }.sum available.collect { |a| a.quantity * a.gross_price }.sum
end end
def self.elements_for_index
StockArticle.includes(:supplier, :article_category).
order('suppliers.name, article_categories.name, articles.name')
end
protected protected

View file

@ -13,6 +13,18 @@ class StockArticleSelection < ActiveRecord::Base
all_articles = stock_article_ids all_articles = stock_article_ids
end end
def deletable_count
stock_articles.select { |a| a.quantity_available<=0 }.length
end
def nondeletable_count
stock_articles.select { |a| a.quantity_available>0 }.length
end
def deleted_count
stock_articles.only_deleted.count
end
protected protected
def include_stock_articles def include_stock_articles

View file

@ -12,31 +12,34 @@
}) })
}); });
.row-fluid = simple_form_for [@supplier, @delivery], validate: true do |f|
.span6 = f.hidden_field :supplier_id
= simple_form_for [@supplier, @delivery], validate: true do |f| #stock_changes
= f.hidden_field :supplier_id = f.fields_for :stock_changes do |stock_change_form|
#stock_changes
= f.fields_for :stock_changes do |stock_change_form|
%p
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
Menge
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
= stock_change_form.hidden_field :_destroy
= link_to "Artikel aus Lieferung entfernen", "#", class: 'destroy_stock_change'
%p %p
= link_to "Lagerartikel der Lieferung hinzufügen", {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true = stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
%hr/ Menge
= f.input :delivered_on, as: :date_picker = stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
= f.input :note, input_html: {size: '35x4'} = stock_change_form.hidden_field :_destroy
.form-actions = link_to "Artikel aus Lieferung entfernen", "#", class: 'destroy_stock_change'
= f.submit class: 'btn btn-primary' %p
= link_to "oder abbrechen", supplier_deliveries_path(@supplier) = link_to "Lagerartikel der Lieferung hinzufügen", {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
%p
%small
Ist ein Artikel noch nicht in der Lagerverwaltung, muss er erst
#{link_to("neu angelegt", new_stock_article_path)} werden.
%hr/
= f.input :delivered_on, as: :date_picker
= f.input :note, input_html: {size: '35x4'}
.form-actions
= f.submit class: 'btn btn-primary'
= link_to "oder abbrechen", supplier_deliveries_path(@supplier)
/
TODO: Fix this!!
.span6 .span6
%h2 Neuen Lagerartikel anlegen %h2 Neuen Lagerartikel anlegen
%p %p
//TODO: Fix this!!
Suche nach Artikeln aus dem Suche nach Artikeln aus dem
%i= @supplier.name %i= @supplier.name
Katalog: Katalog:

View file

@ -130,7 +130,7 @@
%td Neuer Kontostand: %td Neuer Kontostand:
%td.currency %td.currency
%strong %strong
%span#new_balance= @ordergroup.account_balance - @group_order.price %span#new_balance= @ordering_data[:available_funds] - @group_order.price
#order-button #order-button
= submit_tag( "Bestellung speichern", id: 'submit_button', class: 'btn btn-primary' ) = submit_tag( "Bestellung speichern", id: 'submit_button', class: 'btn btn-primary' )

View file

@ -2,7 +2,7 @@
- content_for :javascript do - content_for :javascript do
:javascript :javascript
$(function() { $(function() {
$('tr.unavailable,input.unavailable').hide(); $('tr.unavailable,input.unavailable,div.unavailable').hide();
}) })
.well.well-small .well.well-small
@ -12,12 +12,12 @@
Ansichtsoptionen Ansichtsoptionen
%span.caret %span.caret
%ul.dropdown-menu %ul.dropdown-menu
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable,input.unavailable', tabindex: -1 %li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable,input.unavailable,div.unavailable', tabindex: -1
.btn-group .btn-group
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn btn-primary'
= link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", new_order_path(supplier_id: 0), = link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", new_order_path(supplier_id: 0),
class: 'btn' class: 'btn', class: 'btn btn-primary'
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn'
= link_to "Inventur anlegen", new_stock_taking_path, class: 'btn' = link_to "Inventur anlegen", new_stock_taking_path, class: 'btn'
= link_to "Inventurübersicht", stock_takings_path, class: 'btn' = link_to "Inventurübersicht", stock_takings_path, class: 'btn'
= link_to 'Löschvorschläge', stock_article_selections_path, class: 'btn' = link_to 'Löschvorschläge', stock_article_selections_path, class: 'btn'
@ -66,7 +66,8 @@
= link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini' = link_to "Bearbeiten", edit_stock_article_path(article), class: 'btn btn-mini'
= link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?", = link_to "Löschen", article, :method => :delete, :confirm => "Bist Du sicher?",
class: 'btn btn-mini btn-danger' class: 'btn btn-mini btn-danger'
%p= submit_tag "Artikel zum Löschen vormerken", { :class => 'unavailable btn' } .form-actions.unavailable
= submit_tag "Artikel zum Löschen vormerken", { :class => 'unavailable btn' }
%p %p
Aktueller Lagerwert: Aktueller Lagerwert:
= number_to_currency StockArticle.stock_value = number_to_currency StockArticle.stock_value

View file

@ -13,7 +13,9 @@
}) })
%p /
TODO: Fix this
%p
Suche nach Artikeln aus allen Katalogen: Suche nach Artikeln aus allen Katalogen:
= text_field_tag 'article_search' = text_field_tag 'article_search'
#stock_article_form #stock_article_form

View file

@ -2,15 +2,22 @@
%table.table.table-hover %table.table.table-hover
%tr %tr
%th Artikel %th Artikel
%th Zusammenfassung
%th Erstellt am %th Erstellt am
%th Erstellt von %th Erstellt von
%th Optionen %th Optionen
- stock_article_selections.each do |stock_article_selection| - stock_article_selections.each do |stock_article_selection|
%tr %tr
%td=h truncate stock_article_selection.stock_articles.map{ |article| article.name}.join(', ') %td
%td=h stock_article_selection.created_at - for article in stock_article_selection.stock_articles.with_deleted
%td=h link_to_user_message_if_valid stock_article_selection.created_by %span{:class => article_deletion_classes(article), :title => article_deletion_title(article)}= article.name
%td
%span{:class => 'label label-success'}= "#{stock_article_selection.deletable_count} Löschbar"
%span{:class => 'label'}= "#{stock_article_selection.deleted_count} Gelöscht"
%span{:class => 'label label-important'}= "#{stock_article_selection.nondeletable_count} Nicht löschbar"
%td= format_date(stock_article_selection.created_at)
%td= link_to_user_message_if_valid stock_article_selection.created_by
%td %td
= link_to 'Anzeigen', stock_article_selection, class: 'btn btn-small' = link_to 'Anzeigen', stock_article_selection, class: 'btn btn-small'
= link_to "Artikel löschen", articles_stock_article_selection_path(stock_article_selection), :method => :delete, = link_to "Artikel löschen", articles_stock_article_selection_path(stock_article_selection), :method => :delete,

View file

@ -1,7 +1,25 @@
- title "Löschvorschläge für Lagerartikel" - title "Löschvorschläge für Lagerartikel"
- if @stock_article_selections.empty?
%p Es gibt keine ausstehenden Löschvorschläge. .well.well-small
%ul .btn-toolbar
%li= link_to "Löschvorschlag erstellen", stock_articles_path .btn-group
= link_to "Lager anzeigen", stock_articles_path, class: 'btn'
= link_to "Aufräumen", finished_stock_article_selections_path, :method => 'delete',
:confirm => 'Wirklich alle erledigten Löschvorschläge entfernen?', class: 'btn'
.well
%h2 Ausstehende Löschvorschläge
- open_selections = @stock_article_selections.select { |sel| sel.deletable_count + sel.nondeletable_count > 0 }
- if open_selections.length == 0
%p Es gibt keine ausstehenden Löschvorschläge.
%ul
%li= link_to "Löschvorschlag erstellen", stock_articles_path
- else
= render :partial => 'overview', :locals => {:stock_article_selections => open_selections}
%h2 Erledigte Löschvorschläge
- finished_selections = @stock_article_selections.select { |sel| sel.deletable_count + sel.nondeletable_count <= 0 }
- if finished_selections.length == 0
%p Es gibt keine erledigten Löschvorschläge.
- else - else
= render :partial => 'overview', :locals => {:stock_article_selections => @stock_article_selections} = render :partial => 'overview', :locals => {:stock_article_selections => finished_selections}

View file

@ -1,13 +1,20 @@
- title "Löschvorschlag für #{@stock_article_selection.stock_articles.count} Lagerartikel" - title "Löschvorschlag für #{@stock_article_selection.stock_articles.count} Lagerartikel"
.well.well-small
.btn-toolbar
.btn-group
= link_to "Lager anzeigen", stock_articles_path, class: 'btn'
= link_to 'Alle Löschvorschläge anzeigen', stock_article_selections_path, class: 'btn'
%dl %dl
%dt Löschvorschlag vom: %dt Löschvorschlag vom:
%dd=h @stock_article_selection.created_at %dd= format_time(@stock_article_selection.created_at)
%dt Erstellt durch: %dt Erstellt durch:
%dd=h link_to_user_message_if_valid(@stock_article_selection.created_by) %dd= link_to_user_message_if_valid(@stock_article_selection.created_by)
%dt Zu löschende Artikel %dt Zu löschende Artikel
- for article in @stock_article_selection.stock_articles - for article in @stock_article_selection.stock_articles.with_deleted
%dd=h article.name %dd
%span{:class => article_deletion_classes(article), :title => article_deletion_title(article)}= article.name
%p %p
@ -15,4 +22,4 @@
:confirm => 'Diesen Löschvorschlag wirklich ausführen und markierte Artikel löschen?', class: 'btn btn-danger' :confirm => 'Diesen Löschvorschlag wirklich ausführen und markierte Artikel löschen?', class: 'btn btn-danger'
= link_to 'Verwerfen', @stock_article_selection, :method => :delete, = link_to 'Verwerfen', @stock_article_selection, :method => :delete,
:confirm => 'Diesen Löschvorschlag wirklich verwerfen?', class: 'btn' :confirm => 'Diesen Löschvorschlag wirklich verwerfen?', class: 'btn'
= link_to 'Alle Löschvorschläge zeigen', stock_article_selections_path, class: 'btn' = link_to 'Alle Löschvorschläge anzeigen', stock_article_selections_path, class: 'btn'

View file

@ -0,0 +1,6 @@
if defined? Bullet
Bullet.enable = true
# Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
end

View file

@ -7,7 +7,7 @@ SimpleNavigation::Configuration.run do |navigation|
primary.item :dashboard_nav_item, 'Dashboard', root_path(anchor: '') primary.item :dashboard_nav_item, 'Dashboard', root_path(anchor: '')
primary.item :foodcoop, 'Foodcoop', '#' do |subnav| primary.item :foodcoop, 'Foodcoop', '#', id: nil do |subnav|
subnav.item :members, 'Mitglieder', foodcoop_users_path, id: nil subnav.item :members, 'Mitglieder', foodcoop_users_path, id: nil
subnav.item :workgroups, 'Arbeitsgruppen', foodcoop_workgroups_path, id: nil subnav.item :workgroups, 'Arbeitsgruppen', foodcoop_workgroups_path, id: nil
subnav.item :ordergroups, 'Bestellgruppen', foodcoop_ordergroups_path, id: nil subnav.item :ordergroups, 'Bestellgruppen', foodcoop_ordergroups_path, id: nil
@ -15,32 +15,32 @@ SimpleNavigation::Configuration.run do |navigation|
subnav.item :tasks, 'Aufgaben', tasks_path, id: nil subnav.item :tasks, 'Aufgaben', tasks_path, id: nil
end end
primary.item :wiki, 'Wiki', '#' do |subnav| primary.item :wiki, 'Wiki', '#', id: nil do |subnav|
subnav.item :wiki_home, 'Startseite', wiki_path, id: nil subnav.item :wiki_home, 'Startseite', wiki_path, id: nil
subnav.item :all_pages, 'Alle Seiten', all_pages_path, id: nil subnav.item :all_pages, 'Alle Seiten', all_pages_path, id: nil
end end
primary.item :orders, 'Bestellungen', '#' do |subnav| primary.item :orders, 'Bestellungen', '#', id: nil do |subnav|
subnav.item :ordering, 'Bestellen!', group_orders_path, id: nil subnav.item :ordering, 'Bestellen!', group_orders_path, id: nil
subnav.item :ordering_archive, 'Meine Bestellungen', archive_group_orders_path, id: nil subnav.item :ordering_archive, 'Meine Bestellungen', archive_group_orders_path, id: nil
subnav.item :orders, 'Bestellverwaltung', orders_path, if: Proc.new { current_user.role_orders? }, id: nil subnav.item :orders, 'Bestellverwaltung', orders_path, if: Proc.new { current_user.role_orders? }, id: nil
end end
primary.item :articles, 'Artikel', '#', primary.item :articles, 'Artikel', '#', id: nil,
if: Proc.new { current_user.role_article_meta? or current_user.role_suppliers? } do |subnav| if: Proc.new { current_user.role_article_meta? or current_user.role_suppliers? } do |subnav|
subnav.item :suppliers, 'Lieferanten/Artikel', suppliers_path, id: nil subnav.item :suppliers, 'Lieferanten/Artikel', suppliers_path, id: nil
subnav.item :stockit, 'Lager', stock_articles_path, id: nil subnav.item :stockit, 'Lager', stock_articles_path, id: nil
subnav.item :categories, 'Kategorien', article_categories_path, id: nil subnav.item :categories, 'Kategorien', article_categories_path, id: nil
end end
primary.item :finance, 'Finanzen', '#', if: Proc.new { current_user.role_finance? } do |subnav| primary.item :finance, 'Finanzen', '#', id: nil, if: Proc.new { current_user.role_finance? } do |subnav|
subnav.item :finance_home, 'Übersicht', finance_root_path subnav.item :finance_home, 'Übersicht', finance_root_path
subnav.item :accounts, 'Konten verwalten', finance_ordergroups_path, id: nil subnav.item :accounts, 'Konten verwalten', finance_ordergroups_path, id: nil
subnav.item :balancing, 'Bestellungen abrechnen', finance_order_index_path, id: nil subnav.item :balancing, 'Bestellungen abrechnen', finance_order_index_path, id: nil
subnav.item :invoices, 'Rechnungen', finance_invoices_path, id: nil subnav.item :invoices, 'Rechnungen', finance_invoices_path, id: nil
end end
primary.item :admin, 'Administration', '#', if: Proc.new { current_user.role_admin? } do |subnav| primary.item :admin, 'Administration', '#', id: nil, if: Proc.new { current_user.role_admin? } do |subnav|
subnav.item :admin_home, 'Übersicht', admin_root_path subnav.item :admin_home, 'Übersicht', admin_root_path
subnav.item :users, 'Benutzerinnen', admin_users_path, id: nil subnav.item :users, 'Benutzerinnen', admin_users_path, id: nil
subnav.item :ordergroups, 'Bestellgruppen', admin_ordergroups_path, id: nil subnav.item :ordergroups, 'Bestellgruppen', admin_ordergroups_path, id: nil

View file

@ -95,6 +95,10 @@ Foodsoft::Application.routes.draw do
member do member do
delete 'articles' delete 'articles'
end end
collection do
delete 'finished'
end
end end