Free order_article resource from finance namespace; also unlock for role_orders
This commit is contained in:
parent
9ed906f425
commit
baa5f16cfc
18 changed files with 40 additions and 35 deletions
|
@ -47,6 +47,7 @@ class ApplicationController < ActionController::Base
|
|||
when "article_meta" then current_user.role_article_meta?
|
||||
when "suppliers" then current_user.role_suppliers?
|
||||
when "orders" then current_user.role_orders?
|
||||
when "finance_or_orders" then (current_user.role_finance? || current_user.role_orders?)
|
||||
when "any" then true # no role required
|
||||
else false # any unknown role will always fail
|
||||
end
|
||||
|
@ -78,6 +79,10 @@ class ApplicationController < ActionController::Base
|
|||
authenticate('orders')
|
||||
end
|
||||
|
||||
def authenticate_finance_or_orders
|
||||
authenticate('finance_or_orders')
|
||||
end
|
||||
|
||||
# checks if the current_user is member of given group.
|
||||
# if fails the user will redirected to startpage
|
||||
def authenticate_membership_or_admin(group_id = params[:id])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Finance::OrderArticlesController < ApplicationController
|
||||
class OrderArticlesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_finance
|
||||
before_filter :authenticate_finance_or_orders
|
||||
|
||||
layout false # We only use this controller to serve js snippets, no need for layout rendering
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
module Finance::OrderArticlesHelper
|
||||
module OrderArticlesHelper
|
||||
|
||||
def new_order_articles_collection
|
||||
if @order.stockit?
|
|
@ -10,7 +10,7 @@
|
|||
%th= heading_helper Article, :tax
|
||||
%th= heading_helper Article, :deposit
|
||||
%th{:colspan => "2"}
|
||||
= link_to t('.add_article'), new_finance_order_order_article_path(@order), remote: true,
|
||||
= link_to t('.add_article'), new_order_order_article_path(@order), remote: true,
|
||||
class: 'btn btn-small'
|
||||
%tbody#result_table
|
||||
- for order_article in @articles
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
%td #{order_article.price.tax}%
|
||||
%td= order_article.price.deposit
|
||||
%td
|
||||
= link_to t('ui.edit'), edit_finance_order_order_article_path(order_article.order, order_article), remote: true,
|
||||
= link_to t('ui.edit'), edit_order_order_article_path(order_article.order, order_article), remote: true,
|
||||
class: 'btn btn-mini'
|
||||
%td
|
||||
= link_to t('ui.delete'), finance_order_order_article_path(order_article.order, order_article), method: :delete,
|
||||
= link_to t('ui.delete'), order_order_article_path(order_article.order, order_article), method: :delete,
|
||||
remote: true, confirm: t('.confirm'), class: 'btn btn-danger btn-mini'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for [:finance, @order, @order_article], remote: true do |form|
|
||||
= simple_form_for [@order, @order_article], remote: true do |form|
|
||||
.modal-header
|
||||
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
|
||||
%h3= t '.title'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for [:finance, @order, @order_article], remote: true do |form|
|
||||
= simple_form_for [@order, @order_article], remote: true do |form|
|
||||
.modal-header
|
||||
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
|
||||
%h3= t '.title'
|
|
@ -25,4 +25,4 @@
|
|||
%td.article_price_price= number_to_currency order_article.article_price.price
|
||||
%td.units_delta
|
||||
%td
|
||||
= link_to t('ui.edit'), edit_finance_order_order_article_path(order_article.order, order_article), remote: true, class: 'btn btn-mini'
|
||||
= link_to t('ui.edit'), edit_order_order_article_path(order_article.order, order_article), remote: true, class: 'btn btn-mini'
|
||||
|
|
|
@ -611,12 +611,6 @@ de:
|
|||
show:
|
||||
back: Züruck
|
||||
title: Rechnung %{number}
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert: Preise von Lagerartikeln können nicht geändert werden!
|
||||
title: Artikel aktualisieren
|
||||
new:
|
||||
title: Neuer gelieferter Artikel die Bestellung
|
||||
ordergroups:
|
||||
index:
|
||||
new_transaction: Neue Überweisungen eingeben
|
||||
|
@ -1083,6 +1077,12 @@ de:
|
|||
model:
|
||||
error_single_group: ! '%{user} ist schon in einer anderen Bestellgruppe'
|
||||
invalid_balance: ist keine gültige Zahl
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert: Preise von Lagerartikeln können nicht geändert werden!
|
||||
title: Artikel aktualisieren
|
||||
new:
|
||||
title: Neuer gelieferter Artikel der Bestellung
|
||||
orders:
|
||||
articles:
|
||||
article_count: ! 'Bestellte Artikel:'
|
||||
|
|
|
@ -615,12 +615,6 @@ en:
|
|||
show:
|
||||
back: Back
|
||||
title: Invoice %{number}
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert: The price of stock articles cannot be changed!
|
||||
title: Update article
|
||||
new:
|
||||
title: Add delivered article to order
|
||||
ordergroups:
|
||||
index:
|
||||
new_transaction: Add new transactions
|
||||
|
@ -1087,6 +1081,12 @@ en:
|
|||
model:
|
||||
error_single_group: ! '%{user} is already a member of another ordergroup'
|
||||
invalid_balance: is not a valid number
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert: The price of stock articles cannot be changed!
|
||||
title: Update article
|
||||
new:
|
||||
title: Add delivered article to order
|
||||
orders:
|
||||
add_article:
|
||||
title: Add article
|
||||
|
|
|
@ -625,12 +625,6 @@ fr:
|
|||
show:
|
||||
back: Retour
|
||||
title: Facture %{number}
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert:
|
||||
title: Mettre à jour la liste des article
|
||||
new:
|
||||
title:
|
||||
ordergroups:
|
||||
index:
|
||||
new_transaction: Saisir une nouvelle transaction
|
||||
|
@ -1092,6 +1086,12 @@ fr:
|
|||
model:
|
||||
error_single_group: ! '%{user} fait déjà partie d''une autre cellule'
|
||||
invalid_balance: n'est pas un nombre valide
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert:
|
||||
title: Mettre à jour la liste des article
|
||||
new:
|
||||
title:
|
||||
orders:
|
||||
articles:
|
||||
article_count: ! 'Articles commandés:'
|
||||
|
|
|
@ -615,12 +615,6 @@ nl:
|
|||
show:
|
||||
back: Terug
|
||||
title: Factuur %{number}
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert: De prijs van voorraadartikelen kan niet aangepast worden!
|
||||
title: Artikel bijwerken
|
||||
new:
|
||||
title: Geleverd artikel aan bestelling toevoegen
|
||||
ordergroups:
|
||||
index:
|
||||
new_transaction: Nieuwe transacties toevoegen
|
||||
|
@ -1067,6 +1061,12 @@ nl:
|
|||
model:
|
||||
error_single_group: ! '%{user} behoort al tot een ander huishouden'
|
||||
invalid_balance: is geen geldig nummer
|
||||
order_articles:
|
||||
edit:
|
||||
stock_alert: De prijs van voorraadartikelen kan niet aangepast worden!
|
||||
title: Artikel bijwerken
|
||||
new:
|
||||
title: Geleverd artikel aan bestelling toevoegen
|
||||
orders:
|
||||
articles:
|
||||
article_count: ! 'Bestelde artikelen:'
|
||||
|
|
|
@ -45,6 +45,8 @@ Foodsoft::Application.routes.draw do
|
|||
|
||||
get :receive_on_order_article_update
|
||||
end
|
||||
|
||||
resources :order_articles
|
||||
end
|
||||
|
||||
resources :group_orders do
|
||||
|
@ -150,8 +152,6 @@ Foodsoft::Application.routes.draw do
|
|||
|
||||
get :new_on_order_article_update
|
||||
end
|
||||
|
||||
resources :order_articles
|
||||
end
|
||||
|
||||
resources :group_order_articles do
|
||||
|
|
Loading…
Reference in a new issue