bonobos/spree — pull request #2 by HoyaBoya (2014-01-03 17:51:46+00:00)
Title: This is an attempt to integrate Admin Apply Coupon Code to Spree 2-1

It is a feature that was added to master with the introduction of Radar's apply_coupon_code API change.

However for our Spree-2-1, we have our own version in Spree-Backend. As such, this PR could not be introduced as cleanly as liked. There's some mess because the original PR has changes to Spree core models that are based on the new Spree promo system which does not exist in 2-1.

So what has been done is:

1) Bring in only the front end JS/ERB changes of the PR
2) The bare minimum logic on order and promotion models for the can_apply_code? method to work
3) Changes in the adjustment coffee for how errors are displayed.

TODO:

1) We might need to move the api code stuff out of Spree Backend and into our Spree Fork
2) Try to get it into Spree 2-1 itself

Either option will make this more testable with the API code necessary for this change all in one place.

manual cherry-pick of https://github.com/spree/spree/pull/3859

debug

debug

fix for show_flash_error not existing in spree coffeescripts

do it right

re-apply the can_apply logic and dependency on promo change