opendays 2014 ccomb

32
anybox 1/32 Christophe Combelles – OpenDays 2014 Integrating third-party Javascript libraries

Upload: anyboxodoo

Post on 21-Jul-2016

566 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: opendays 2014 ccomb

anybox

1/32Christophe Combelles – OpenDays 2014

Integratingthird-party Javascript libraries

Page 2: opendays 2014 ccomb

anybox

2/32

1) Context

2) Howto with JSColor :

3) other examples : Dynatree, D3Chart

Page 3: opendays 2014 ccomb

3/32

Who ?

● (Christophe Combelles, @ccomb)● → Jean-Sébastien Suzanne, @jssuzanne● → Pierre Verkest, @petrusv84

Page 4: opendays 2014 ccomb

4/32

Mission Laïque Française

● French Association, founded in 1902● Promoting the french language and culture● Secular and intercultural teaching● 140+ french schools worldwide

Page 5: opendays 2014 ccomb

5/32

Mission Laïque Française

Page 6: opendays 2014 ccomb

6/32

Works done (or re-used) for the MLF● Socket.io integration

● https://bitbucket.org/anybox/web_socketio● https://bitbucket.org/anybox/web_live

● Visual export (export to OpenDocument)● https://bitbucket.org/anybox/visual_export/

● List view with multiple headers● https://bitbucket.org/anybox/list_multiheader

● FullCalendar integration (from Valentin Lab)● https://github.com/0k/web_fullcalendar/

● JSColor integration● https://bitbucket.org/anybox/widget_color/

● Dynatree integration● https://bitbucket.org/anybox/web_dynatree

● D3 Chart integration● https://bitbucket.org/anybox/web_d3_chart

Page 7: opendays 2014 ccomb

7/32

JSCOLOR : http://jscolor.com

Page 8: opendays 2014 ccomb

8/32

https://bitbucket.org/anybox/widget_color

Page 9: opendays 2014 ccomb

anybox

9/32

Step 1Create your module structure

Page 10: opendays 2014 ccomb

10/32

widget_color

Page 11: opendays 2014 ccomb

11/32

widget_color __openerp__.py

Page 12: opendays 2014 ccomb

12/32

Creating a module

● Quick skeleton of a module :● anybox.paster.openerp

Page 13: opendays 2014 ccomb

anybox

13/32

Step 2Include the 3rd-party JS lib

Page 14: opendays 2014 ccomb

14/32

widget_color jscolor

Page 15: opendays 2014 ccomb

15/32

Patched jscolor.js

Page 16: opendays 2014 ccomb

16/32

widget_color Handle static resources

Page 17: opendays 2014 ccomb

anybox

17/32

Step 3Write a javascript "module"

Page 18: opendays 2014 ccomb

18/32

widget_color Javascript "module"

Page 19: opendays 2014 ccomb

19/32

Javascript Design Patterns

● Must Read :● http://addyosmani.com/resources/essentialjsdesignp

atterns/book/

Page 20: opendays 2014 ccomb

20/32

Javascript module

Page 21: opendays 2014 ccomb

21/32

Javascript module

Page 22: opendays 2014 ccomb

anybox

22/32

Step 4Write the server side in Python

(if needed)

Page 23: opendays 2014 ccomb

23/32

widget_color New Python field

Page 24: opendays 2014 ccomb

anybox

24/32

Step 5Write the template and CSS

Page 25: opendays 2014 ccomb

25/32

widget_color QWEB templates

Page 26: opendays 2014 ccomb

26/32

widget_color CSS

Page 27: opendays 2014 ccomb

anybox

27/32

Step 6Add tests

Page 28: opendays 2014 ccomb

anybox

28/32

Other examples

Page 29: opendays 2014 ccomb

29/32

https://bitbucket.org/anybox/web_dynatree

Page 30: opendays 2014 ccomb

30/32

Example usage : multi-axis analytic

Page 31: opendays 2014 ccomb

31/32

https://bitbucket.org/anybox/web_d3_chart

Page 32: opendays 2014 ccomb

anybox

32/32

Thank you

https://bitbucket.org/anybox/widget_color

https://bitbucket.org/anybox/web_dynatree

https://bitbucket.org/anybox/web_d3_chart