28

Aloha Presentation #t3con10

Embed Size (px)

DESCRIPTION

Aloha Editor presentation from T3CON10 in Frankfurt about integration & extension

Citation preview

Page 1: Aloha Presentation #t3con10
Page 2: Aloha Presentation #t3con10

Clemens Prerovsky

twitter.com/blacktarmac

[email protected]

Page 3: Aloha Presentation #t3con10

Phoenix

+

Page 4: Aloha Presentation #t3con10

Agenda

• Concepts

• Technical Anatomy

• Demo PluginDevelopment

• Roadmap

Page 5: Aloha Presentation #t3con10

Alohais about

the flow

Page 6: Aloha Presentation #t3con10

Alohais about

just 15 Buttons

Page 7: Aloha Presentation #t3con10

Alohais about

easy development

Page 8: Aloha Presentation #t3con10

Editables

Just edit.Click and edit. This is all you need. While editing you want to see the results immediately without previews or reloads. With Aloha Editor you work on the final document.

Page 9: Aloha Presentation #t3con10

Floating Menu

Page 11: Aloha Presentation #t3con10

TechnicalAnatomy

Core

Editables FloatingMenu Ribbon Sidebar

UI EventsSelection /

RangeLogging i18n

jQuery ExtJS / Sencha

Plugins

Format Table Link List

Repositories

Page 12: Aloha Presentation #t3con10

Developing

a „Product“plugin

Page 14: Aloha Presentation #t3con10

Core

Editables FloatingMenu Ribbon Sidebar

UI EventsSelection /

RangeLogging i18n

jQuery ExtJS / Sencha

Plugins

Format Table Link List

Repositories

Page 15: Aloha Presentation #t3con10

A new plugin...

/**

* Aloha Product Example Plugin

*/

EXAMPLE.Product =

new GENTICS.Aloha.Plugin('com.example.aloha.plugins.Product');

com.example.aloha.plugins.Product

Page 16: Aloha Presentation #t3con10

Initialization & adding the insert button

/**

* Initialize the plugin

*/

EXAMPLE.Product.init = function () {

var that = this;

// floating menu "Insert product"-button

var insertButton = new GENTICS.Aloha.ui.Button({

'iconClass' : 'GENTICS_button GENTICS_button_product',

'size' : 'small',

'onclick' : function () {

that.insertProduct();

},

'tooltip' : this.i18n('button.insertproduct'),

'toggle' : false

});

GENTICS.Aloha.FloatingMenu.addButton(

'GENTICS.Aloha.continuoustext',

insertButton,

GENTICS.Aloha.i18n(GENTICS.Aloha, 'floatingmenu.tab.insert'),

1

);

Scope!

TabGroup

Page 17: Aloha Presentation #t3con10

// product scope & product attribute field

GENTICS.Aloha.FloatingMenu.createScope(this.getUID('product'), 'GENTICS.Aloha.global');

this.productField = new GENTICS.Aloha.ui.AttributeField();

this.productField.setTemplate('<span><b>{displayName}</b>' +

'<span class="product-preview" style="background-image: url({url});"></span>' +

'<br class="clear" /><i>{objectType}</i></span>');

this.productField.setObjectTypeFilter(['product']);

GENTICS.Aloha.FloatingMenu.addButton(

this.getUID('product'),

this.productField,

this.i18n('floatingmenu.tab.product'),

1

);

A new Scope& the Attribute Field

Page 18: Aloha Presentation #t3con10

Insert Product

/**

* insert a product at the cursor position

*/

EXAMPLE.Product.insertProduct = function () {

// activate floating menu tab

GENTICS.Aloha.FloatingMenu.userActivatedTab = this.i18n('floatingmenu.tab.product');

// current selection or cursor position

var range = GENTICS.Aloha.Selection.getRangeObject();

// insert a product

var newProduct = jQuery('<div class="GENTICS_block product" contenteditable="false">' +

'<div class="image"></div>' +

'<div class="name">' + this.i18n('newproductname') + '</div></div>');

// insert the product into the dom and focus it

GENTICS.Utils.Dom.insertIntoDOM(newProduct, range,

jQuery(GENTICS.Aloha.activeEditable.obj));

range.startContainer = range.endContainer = newProduct.contents().get(0);

range.select();

this.productField.focus();

};

Switch Tab

Cursor Pos

Page 19: Aloha Presentation #t3con10

Handle selectionChanged

// handle event as soon as a product block is clicked

GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha, 'selectionChanged', function(event, rangeObject) {

var foundMarkup = that.findProduct( rangeObject );

jQuery('.product-selected')

.removeClass('product-selected');

if ( foundMarkup.length != 0 ) {

GENTICS.Aloha.FloatingMenu

.setScope(that.getUID('product'));

that.productField.setTargetObject(foundMarkup,

'data-product-name');

foundMarkup.addClass('product-selected');

}

// re-layout the Floating Menu

GENTICS.Aloha.FloatingMenu.doLayout();

});

Events

„Link“ Attribute

Field

Page 20: Aloha Presentation #t3con10

So far…

Page 21: Aloha Presentation #t3con10

Repositories

/**

* Create the resource object

*/

GENTICS.Aloha.Repositories.Product = new

GENTICS.Aloha.Repository('com.gentics.aloha.resources.Product');

/**

* resource data

*/

GENTICS.Aloha.Repositories.Product.settings.data = [

{

id: 1,

displayName: 'Kuota Kueen K',

url:'kuota-kueen-k.jpg',

objectType: 'product'

},{

id: 2,

displayName: '2XU Wetsuit',

url:'2xu-wetsuit.jpg',

objectType: 'product'

},…

];

A new Repository

Page 22: Aloha Presentation #t3con10

Query & update selected Product

/**

* Searches a resource for resource items matching query if objectTypes.

*/

GENTICS.Aloha.Repositories.Product.query = function(queryString, objectTypeFilter, filter,

inFolderId, orderBy, maxItems, skipCount, renditionFilter, callback) {

var d = this.settings.data.filter(function(e, i, a) {

var r = new RegExp(queryString, 'i');

return (

jQuery.inArray(e.objectType, objectTypeFilter) > -1 &&

( e.displayName.match(r) || e.url.match(r) )

);

});

callback.call( this, d);

};

/**

* callback after a product has been selected from the resource

*/

GENTICS.Aloha.Repositories.Product.markObject = function (obj, resourceItem) {

EXAMPLE.Product.updateProduct(obj, resourceItem);

};

Filtering

Page 24: Aloha Presentation #t3con10

LinkPlugin

Next up…

Page 25: Aloha Presentation #t3con10

POW!

BOOM!

CRUNCH!!!

ZONK! BOINK!

SemanticsFramework

Page 26: Aloha Presentation #t3con10

Collaboration

Page 28: Aloha Presentation #t3con10