spree/spree_print_invoice — pull request #22 by lilleyt (2013-01-30 20:23:43+00:00)
Title: 1 3 stable

This is a candidate pull for a new master for spree_print_invoice, update for Spree 1.3.

I did this before I saw the other pull request to make this work with 1.3. I believe my pull request is somewhat better implemented, so I'm submitting it for your consideration.

Differences:

- The other request loses 1.2 out of the Versionfile
- This request specifies a new 1-3-stable branch as the branch for 1.3, not master. The pull should go into master and then be branched into 1-3-stable.
- Master is unstable by definition and all versions should have a stable branch which is the suggested one in the Versionfile, just as all prior versions have.
- This request adds the print invoice button in the toolbar, where all of the other action buttons go. This not only matches the layout in 1.2, it's also good UX to keep all action buttons together and consistent.

Aside from that, the requests are pretty much the same.

There are two basic changes. Since in 1.3 the admin buttons have been changed to an unordered list, the spree_print_invoice partial that adds the invoice button(s) has been updated to create list items rather than bare links.

The second change is that there were two overrides for 1.2, one for showing and one for editing. Because the toolbar buttons have been moved into a single view in 1.3, the override has also been consolidated into a single file. The override has been named to match the new view. Since the code is also executed on any admin page, not just orders, a call to test whether the current page is an order has been added. The button(s) will not be shown on any page that is not an order.