Free order_article resource from finance namespace; also unlock for role_orders

This commit is contained in:
Julius 2013-12-31 11:41:14 +01:00 committed by wvengen
parent 9ed906f425
commit baa5f16cfc
18 changed files with 40 additions and 35 deletions

View File

@ -47,6 +47,7 @@ class ApplicationController < ActionController::Base
when "article_meta" then current_user.role_article_meta? when "article_meta" then current_user.role_article_meta?
when "suppliers" then current_user.role_suppliers? when "suppliers" then current_user.role_suppliers?
when "orders" then current_user.role_orders? 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 when "any" then true # no role required
else false # any unknown role will always fail else false # any unknown role will always fail
end end
@ -78,6 +79,10 @@ class ApplicationController < ActionController::Base
authenticate('orders') authenticate('orders')
end end
def authenticate_finance_or_orders
authenticate('finance_or_orders')
end
# checks if the current_user is member of given group. # checks if the current_user is member of given group.
# if fails the user will redirected to startpage # if fails the user will redirected to startpage
def authenticate_membership_or_admin(group_id = params[:id]) def authenticate_membership_or_admin(group_id = params[:id])

View File

@ -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 layout false # We only use this controller to serve js snippets, no need for layout rendering

View File

@ -1,4 +1,4 @@
module Finance::OrderArticlesHelper module OrderArticlesHelper
def new_order_articles_collection def new_order_articles_collection
if @order.stockit? if @order.stockit?

View File

@ -10,7 +10,7 @@
%th= heading_helper Article, :tax %th= heading_helper Article, :tax
%th= heading_helper Article, :deposit %th= heading_helper Article, :deposit
%th{:colspan => "2"} %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' class: 'btn btn-small'
%tbody#result_table %tbody#result_table
- for order_article in @articles - for order_article in @articles

View File

@ -20,8 +20,8 @@
%td #{order_article.price.tax}% %td #{order_article.price.tax}%
%td= order_article.price.deposit %td= order_article.price.deposit
%td %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' class: 'btn btn-mini'
%td %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' remote: true, confirm: t('.confirm'), class: 'btn btn-danger btn-mini'

View File

@ -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 .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
%h3= t '.title' %h3= t '.title'

View File

@ -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 .modal-header
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
%h3= t '.title' %h3= t '.title'

View File

@ -25,4 +25,4 @@
%td.article_price_price= number_to_currency order_article.article_price.price %td.article_price_price= number_to_currency order_article.article_price.price
%td.units_delta %td.units_delta
%td %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'

View File

@ -611,12 +611,6 @@ de:
show: show:
back: Züruck back: Züruck
title: Rechnung %{number} 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: ordergroups:
index: index:
new_transaction: Neue Überweisungen eingeben new_transaction: Neue Überweisungen eingeben
@ -1083,6 +1077,12 @@ de:
model: model:
error_single_group: ! '%{user} ist schon in einer anderen Bestellgruppe' error_single_group: ! '%{user} ist schon in einer anderen Bestellgruppe'
invalid_balance: ist keine gültige Zahl 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: orders:
articles: articles:
article_count: ! 'Bestellte Artikel:' article_count: ! 'Bestellte Artikel:'

View File

@ -615,12 +615,6 @@ en:
show: show:
back: Back back: Back
title: Invoice %{number} 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: ordergroups:
index: index:
new_transaction: Add new transactions new_transaction: Add new transactions
@ -1087,6 +1081,12 @@ en:
model: model:
error_single_group: ! '%{user} is already a member of another ordergroup' error_single_group: ! '%{user} is already a member of another ordergroup'
invalid_balance: is not a valid number 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: orders:
add_article: add_article:
title: Add article title: Add article

View File

@ -625,12 +625,6 @@ fr:
show: show:
back: Retour back: Retour
title: Facture %{number} title: Facture %{number}
order_articles:
edit:
stock_alert:
title: Mettre à jour la liste des article
new:
title:
ordergroups: ordergroups:
index: index:
new_transaction: Saisir une nouvelle transaction new_transaction: Saisir une nouvelle transaction
@ -1092,6 +1086,12 @@ fr:
model: model:
error_single_group: ! '%{user} fait déjà partie d''une autre cellule' error_single_group: ! '%{user} fait déjà partie d''une autre cellule'
invalid_balance: n'est pas un nombre valide invalid_balance: n'est pas un nombre valide
order_articles:
edit:
stock_alert:
title: Mettre à jour la liste des article
new:
title:
orders: orders:
articles: articles:
article_count: ! 'Articles commandés:' article_count: ! 'Articles commandés:'

View File

@ -615,12 +615,6 @@ nl:
show: show:
back: Terug back: Terug
title: Factuur %{number} 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: ordergroups:
index: index:
new_transaction: Nieuwe transacties toevoegen new_transaction: Nieuwe transacties toevoegen
@ -1067,6 +1061,12 @@ nl:
model: model:
error_single_group: ! '%{user} behoort al tot een ander huishouden' error_single_group: ! '%{user} behoort al tot een ander huishouden'
invalid_balance: is geen geldig nummer 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: orders:
articles: articles:
article_count: ! 'Bestelde artikelen:' article_count: ! 'Bestelde artikelen:'

View File

@ -45,6 +45,8 @@ Foodsoft::Application.routes.draw do
get :receive_on_order_article_update get :receive_on_order_article_update
end end
resources :order_articles
end end
resources :group_orders do resources :group_orders do
@ -150,8 +152,6 @@ Foodsoft::Application.routes.draw do
get :new_on_order_article_update get :new_on_order_article_update
end end
resources :order_articles
end end
resources :group_order_articles do resources :group_order_articles do