Follow these guidelines to
ensure that you implement widgets similarly and do not create conflict
among the widgets.
-
Think of the site and theme generically. As an administrator,
you can place widgets anywhere on the site, even if they're not designed
to live on that page in that location.
-
Widget code:
-
Use out-of-the-box base classes. When implementing all
widgets, be sure to use only out-of-the-box base classes.
-
Name widgets based on the API. Similar to Chameleon naming
guidelines, always name widgets based on the API (e.g., use MediaGalleryPost for a widget that renders a
media post and MediaGalleryLinks for
a widget that renders links associated with a media gallery).
-
Define classes in ContentFragments namespaces (e.g., CommunityServer.Controls.ContentFragments, CommunityServer.MediaGalleries.ContentFragments,
etc.).
-
Identify the application and purpose in rendered names (e.g., Blog - Post, Blog
- Post List).
-
Identify the required context. If the widget will only render
when specific data is available, be sure to override the bool HasRequiredContext(Control) method and
correctly identify when the data needs of the widget are met.
-
Widget markup:
-
Use the style and markup guide. We've defined the standards
for all markup rendered by applications built on the Telligent Evolution
platform and, whenever possible, you should use the full format and
order of these markup formats.
-
Use markup translations to adjust standard markup. When
styling individual themes, use markup translations to adjust or add
standard class names to meet the needs of an individual theme.
-
Widget CSS:
-
Use the style/markup guide. We've defined the standards for
all
markup and related styles so use it whenever possible. Always respect
the full format, order and naming of standard markup and classes and
never implement in-line styles (except widget-related JavaScript).
-
Use markup translations to add or adjust standard CSS. When
adding CSS classes through markup translations, always prefix the new
class names with the name of the theme (e.g., fiji-NEW_CLASS_NAME
instead of just NEW_CLASS_NAME).
-
Never use in-line styles to style the widget wrapper. Inline
styles should always be avoided; however,
extra care should be used when dealing with widget wrappers because
they are end-user configurable. Any
custom CSS affecting wrappers should not prevent end-user wrapping
options from
functioning.
-
Widget JavaScript/AJAX:
-
Follow the AJAX guidelines:
- Store all widget-specific script in a separate JS file.
- Name widget-specific functions with the widget's application and
name.
- Use context variables to pass widget-specific configuration data to
the widget-specific functions.
- Always process markup translations manually when passing raw markup
through JavaScript.
- Ensure that all rendered text is localized.
-
Use JQuery to aid in the implementation of widgets. Use the <CSControl:JQuery /> and
related controls to identify that the widget requires JQuery.