This is a slide to introduce something about Spree, which is an open source e-commerce framework for Ruby on Rails. Through it, I'll show something Spree allows we to do with it, such as, customize the views, models or controllers.
13. Override views
! There are two ways to do this:
1. Using Deface
Deface is a standalone Rails 3 library that enables you to customize Erb
templates without needing to directly edit the underlying view file. Deface allows
you to use standard CSS3 style selectors to target any element (including Ruby
blocks), and perform an action against all the matching elements. Now the official
repo is located at spree/deface.
2. Template replacement
Sometimes the customization required to a view are so substantial that using a
Deface override seems impractical. Spree also supports the duplication of views
within an application or extension that will completely replace the file of the same
name in Spree.
15. Using Deface-Example
If you wanted to insert some code just before the #registration div
on the page you would define an override as follows:
Note: the :name key is important!
1. Locate the override;
2. Disable default overrides from Spree extensions;
22. Overriding Controller
Action Responses
! respond_override
The respond_override method is used to customize
the response from any action, and is built on top of
Rails 3’s respond_with method.
24. Other Customizations
! Asset Customization:
Through regular overriding.
! Checkout Flow:
State machine allows you to hook transitions.
To add or remove steps to the checkout flow,
you must re-define the entire checkout flow.
25. Plugin/Extension
! Based on rails engines:
Generators, migrations, configs, rake tasks, etc…
! Related to Customizations:
Overrides, configurations, etc…
! Easy codes organizations:
Put your codes independently, easy upgrading, etc…
! Themes
26. Most scenes use extensions
! Custom Shipping Method
! Custom Payment Method
! Custom Promotions
! Need to extend some functions:
Recommendation, Comment, Social, Better
Showing, etc…
28. Some Shortages
! Images:
Styles, configurations…
! Checkout Steps:
Too tedious, synchronous
! Promotion system:
Hard to use
29. They have finished…
! Removing Support for Ruby 1.8.7
! Split Core
! Split Shipments
! Remove Jirafe Dashboard
30. They have finished…
! Model translations(Awesome!)
Based on the gem: globalize3
(https://github.com/svenfuchs/globalize3)
! Support Rails 4.0(finished on SEPTEMBER 16,
2013)
! More friendly users and developers documents
31. They are doing…
! Fast Checkout with Backbone. Marionette
! Optimize the promotion system
! Others…
Let’s expect more amazing
functions!