Make current_orders plugin configurable
This commit is contained in:
parent
466e8c5eeb
commit
dc731ee40d
12 changed files with 77 additions and 18 deletions
1
Gemfile
1
Gemfile
|
@ -53,6 +53,7 @@ gem 'foodsoft_wiki', path: 'plugins/wiki'
|
|||
gem 'foodsoft_messages', path: 'plugins/messages'
|
||||
|
||||
# plugins not enabled by default
|
||||
#gem 'foodsoft_current_orders', path: 'plugins/current_orders'
|
||||
#gem 'foodsoft_uservoice', path: 'plugins/uservoice'
|
||||
|
||||
|
||||
|
|
|
@ -1685,6 +1685,7 @@ en:
|
|||
title_all: All group tasks
|
||||
ui:
|
||||
actions: Actions
|
||||
back: Back
|
||||
cancel: Cancel
|
||||
close: Close
|
||||
copy: Copy
|
||||
|
|
|
@ -1680,6 +1680,7 @@ nl:
|
|||
title_all: Alle groepstaken
|
||||
ui:
|
||||
actions: Acties
|
||||
back: Terug
|
||||
cancel: Annuleren
|
||||
close: Sluiten
|
||||
copy: Kopiëren
|
||||
|
|
|
@ -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 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.pdf?document=(groups|articles)` for PDFs for all
|
||||
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
|
||||
from orders that are not settled. Can be used as a "shopping-cart overview"
|
||||
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).
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/ insert_after 'erb:contains(":use_nick")'
|
||||
= config_input form, :use_current_orders, as: :boolean
|
|
@ -1 +0,0 @@
|
|||
/ remove 'erb:contains("link_to"):contains("action_receive")'
|
|
@ -1,7 +1,8 @@
|
|||
/ insert_before '#articles_table'
|
||||
- unless @orders.nil? or @orders.empty? or @order_articles.nil? or @order_articles.empty?
|
||||
- content_for :actionbar do
|
||||
= link_to url_for(controller: 'current_orders/orders', action: 'my', id: @orders.map(&:id).join('+'), format: 'pdf'), class: 'btn' do
|
||||
= glyph :download
|
||||
PDF
|
||||
- if FoodsoftCurrentOrders.enabled?
|
||||
- unless @orders.nil? or @orders.empty? or @order_articles.nil? or @order_articles.empty?
|
||||
- content_for :actionbar do
|
||||
= link_to url_for(controller: 'current_orders/orders', action: 'my', id: @orders.map(&:id).join('+'), format: 'pdf'), class: 'btn' do
|
||||
= glyph :download
|
||||
PDF
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/ insert_before 'h2:contains(".orders_finished"), h2:contains(".orders_settled")'
|
||||
.btn-group.pull-right#orders_finished_toolbar
|
||||
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||
= t 'orders.show.download.title'
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to t('orders.show.download.group_pdf'), current_orders_orders_path(document: :groups, format: :pdf)
|
||||
%li= link_to t('orders.show.download.article_pdf'), current_orders_orders_path(document: :articles, format: :pdf)
|
||||
/ insert_before 'h2:contains(".orders_finished")'
|
||||
- if FoodsoftCurrentOrders.enabled?
|
||||
.btn-group.pull-right#orders_finished_toolbar
|
||||
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||
= t 'orders.show.download.title'
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to t('orders.show.download.group_pdf'), current_orders_orders_path(document: :groups, format: :pdf)
|
||||
%li= link_to t('orders.show.download.article_pdf'), current_orders_orders_path(document: :articles, format: :pdf)
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
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:
|
||||
articles:
|
||||
article:
|
||||
|
@ -15,13 +20,17 @@ en:
|
|||
article_placeholder: Search articles...
|
||||
current_orders: All current orders
|
||||
index:
|
||||
title: Distribute article
|
||||
title: Distribute articles
|
||||
ordergroups:
|
||||
piece: pc
|
||||
unit: unit
|
||||
add_new: Add an ordergroup...
|
||||
show:
|
||||
title: ! 'Distribute %{name}'
|
||||
title: ! '%{name}'
|
||||
navigation:
|
||||
receive: Receive
|
||||
articles: Distribute
|
||||
ordergroups: Member orders
|
||||
group_orders:
|
||||
index:
|
||||
title: Your current orders
|
||||
|
@ -62,5 +71,3 @@ en:
|
|||
above: '%{count} more<br>than available'
|
||||
below: '%{count} left over'
|
||||
equal: all distributed
|
||||
ui:
|
||||
back: Back
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
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:
|
||||
articles:
|
||||
article:
|
||||
|
@ -17,6 +22,10 @@ nl:
|
|||
add_new: Huishouden toevoegen...
|
||||
show:
|
||||
title: ! '%{name} verdelen'
|
||||
navigation:
|
||||
receive: Ontvangen
|
||||
articles: Verdelen
|
||||
ordergroups: Ledenbestellingen
|
||||
ordergroups:
|
||||
articles:
|
||||
add_new: Artikel toevoegen...
|
||||
|
|
|
@ -2,4 +2,7 @@ require "deface"
|
|||
require "foodsoft_current_orders/engine"
|
||||
|
||||
module FoodsoftCurrentOrders
|
||||
def self.enabled?
|
||||
FoodsoftConfig[:use_current_orders]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
module FoodsoftCurrentOrders
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue