JavaScripts

From unroole CMS wiki
(Redirected from Javascript)
Jump to: navigation, search


Unroole Site Builder Admin Panel - Javascript Index.png

JavaScript entries applied to a channel.

JavaScripts allow admins to add additional global JavaScript code to an entire channel. They are useful for augmenting pages or layouts of channels with additional functionality that may not be provided as part of a theme. To get started with javascripts you must first be in advanced mode.

Adding

Unroole Site Builder Admin Panel - Javascript new.png

Creating a new simple JavaScript alert box on page load.

Adding a JavaScript entry to a channel is a good way to add dynamic functionality that may not be provided by a theme. For example adding printing or hover functionality that target specific widgets can be done by creating a JavaScript entry for a channel. Any javascript entries added to a channel are automatically appended to the header of a page in the order specified in the currently active [Theme]. To add a new javascript entry please follow these steps:

  1. Navigate to the JavaScript section under "Channel Content".
  2. Click the 'Create' button.
  3. Enter the name of the JavaScript entry for reference
  4. Add in your JavaScript code. The layout editor provides a number of tags and classes for you to reference. For more information see Layout Structure.
  5. Click 'Save' to finalize the creation of your javascript entry.

Notes:

  • Due to the nature of browser compatibility with certain JavaScript code the system does not check for valid syntax upon JavaScript creation.
  • Any JavaScript entries added to a channel will become available immediately after creation. It is highly recommended to target specific html tags or attributes unique to page versions if this JavaScript entry is only application to a particular version of a page.

Updating

Unroole Site Builder Admin Panel - Javascript Edit.png

Editing a javascript entry that is already active on a channel.

Updating a javascript entry employs a similar process to creation. Follow the steps below to update an existing javascript entry:

  1. Navigate to the Javascript section under "Channel Content".
  2. Click on the "edit" link beside one of the javascript entry you wish to edit.
  3. Update the name or javascript entry and code properties.
  4. Click "Save" to finalize the changes.

Removing

Unroole Site Builder Admin Panel - Javascript Removal.png

Highlighting the deletion buttons of javascript entries of a channel

To deactivate a javascript entry you need to delete it from your channel. Use the following steps to remove a javascript entry:

  1. Navigate to the Javascript section under "Channel Content".
  2. Find the javascript you wish to delete in the list or by searching
  3. Click the "delete" button
  4. You will be prompted to confirm your removal of the javascript entry
  5. Click "OK" to finalize the removal of the javascript entry.

Sometimes you may want to only temporarily remove the javascript entry from a channel. In this case you should first save a copy of the entry as a template for later use. To do this see the templates section for more details.

Templates

Unroole Site Builder Admin Panel - Javascript Duplicate.png

Copying a javascript from a channel to an account as a template.

Javascript templates are a good way to save commonly used javascript entries. There are two ways to create a new template. The first way is to generate a template from scratch just as you would a normal javascript entry. Alternatively any existing javascript entry or template can be duplicated as a new template. To copy a javascript to a template:

  1. Navigate to the Javascript under "Channel Content".
  2. Click the "Duplicate" button
  3. Select "Account (as a template)" as the area to duplicate into.
  4. Click "Submit" to create the template.

After a template is created you are able to make changes to it just as you would a normal javascript entry. For compatibility reasons any changes to templates will not be reflected in the javascripts created from them.

Unroole Site Builder Admin Panel - Javascript Templates.png

The javascript template index page. It works and functions much like the channel javascript entries.

Note that javascript templates are saved on the account level so that they are globally accessible to all channels under that account.