show proper error when all articles are deselected in order edit
This commit is contained in:
parent
4c1e5e2b00
commit
5d9c9856d1
2 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
class OrdersController < ApplicationController
|
class OrdersController < ApplicationController
|
||||||
|
|
||||||
before_filter :authenticate_orders
|
before_filter :authenticate_orders
|
||||||
|
before_filter :remove_empty_article, only: [:create, :update]
|
||||||
|
|
||||||
# List orders
|
# List orders
|
||||||
def index
|
def index
|
||||||
|
@ -174,4 +175,8 @@ class OrdersController < ApplicationController
|
||||||
notice.join(', ')
|
notice.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_empty_article
|
||||||
|
params[:order][:article_ids].reject!(&:blank?) if params[:order] and params[:order][:article_ids]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
|
= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' }
|
||||||
|
-# also when all are deselected, make sure this parameter is sent (controller removes empty values again)
|
||||||
|
= hidden_field_tag "order[article_ids][]", nil
|
||||||
%td{:colspan => "6"}= t '.select_all'
|
%td{:colspan => "6"}= t '.select_all'
|
||||||
|
|
||||||
- if (@template_orders && !@template_orders.empty?)
|
- if (@template_orders && !@template_orders.empty?)
|
||||||
|
|
Loading…
Add table
Reference in a new issue