Merge branch 'master' into feature-cleaner_order_details
Conflicts: app/assets/stylesheets/bootstrap_and_overrides.css.less
This commit is contained in:
commit
8db516c5f0
10 changed files with 139 additions and 51 deletions
|
|
@ -240,6 +240,10 @@ tr.unavailable {
|
|||
|
||||
// ********* Tweaks & fixes
|
||||
|
||||
// Fix bootstrap dropdown menu on mobile
|
||||
// https://github.com/twbs/bootstrap/issues/4550#issuecomment-31916049
|
||||
.dropdown-backdrop { position: static; }
|
||||
|
||||
// need more space for supplier&order information (in German, at least)
|
||||
.dl-horizontal {
|
||||
dt { width: 160px; }
|
||||
|
|
|
|||
|
|
@ -31,4 +31,11 @@ class SessionsController < ApplicationController
|
|||
session[:return_to] = nil
|
||||
redirect_to login_url, :notice => I18n.t('sessions.logged_out')
|
||||
end
|
||||
|
||||
# redirect to root, going to default foodcoop when none given
|
||||
# this may not be so much session-related, but it must be somewhere
|
||||
def redirect_to_foodcoop
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# An OrderArticle represents a single Article that is part of an Order.
|
||||
class OrderArticle < ActiveRecord::Base
|
||||
|
||||
attr_reader :update_current_price
|
||||
attr_reader :update_global_price
|
||||
|
||||
belongs_to :order
|
||||
belongs_to :article
|
||||
|
|
@ -168,14 +168,20 @@ class OrderArticle < ActiveRecord::Base
|
|||
if price_attributes.present?
|
||||
article_price.attributes = price_attributes
|
||||
if article_price.changed?
|
||||
# Updates also price attributes of article if update_current_price is selected
|
||||
if update_current_price
|
||||
# Updates also price attributes of article if update_global_price is selected
|
||||
if update_global_price
|
||||
article.update_attributes!(price_attributes)
|
||||
self.article_price = article.article_prices.first # Assign new created article price to order article
|
||||
self.article_price = article.article_prices.first and save # Assign new created article price to order article
|
||||
else
|
||||
# Creates a new article_price if neccessary
|
||||
# Set created_at timestamp to order ends, to make sure the current article price isn't changed
|
||||
create_article_price!(price_attributes.merge(created_at: order.ends)) and save
|
||||
# TODO: The price_attributes do not include an article_id so that
|
||||
# the entry in the database will not "know" which article is
|
||||
# referenced. Let us check the effect of that and change it or
|
||||
# comment on the meaning.
|
||||
# Possibly this is the real reason why the global price is not
|
||||
# affected instead of the `created_at: order.ends` injection.
|
||||
end
|
||||
|
||||
# Updates ordergroup values
|
||||
|
|
@ -185,8 +191,8 @@ class OrderArticle < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def update_current_price=(value)
|
||||
@update_current_price = (value == true or value == '1') ? true : false
|
||||
def update_global_price=(value)
|
||||
@update_global_price = (value == true or value == '1') ? true : false
|
||||
end
|
||||
|
||||
# Units missing for the next full unit_quantity of the article
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
= render partial: 'shared/article_fields_units', locals: {f_unit: f, f_uq: fprice}
|
||||
= render partial: 'shared/article_fields_price', locals: {f: fprice}
|
||||
|
||||
= form.input :update_current_price, as: :boolean
|
||||
= form.input :update_global_price, as: :boolean
|
||||
= f.input :order_number
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue