Make current_orders plugin configurable

This commit is contained in:
wvengen 2015-07-10 18:12:05 +02:00
parent 466e8c5eeb
commit dc731ee40d
12 changed files with 77 additions and 18 deletions

View File

@ -53,6 +53,7 @@ gem 'foodsoft_wiki', path: 'plugins/wiki'
gem 'foodsoft_messages', path: 'plugins/messages' gem 'foodsoft_messages', path: 'plugins/messages'
# plugins not enabled by default # plugins not enabled by default
#gem 'foodsoft_current_orders', path: 'plugins/current_orders'
#gem 'foodsoft_uservoice', path: 'plugins/uservoice' #gem 'foodsoft_uservoice', path: 'plugins/uservoice'

View File

@ -1685,6 +1685,7 @@ en:
title_all: All group tasks title_all: All group tasks
ui: ui:
actions: Actions actions: Actions
back: Back
cancel: Cancel cancel: Cancel
close: Close close: Close
copy: Copy copy: Copy

View File

@ -1680,6 +1680,7 @@ nl:
title_all: Alle groepstaken title_all: Alle groepstaken
ui: ui:
actions: Acties actions: Acties
back: Terug
cancel: Annuleren cancel: Annuleren
close: Sluiten close: Sluiten
copy: Kopiëren copy: Kopiëren

View File

