SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Presentation title here
Adding custom UI controls to
your application
Hryhorii Hrebiniuk
hhrebiniuk@orocrm.com
Presentation title here
● Frontend architecture overview
● Writing modular javascript with OroCRM
○ Application Modules
○ Page Components
● Practical examples
Agenda
Add Custom UI Controls to Your Application
Presentation title here
RequireJS proposes AMD
(Asynchronous Module Definition)
JavaScript Modularity
Add Custom UI Controls to Your Application
Presentation title here
● define - method for facilitating module
definition
● require - method for handling dependency
loading
RequireJS
Add Custom UI Controls to Your Application
Presentation title here
define(
module_id /*optional*/,
[dependencies] /*optional*/,
definition function
/*function for instantiating
the module or object*/
);
define() method
Add Custom UI Controls to Your Application
Presentation title here
require(
[dependencies],
callback function /*optional*/
);
require() method
Add Custom UI Controls to Your Application
Presentation title here
# Resources/config/requirejs.yml
config:
shim: # configures exports and dependencies
map: # maps the module_ids
paths: # path mappings for the module names under the
baseUrl
'jquery': 'bundles/bundle/jquery.js'
build:
paths:
# extends requirejs configuration for the build
process
'bootstrap': 'empty:'
RequireJSBundle Configuration
Add Custom UI Controls to Your Application
Presentation title here
● RequireJS
● jQuery + jQuery-UI + Bootstrap
● Backbone + Chaplin
Technology Stack
Add Custom UI Controls to Your Application
Presentation title here
Chaplin Architecture
Add Custom UI Controls to Your Application
Presentation title here
Oro Application Workflow
Add Custom UI Controls to Your Application
// oroui/js/app/routes.js
define(function () {
return [
['*pathname', 'page#index']
];
});
Presentation title here
Page Processing Flow
Add Custom UI Controls to Your Application
Presentation title here
PageComponent
Add Custom UI Controls to Your Application
Presentation title here
is extended from BaseComponent
(‘oroui/js/app/components/base/component’ module)
implements
Backbone.Events and Chaplin.EventBroker
public methods
initialize() and dispose()
protected methods
_deferredInit() and _resolveDeferredInit()
see Page Component documentation http://goo.gl/BHxhgc
PageComponent
Add Custom UI Controls to Your Application
Presentation title here
{% set options = {
metadata: metaData, // configuration options
data: data // initial data
} %}
<div
data-page-component-module
="path/to/component/module"
data-page-component-options
="{{ options|json_encode }}"></div>
Define PageComponent
Add Custom UI Controls to Your Application
Presentation title here
Global Components/Views
Add Custom UI Controls to Your Application
Presentation title here
Compositions (global components, views etc.)
beforeAction: function() {
// Reuse the Header view
this.reuse('header', Header,
{region: 'header'});
}
see Chaplin.Composer documentation http://goo.gl/OMwq6e
Composer
Add Custom UI Controls to Your Application
Presentation title here
Performs necessary actions on start up, including
the following:
● defines global components/views (that exist
irrespective of the active controller)
● registers handlers in the mediator (see Chaplin.
mediator doc http://goo.gl/r5pmfX)
App Module
Add Custom UI Controls to Your Application
Presentation title here
# Resources/config/requirejs.yml
config:
appmodules:
- oroui/js/app/modules/views-module
- oroui/js/app/modules/messenger-module
App Module Declaration
Add Custom UI Controls to Your Application
Presentation title here
require([
'oroui/js/app/controllers/base/controller'
], function (BaseController) {
BaseController.loadBeforeAction([
'oroui/js/app/views/page/content-view'
], function (PageContentView) {
BaseController.addToReuse(
'content', PageContentView,
{ el: 'mainContainer' }
);
});
});
App Module Definition
Add Custom UI Controls to Your Application
Presentation title here
https://github.com/grygir/DemoUIControlBundle
cd <project_path>/src
mkdir Acme
cd Acme
git clone git@github.com:grygir/DemoUIControlBundle.git
cd DemoUIControlBundle
Demo Example
Add Custom UI Controls to Your Application
Presentation title here
$ app/console cache:clear
$ app/console assets:install --symlink
$ app/console assetic:dump
$ app/console oro:translation:dump
$ app/console oro:requirejs:dump
Useful Commands
Add Custom UI Controls to Your Application
Presentation title here
Example 1
Add Custom UI Controls to Your Application
Navigation History:
● History is a list of links with the page titles and URLs.
● History items are ordered by time of visit (the latest are
on the top).
● Records in the history are unique (by URL).
● Shows information on the number of visits and the time
of the last visit for each record.
● “Clear the list” action is available for the history.
Presentation title here
Example 1, Outline
Add Custom UI Controls to Your Application
1. Create App Module and History Component.
2. Create Model, Collection and Views
3. Develop control logic in History Component
4. Create templates for views
5. Reorder collection items on visited page
6. Add js translations
7. Add tooltips for the history links
Presentation title here
Example 2
Add Custom UI Controls to Your Application
Task: Add WYSIWYG editor.
Requirements:
● WYSIWYG editor should have a base set of functions
● Extend WYSIWYG and provide way to insert links from
PinBar and Favorites collections
Presentation title here
Example 2, Outline
Add Custom UI Controls to Your Application
1. Add a new FormType – WYSIWYG, as extend for the
Textarea.
2. Define template block for WYSIWYG
3. Choose third-party WYSIWYG editor library
4. Bind the editor to HTML markup
5. Implement extra actions for WYSIWYG
Presentation title here
Conclusions
Add Custom UI Controls to Your Application
1. Always keep in mind the life cycle of your
component/view/model/collection
(think who is going to take care of them,
when they are not in use anymore)
Presentation title here
Conclusions
Add Custom UI Controls to Your Application
2. Do not mix roles in your MVC application
Presentation title here
Conclusions
Add Custom UI Controls to Your Application
3. Extend your application components from
component oroui/js/app/components/base/component
view oroui/js/app/views/base/view
collection-view oroui/js/app/views/base/collection-view
model oroui/js/app/models/base/model
collection oroui/js/app/models/base/collection
Presentation title here
Conclusions
Add Custom UI Controls to Your Application
4. Read documentation Backbone + Chaplin
Presentation title here
Questions
Hryhorii Hrebiniuk
hhrebiniuk@orocrm.com
Adding custom UI controls to your
application

Weitere ähnliche Inhalte

Was ist angesagt?

Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
BG Java EE Course
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
Bo-Yi Wu
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the Trenches
Xavier Noria
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
kamal kotecha
 

Was ist angesagt? (20)

Spring core
Spring coreSpring core
Spring core
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
JSP Error handling
JSP Error handlingJSP Error handling
JSP Error handling
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
Wt unit 3
Wt unit 3 Wt unit 3
Wt unit 3
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.
 
Wt unit 4
Wt unit 4Wt unit 4
Wt unit 4
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the Trenches
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
Rails Best Practices
Rails Best PracticesRails Best Practices
Rails Best Practices
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
 

Ähnlich wie Adding custom ui controls to your application (1)

Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax PluginsHnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
dominion
 

Ähnlich wie Adding custom ui controls to your application (1) (20)

mean stack
mean stackmean stack
mean stack
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Introduction to Angular Js
Introduction to Angular JsIntroduction to Angular Js
Introduction to Angular Js
 
introduction to Angularjs basics
introduction to Angularjs basicsintroduction to Angularjs basics
introduction to Angularjs basics
 
AngularJs-training
AngularJs-trainingAngularJs-training
AngularJs-training
 
Yii php framework_honey
Yii php framework_honeyYii php framework_honey
Yii php framework_honey
 
Test
TestTest
Test
 
Angular js-crash-course
Angular js-crash-courseAngular js-crash-course
Angular js-crash-course
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
Modern android development
Modern android developmentModern android development
Modern android development
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax PluginsHnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
Hnd201 Building Ibm Lotus Domino Applications With Ajax Plugins
 
01 startoff angularjs
01 startoff angularjs01 startoff angularjs
01 startoff angularjs
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگو
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Angular presentation
Angular presentationAngular presentation
Angular presentation
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application Guidance
 
Parallelminds.web partdemo
Parallelminds.web partdemoParallelminds.web partdemo
Parallelminds.web partdemo
 
Working with AngularJS
Working with AngularJSWorking with AngularJS
Working with AngularJS
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA Austria
 

Mehr von Oro Inc.

Benefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM WebinarBenefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM Webinar
Oro Inc.
 
Integration with presta shop webinar
Integration with presta shop webinarIntegration with presta shop webinar
Integration with presta shop webinar
Oro Inc.
 

Mehr von Oro Inc. (20)

Jary Carter Presents OroCRM
Jary Carter Presents OroCRMJary Carter Presents OroCRM
Jary Carter Presents OroCRM
 
Best Practices For Taking Your B2B Company Online
Best Practices For Taking Your B2B Company OnlineBest Practices For Taking Your B2B Company Online
Best Practices For Taking Your B2B Company Online
 
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
 
How to Close More Deals with B2B eCommerce Systems
How to Close More Deals with B2B eCommerce SystemsHow to Close More Deals with B2B eCommerce Systems
How to Close More Deals with B2B eCommerce Systems
 
Email is the digital key - dotmailer, Oro MeetUp, Paris
Email is the digital key - dotmailer, Oro MeetUp, ParisEmail is the digital key - dotmailer, Oro MeetUp, Paris
Email is the digital key - dotmailer, Oro MeetUp, Paris
 
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, ParisB2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
 
Comment April Moto met en place une relation client multicanal et augmente so...
Comment April Moto met en place une relation client multicanal et augmente so...Comment April Moto met en place une relation client multicanal et augmente so...
Comment April Moto met en place une relation client multicanal et augmente so...
 
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in ParisRevolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
 
Oro Meetup London - Allies: How can we really turn data into profit?
Oro Meetup London - Allies: How can we really turn data into profit?Oro Meetup London - Allies: How can we really turn data into profit?
Oro Meetup London - Allies: How can we really turn data into profit?
 
Oro London Meetup - dotmailer: Faster, smarter, better, email marketing
Oro London Meetup - dotmailer: Faster, smarter, better, email marketingOro London Meetup - dotmailer: Faster, smarter, better, email marketing
Oro London Meetup - dotmailer: Faster, smarter, better, email marketing
 
Oro Meetup in London - Oro product vision
Oro Meetup in London - Oro product visionOro Meetup in London - Oro product vision
Oro Meetup in London - Oro product vision
 
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
 
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
 
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
 
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM..."New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
 
Benefits of OroCRM + Magento Webinar
Benefits of OroCRM + Magento WebinarBenefits of OroCRM + Magento Webinar
Benefits of OroCRM + Magento Webinar
 
Benefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM WebinarBenefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM Webinar
 
OroCRM Multi-Channel Webinar
OroCRM Multi-Channel WebinarOroCRM Multi-Channel Webinar
OroCRM Multi-Channel Webinar
 
Powerful Customer Service with OroCRM + Zendesk
Powerful Customer Service with OroCRM + ZendeskPowerful Customer Service with OroCRM + Zendesk
Powerful Customer Service with OroCRM + Zendesk
 
Integration with presta shop webinar
Integration with presta shop webinarIntegration with presta shop webinar
Integration with presta shop webinar
 

Adding custom ui controls to your application (1)

  • 1. Presentation title here Adding custom UI controls to your application Hryhorii Hrebiniuk hhrebiniuk@orocrm.com
  • 2. Presentation title here ● Frontend architecture overview ● Writing modular javascript with OroCRM ○ Application Modules ○ Page Components ● Practical examples Agenda Add Custom UI Controls to Your Application
  • 3. Presentation title here RequireJS proposes AMD (Asynchronous Module Definition) JavaScript Modularity Add Custom UI Controls to Your Application
  • 4. Presentation title here ● define - method for facilitating module definition ● require - method for handling dependency loading RequireJS Add Custom UI Controls to Your Application
  • 5. Presentation title here define( module_id /*optional*/, [dependencies] /*optional*/, definition function /*function for instantiating the module or object*/ ); define() method Add Custom UI Controls to Your Application
  • 6. Presentation title here require( [dependencies], callback function /*optional*/ ); require() method Add Custom UI Controls to Your Application
  • 7. Presentation title here # Resources/config/requirejs.yml config: shim: # configures exports and dependencies map: # maps the module_ids paths: # path mappings for the module names under the baseUrl 'jquery': 'bundles/bundle/jquery.js' build: paths: # extends requirejs configuration for the build process 'bootstrap': 'empty:' RequireJSBundle Configuration Add Custom UI Controls to Your Application
  • 8. Presentation title here ● RequireJS ● jQuery + jQuery-UI + Bootstrap ● Backbone + Chaplin Technology Stack Add Custom UI Controls to Your Application
  • 9. Presentation title here Chaplin Architecture Add Custom UI Controls to Your Application
  • 10. Presentation title here Oro Application Workflow Add Custom UI Controls to Your Application // oroui/js/app/routes.js define(function () { return [ ['*pathname', 'page#index'] ]; });
  • 11. Presentation title here Page Processing Flow Add Custom UI Controls to Your Application
  • 12. Presentation title here PageComponent Add Custom UI Controls to Your Application
  • 13. Presentation title here is extended from BaseComponent (‘oroui/js/app/components/base/component’ module) implements Backbone.Events and Chaplin.EventBroker public methods initialize() and dispose() protected methods _deferredInit() and _resolveDeferredInit() see Page Component documentation http://goo.gl/BHxhgc PageComponent Add Custom UI Controls to Your Application
  • 14. Presentation title here {% set options = { metadata: metaData, // configuration options data: data // initial data } %} <div data-page-component-module ="path/to/component/module" data-page-component-options ="{{ options|json_encode }}"></div> Define PageComponent Add Custom UI Controls to Your Application
  • 15. Presentation title here Global Components/Views Add Custom UI Controls to Your Application
  • 16. Presentation title here Compositions (global components, views etc.) beforeAction: function() { // Reuse the Header view this.reuse('header', Header, {region: 'header'}); } see Chaplin.Composer documentation http://goo.gl/OMwq6e Composer Add Custom UI Controls to Your Application
  • 17. Presentation title here Performs necessary actions on start up, including the following: ● defines global components/views (that exist irrespective of the active controller) ● registers handlers in the mediator (see Chaplin. mediator doc http://goo.gl/r5pmfX) App Module Add Custom UI Controls to Your Application
  • 18. Presentation title here # Resources/config/requirejs.yml config: appmodules: - oroui/js/app/modules/views-module - oroui/js/app/modules/messenger-module App Module Declaration Add Custom UI Controls to Your Application
  • 19. Presentation title here require([ 'oroui/js/app/controllers/base/controller' ], function (BaseController) { BaseController.loadBeforeAction([ 'oroui/js/app/views/page/content-view' ], function (PageContentView) { BaseController.addToReuse( 'content', PageContentView, { el: 'mainContainer' } ); }); }); App Module Definition Add Custom UI Controls to Your Application
  • 20. Presentation title here https://github.com/grygir/DemoUIControlBundle cd <project_path>/src mkdir Acme cd Acme git clone git@github.com:grygir/DemoUIControlBundle.git cd DemoUIControlBundle Demo Example Add Custom UI Controls to Your Application
  • 21. Presentation title here $ app/console cache:clear $ app/console assets:install --symlink $ app/console assetic:dump $ app/console oro:translation:dump $ app/console oro:requirejs:dump Useful Commands Add Custom UI Controls to Your Application
  • 22. Presentation title here Example 1 Add Custom UI Controls to Your Application Navigation History: ● History is a list of links with the page titles and URLs. ● History items are ordered by time of visit (the latest are on the top). ● Records in the history are unique (by URL). ● Shows information on the number of visits and the time of the last visit for each record. ● “Clear the list” action is available for the history.
  • 23. Presentation title here Example 1, Outline Add Custom UI Controls to Your Application 1. Create App Module and History Component. 2. Create Model, Collection and Views 3. Develop control logic in History Component 4. Create templates for views 5. Reorder collection items on visited page 6. Add js translations 7. Add tooltips for the history links
  • 24. Presentation title here Example 2 Add Custom UI Controls to Your Application Task: Add WYSIWYG editor. Requirements: ● WYSIWYG editor should have a base set of functions ● Extend WYSIWYG and provide way to insert links from PinBar and Favorites collections
  • 25. Presentation title here Example 2, Outline Add Custom UI Controls to Your Application 1. Add a new FormType – WYSIWYG, as extend for the Textarea. 2. Define template block for WYSIWYG 3. Choose third-party WYSIWYG editor library 4. Bind the editor to HTML markup 5. Implement extra actions for WYSIWYG
  • 26. Presentation title here Conclusions Add Custom UI Controls to Your Application 1. Always keep in mind the life cycle of your component/view/model/collection (think who is going to take care of them, when they are not in use anymore)
  • 27. Presentation title here Conclusions Add Custom UI Controls to Your Application 2. Do not mix roles in your MVC application
  • 28. Presentation title here Conclusions Add Custom UI Controls to Your Application 3. Extend your application components from component oroui/js/app/components/base/component view oroui/js/app/views/base/view collection-view oroui/js/app/views/base/collection-view model oroui/js/app/models/base/model collection oroui/js/app/models/base/collection
  • 29. Presentation title here Conclusions Add Custom UI Controls to Your Application 4. Read documentation Backbone + Chaplin
  • 30. Presentation title here Questions Hryhorii Hrebiniuk hhrebiniuk@orocrm.com Adding custom UI controls to your application