spree framework overview

Post on 03-Jul-2015

629 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

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.

TRANSCRIPT

Spree An open source e-commerce framework

for Ruby on Rails

©Beansmile

Martin

!  From Beansmile

! http://weibo.com/hongzeqin

! hongzeqin@gmail.com

A Spree Demo Site

! http://best-boutique-7789.spree.mx/

Overview-Homepage

Demo: http://best-boutique-7789.spree.mx/

Overview-Products List

Overview-Product Details

Overview-Cart

Overview-Admin(Procuts)

Overview-Configurations

Business System

Associations

Advantages

!  Customization

!  Configurable

!  Extendable

!  Less Prerequisites

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.

Using Deface-Example

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;

Deface: locate overrides

Deface: disable overrides

Override controllers/models

!  Logic customization:

1. Extending Classes

2. Overriding Controller Action Responses

3. Product Images Styles

Extending Classes

!   Adding a custom method to the Product model: app/models/product_decorator.rb

Extending Classes

!   Adding a custom action to the ProductsController:

app/controllers/products_controller_decorator.rb

Magic: decorator

config/application.rb

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.

Product Images

! Imagemagick

!   Paperclip

!   Image Model

Problems:

styles

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.

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

Most scenes use extensions

!   Custom Shipping Method

!   Custom Payment Method

!   Custom Promotions

!   Need to extend some functions: Recommendation, Comment, Social, Better Showing, etc…

Other functions

!   I18n

!   Mailers

!   Analytics

!   Etc…

Some Shortages

!   Images:

Styles, configurations…

!   Checkout Steps:

Too tedious, synchronous

!   Promotion system:

Hard to use

They have finished…

!  Removing Support for Ruby 1.8.7

!  Split Core

!  Split Shipments

!  Remove Jirafe Dashboard

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

They are doing…

!  Fast Checkout with Backbone. Marionette

!  Optimize the promotion system

!  Others…

Let’s expect more amazing functions!

Our works…

Our works…

Our works…

States and cities in China(Cascade)

One-page check out flow

Learning Spree

!   Calculators

!   How to implement decorator?

!   State machines

!   Generators

!   Etc…

End & Thanks

!   Spree Documents:

http://spreecommerce.com/developers/overview

!   Spree Blog:

http://spreecommerce.com/blog

top related