@ -7,6 +7,10 @@ day. The proper solution to this is to introduce the notion of order cycles,
with each order belonging to a cycle. Until that time, we have this plugin, with each order belonging to a cycle. Until that time, we have this plugin,
with screens for working on all orders that are closed-but-not-finished. with screens for working on all orders that are closed-but-not-finished.
Important: be sure to settle orders from the previous order cycle, before
you close any. If you don't, articles from previous and current dates start
to mix up (if you do, settle the old ones asap).
* `current_orders/orders/receive` for a list of orders that can be received. * `current_orders/orders/receive` for a list of orders that can be received.
* `current_orders/orders.pdf?document=(groups|articles)` for PDFs for all * `current_orders/orders.pdf?document=(groups|articles)` for PDFs for all
orders that are closed but not settled. orders that are closed but not settled.
@ -17,3 +21,22 @@ with screens for working on all orders that are closed-but-not-finished.
* `current_orders/group_orders` for all articles in the user's group orders * `current_orders/group_orders` for all articles in the user's group orders
from orders that are not settled. Can be used as a "shopping-cart overview" from orders that are not settled. Can be used as a "shopping-cart overview"
or "checkout" page. or "checkout" page.
New menu items will be added in the "Orders" menu. Please note that members
with _Orders_ permission will now be able to edit the amounts members received
in some of these screens, something that was previously restricted to the
_Finance_ permission.
This plugin is not enabled by default. To install it, add uncomment the
corresponding line in the `Gemfile`, or add:
```Gemfile
gem 'foodsoft_current_orders', path: 'plugins/current_orders'
```
This plugin introduces the foodcoop config option `use_current_orders`, which
needs to be set to `true` to enable the plugin. This can be done in the
configuration screen or `config/app_config.yml`.
This plugin is part of the foodsoft package and uses the GPL-3 license or later
(see foodsoft's LICENSE for the full license text).

View File

@ -0,0 +1,2 @@
/ insert_after 'erb:contains(":use_nick")'
= config_input form, :use_current_orders, as: :boolean

View File

@ -1 +0,0 @@
/ remove 'erb:contains("link_to"):contains("action_receive")'

View File

@ -1,4 +1,5 @@
/ insert_before '#articles_table' / insert_before '#articles_table'
- if FoodsoftCurrentOrders.enabled?
- unless @orders.nil? or @orders.empty? or @order_articles.nil? or @order_articles.empty? - unless @orders.nil? or @orders.empty? or @order_articles.nil? or @order_articles.empty?
- content_for :actionbar do - content_for :actionbar do
= link_to url_for(controller: 'current_orders/orders', action: 'my', id: @orders.map(&:id).join('+'), format: 'pdf'), class: 'btn' do = link_to url_for(controller: 'current_orders/orders', action: 'my', id: @orders.map(&:id).join('+'), format: 'pdf'), class: 'btn' do

View File

@ -1,4 +1,5 @@
/ insert_before 'h2:contains(".orders_finished"), h2:contains(".orders_settled")' / insert_before 'h2:contains(".orders_finished")'
- if FoodsoftCurrentOrders.enabled?
.btn-group.pull-right#orders_finished_toolbar .btn-group.pull-right#orders_finished_toolbar
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do = link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
= t 'orders.show.download.title' = t 'orders.show.download.title'

View File

@ -1,4 +1,9 @@
en: en:
config:
hints:
use_current_orders: Enable the current_orders plugin. Allows members with the order permission to change member amounts in multiple orders, using three new screens in the Orders menu. Especially useful for pick-up days.
keys:
use_current_orders: Extra distribute screens
current_orders: current_orders:
articles: articles:
article: article:
@ -15,13 +20,17 @@ en:
article_placeholder: Search articles... article_placeholder: Search articles...
current_orders: All current orders current_orders: All current orders
index: index:
title: Distribute article title: Distribute articles
ordergroups: ordergroups:
piece: pc piece: pc
unit: unit unit: unit
add_new: Add an ordergroup... add_new: Add an ordergroup...
show: show:
title: ! 'Distribute %{name}' title: ! '%{name}'
navigation:
receive: Receive
articles: Distribute
ordergroups: Member orders
group_orders: group_orders:
index: index:
title: Your current orders title: Your current orders
@ -62,5 +71,3 @@ en:
above: '%{count} more<br>than available' above: '%{count} more<br>than available'
below: '%{count} left over' below: '%{count} left over'
equal: all distributed equal: all distributed
ui:
back: Back

View File

@ -1,4 +1,9 @@
nl: nl:
config:
hints:
use_current_orders: De current_orders plugin aanzetten. Hiermee kunnen leden met bestelling-toegang bestelaantallen van leden aanpassen in meerdere bestellingen tegelijk. Hiervoor zijn drie nieuwe items in het Bestellingen-menu. Bedoeld voor gebruik op een ophaaldag.
keys:
use_current_orders: Extra verdeelschermen
current_orders: current_orders:
articles: articles:
article: article:
@ -17,6 +22,10 @@ nl:
add_new: Huishouden toevoegen... add_new: Huishouden toevoegen...
show: show:
title: ! '%{name} verdelen' title: ! '%{name} verdelen'
navigation:
receive: Ontvangen
articles: Verdelen
ordergroups: Ledenbestellingen
ordergroups: ordergroups:
articles: articles:
add_new: Artikel toevoegen... add_new: Artikel toevoegen...

View File

@ -2,4 +2,7 @@ require "deface"
require "foodsoft_current_orders/engine" require "foodsoft_current_orders/engine"
module FoodsoftCurrentOrders module FoodsoftCurrentOrders
def self.enabled?
FoodsoftConfig[:use_current_orders]
end
end end

View File

@ -1,4 +1,15 @@
module FoodsoftCurrentOrders module FoodsoftCurrentOrders
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
def navigation(primary, context)
return unless FoodsoftCurrentOrders.enabled?
return if primary[:orders].nil?
cond = Proc.new { current_user.role_orders? }
[
SimpleNavigation::Item.new(primary, :stage_divider, nil, nil, class: 'divider', if: cond),
SimpleNavigation::Item.new(primary, :current_orders_receive, I18n.t('current_orders.navigation.receive'), context.receive_current_orders_orders_path, if: cond),
SimpleNavigation::Item.new(primary, :current_orders_articles, I18n.t('current_orders.navigation.articles'), context.current_orders_articles_path, if: cond),
SimpleNavigation::Item.new(primary, :current_orders_ordergroups, I18n.t('current_orders.navigation.ordergroups'), context.current_orders_ordergroups_path, if: cond)
].each {|i| primary[:orders].sub_navigation.items << i }
end
end end
end end