JQuery Listings Operations Buttons
Overview
Description of markup, DOM elements and attributes involved in displaying operations buttons within CMS listings pages.
Markup
- Use
<a>anchor tags for links to separate pages. - Use
<button>button tags for links that open jQuery/AJAX dialogs. - Example:
<td class="centered">
<div class="listops"><!--
--><a class="preview-btn" href="<?=$row->local_url?>" target="_blank" title="live content">live content</a><!--
--><button data-id="<?=$row->id?>" data-tid="<?=press_class::SECTION_ID?>" data-op="delete" title="delete">delete</button>
</div>
</td>
- Outside TD element has class “centered”.
- Inner DIV element class “listops”.
- Each button is created with an anchor tag.
Button element attributes
href="javascript:void(0)" rel="nofollow"for buttons that have AJAX handlers.
- The
classattribute of the anchor determines its button style and its AJAX handler. (Buttons implemented with the JQuery UI library.)- Some common button classes handled by the
$.bindListingsButtons()routine of theLITTLED.Listingslibrary: details-btnLinks to stand-alone page containing detailed information about the individual record.preview-btnLinks to stand-along page on the public site driven by that individual record.print-btnPrints the record, or opens a page specially formatted for printing the individual record.update-cache-btnInvokes AJAX that updates the cached content for the individual record.edit-btnOpens record edit dialog/page.trash-btnOpens delete record dialog/page.
- Some common button classes handled by the
- Configure the AJAX handlers for listings operations with JQuery within the page’s
$(document).ready();handler. “data-*”attributes of the anchor tags specify which records to operate on when calling AJAX handlers. Some examples:data-id– record iddata-tid– record content type iddata-pid– record parent iddata-op– operation name
- Each anchor tag has a title attribute which serves as a tooltip.
- The innerhtml of the anchor tag is not displayed if the JQuery UI button is successfully loaded.