+ All Categories
Home > Technology > SugarCON 2009 - Theme Development in Sugar 5.5

SugarCON 2009 - Theme Development in Sugar 5.5

Date post: 17-May-2015
Category:
Upload: john-mertic
View: 1,158 times
Download: 3 times
Share this document with a friend
Popular Tags:
23
Transcript
Page 1: SugarCON 2009 - Theme Development in Sugar 5.5
Page 2: SugarCON 2009 - Theme Development in Sugar 5.5

©2009 SugarCRM Inc. All rights reserved.

Theme Development in Sugar 5.5

John Mertic

SugarCRM

Page 3: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 3

Agenda

Themes before Sugar 5.5

Goals of Theme improvements

Demo Time!

Upgrading old Themes

Questions?

Page 4: SugarCON 2009 - Theme Development in Sugar 5.5

Themes prior to Sugar 5.5

12/30/08 ©2009 SugarCRM Inc. All rights reserved. 4

Page 5: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 5

Hard to create

Lots of copy and pasting from existing themesHeader/footer PHP code

Duplicate Images / Javascript

Results in breakages of themes over timeMany bugs exist in themes because of not applying changes to every theme.

Page 6: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 6

Hard to create

CSS was very uglyNot intuitive to know which styles to change

Unclear on how to make simple changes to the layout

Page 7: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 7

Hard to work with existing themes

No way to modify theme in an upgrade-safe wayHave to replace theme components and then re-apply modification after version upgrades

Page 8: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 8

Hard to work with existing themes

Could not leverage existing theme in a new themeHad to copy all components of the theme to the new theme

Would not get bug fixes and upgrades from existing theme

Page 9: SugarCON 2009 - Theme Development in Sugar 5.5

This needs to be MUCH easier.

12/30/08 ©2009 SugarCRM Inc. All rights reserved. 9

Page 10: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 10

Goals of Theme Improvements

Clean up CSS and HTML

Simplify the theme directory layout.

Allow themes to inherit from other themes.

Allow upgrade-safe modifications to themes.

Improve theme performance

Page 11: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 11

Clean up CSS and HTML

Standardize the layout of the application

Break apart the UI components into separate templates, identified by DIV tags

Page 12: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 12

Clean up CSS and HTML

Each component is built in it’s own template, which is assembled in the main header template

Allows customization of the HTML layout of the header without having to copy/paste or change the code of each component.

Page 13: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 13

Clean up CSS and HTML

Removed and updated many CSS class namesAdded base classes for the container HTML elements

.view, .edit, .detail, etc

Child element styles can be defined from them

Example: .edit.view td[scope=row] to style editview label

Page 14: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 14

Simplify Theme Directory Layout

Move theme components into directories

css/ - contains all css files

images/ - contains all images

js/ - contains any js files.

tpls/ - smarty templates

Only file in theme directory is the themedef.php definition file.

Page 15: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 15

Allow themes to inherit from other themes

All themes by default will extend from a default theme.

Contains all images used in the application

Base CSS styleUses YUI base.css to help browser inconsistencies

Provides default styling and positioning for most theme elements

Contains base templates for non-content sections ( header, left sidebar, footer )

Can also extend from an existing theme.

Page 16: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 16

Allow themes to inherit from other themes

Theme Inheritance Model

Page 17: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 17

Allow upgrade-safe modifications to themes

All themes can be modified by putting the replacement or overriding file in the custom/theme/<themename> directory

Image, HTML template file overrides are used as a replacement of the previous file

Example: an image custom/theme/<themename>/dog.gif would be used instead of theme/<themename>/dog.gif

CSS and Javascript files are combined in order of inheritance

Uses cssmin and jsmin to help reduce file size

No further code changes are required – changes are picked up automatically when themes cache is rebuilt.

Page 18: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 18

Improve theme performance

Cleaned up layout template has reduced payload size 5-10%

Removed much of the Javascript that can be done in other ways

Dropdown menus – now pure CSS

Row highlighting – now uses :hover pseudo-class

Removed much of the inline javascript, now is unobtrusive

Duplicate javascript removed

Automatic minifying of CSS and Javascript code before delivering it to the client

Caching of theme file locations ( requires external cache )

Page 19: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 19

Demo Time!

Changing images in a theme.

Customize colors and fonts in a theme.

Change layout of a theme.

Fixes to a few forums problems

Page 20: SugarCON 2009 - Theme Development in Sugar 5.5

Upgrading old Themes to work in Sugar 5.5

12/30/08 ©2009 SugarCRM Inc. All rights reserved. 20

Page 21: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 21

Theme Upgrading

Setup the new theme directory layoutMove images to images/ directory, css files to css/ directory, and javascript to js/ directory.

Create the themedef.php fileSettings come from the config.php file and layout_utils.php file.

Defined as an associative array ( similar to vardefs.php ).

Page 22: SugarCON 2009 - Theme Development in Sugar 5.5

12/30/08©2009 SugarCRM Inc. All rights reserved. 22

Theme Upgrading

Consolidate FilesMove contents of core styles ( navigation.css, style.css, calendar-win2k-cold-1.css ) to style.css

Remove any duplicate images or js files from default theme.

Convert CSS stylesSpec will be provided on style changes

Should mostly be a find and replace operation, but you’ll need to take into account css styling from the default theme.

Make any layout changes to the tpls/header.tpl file.Only required if your theme has a non-standard layout

Page 23: SugarCON 2009 - Theme Development in Sugar 5.5

Questions?

12/30/08 ©2009 SugarCRM Inc. All rights reserved. 23


Recommended