Using jquery and CSS to Gain Easy Wins in CiviCRM



Similar documents
Magic Liquidizer Documentation

Tutorial JavaScript: Switching panels using a radio button

ireview Template Manual

Gantry Basics. Presented By: Jesse Hammil (Peanut Gallery: David Beuving)

Citrix StoreFront. Customizing the Receiver for Web User Interface Citrix. All rights reserved.

How To Customize A Forum On Vanilla Forum On A Pcode (Forum) On A Windows (For Forum) On An Html5 (Forums) On Pcode Or Windows 7 (Forforums) On Your Pc

How To Change Your Site On Drupal Cloud On A Pcode On A Microsoft Powerstone On A Macbook Or Ipad (For Free) On A Freebie (For A Free Download) On An Ipad Or Ipa (For

OPENTABLE GROUP SEARCH MODULE GETTING STARTED ADD RESERVATIONS TO YOUR WEBSITE

Certified PHP/MySQL Web Developer Course

Lisa Sabin-Wilson WILEY. Wiley Publishing, Inc.

WP Popup Magic User Guide

jquery Tutorial for Beginners: Nothing But the Goods

BT CONTENT SHOWCASE. JOOMLA EXTENSION User guide Version 2.1. Copyright 2013 Bowthemes Inc.

JTouch Mobile Extension for Joomla! User Guide

Linking a script in a WordPress theme

CLASSROOM WEB DESIGNING COURSE

Joostrap RWD Bootstrap Template

Adolfo G. Nasol The Bethel Educational Support and Technology Inc.

This manual cannot be redistributed without permission from joomla-monster.com

CiviCRM for Joomla! Integration, Best Practices, Extensions, and More. Jeremy Proffitt // Brian Shaughnessy

Elgg 1.8 Social Networking

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

SIMGallery. User Documentation

USER S MANUAL JOOMLA! GOVERNMENT WEB TEMPLATE

Magento Responsive Theme Design

Base template development guide

BT BACKGROUND SLIDESHOW JOOMLA EXTENSION User guide Version 2.0

Configuring the JEvents Component

ADMINISTRATOR GUIDE VERSION

Example. Represent this as XML

WP Popup Magic User Guide

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

Joomla! template Blendvision v 1.0 Customization Manual

Building Your First Drupal 8 Company Site

Installing and Using Joomla Template Created with Artisteer

Dreamweaver CS5. Module 2: Website Modification

A set-up guide and general information to help you get the most out of your new theme.

Getting Started Guide

Basic tutorial for Dreamweaver CS5

Web Design Technology

Skills for Employment Investment Project (SEIP)

Bubble Code Review for Magento

Web2CRM Honeypot Captcha Manual

Using your content management system EXPRESSIONENGINE CMS DOCUMENTATION UKONS

Responsive HTML and Drupal

Hermes.Net Web Campaign Page 2 26

WEB DESIGN COURSE CONTENT

Site.com Workbook. Version 1: Summer 14. Last updated: July 4, 2014

Sizmek Formats. IAB Mobile Pull. Build Guide

Trainer name is P. Ranjan Raja. He is honour of and he has 8 years of experience in real time programming.

WebLink 3 rd Party Integration Guide

The easy way to a nice looking website design. By a total non-designer (Me!)

Fast track to HTML & CSS 101 (Web Design)

Installing and Sending with DocuSign for NetSuite v2.2

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Developers Guide version 1.1

CMSC434 TUTORIAL #3 HTML CSS JavaScript Jquery Ajax + Google AppEngine Mobile WebApp HTML5

SPELL Tabs Evaluation Version

Content Manager User Guide Information Technology Web Services

Creating a Drupal 8 theme from scratch

Module Customer Ratings and Reviews Pro + Google Rich Snippets Module

Create or customize CRM system dashboards

If you, God forbid, find a bug, let me know and I ll try to fix it as soon as I can, ok?

Introduction to Adobe Dreamweaver CC

JJY s Joomla 1.5 Template Design Tutorial:

ISE Web Portal Customization Options. Secure Access How-to User Guide Series

ultimo theme Update Guide Copyright Infortis All rights reserved

Module Google Rich Snippets + Product Ratings and Reviews

IMPLEMENTING AND DEVELOPING FOR WORDPRESS IN CIVICRM 4.6 AND BEYOND. Kevin Cristiano April 2015 Tadpole

Subject Tool Remarks What is JQuery. Slide Javascript Library

Responsive Web Design for Drupal

Manage Website Template That Using Content Management System Joomla

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

This short guide will teach you how to turn your newly installed Joomla 2.5 site into a basic three page website.

Web Development I & II*

CST 150 Web Design I CSS Review - In-Class Lab

Instructions for Embedding a Kudos Display within Your Website

Development Specifications. January 14th, 2012

BT MAGAZINE. JOOMLA 3.x TEMPLATE. Total User Guide Version 1.0. Copyright 2013 Bowthemes.com

Mistral Joomla Template

Localizing dynamic websites created from open source content management systems

Advantage of Jquery: T his file is downloaded from

Dreamweaver CS5. Module 1: Website Development

css href title software blog domain HTML div style address img h2 tag maintainingwebpages browser technology login network multimedia font-family

Drupal 7 Fields/CCK Beginner's Guide

Love and Devotion. Richard Hayward State Library of Victoria. 14 January 2012, 2:30 3:15pm.

AUDIT REPORT EXAMPLE

Mastering Magento Theme Design

UCL INFORMATION SERVICES DIVISION INFORMATION SYSTEMS. Silva. Introduction to Silva. Document No. IS-130

What s New in Version 10 Details for Web Essentials

Magento 1.3 Theme Design

Getting Started Developing JavaScript Web Apps. this = that. VT Geospatial Forum 2015

WordPress Security Scan Configuration

User Guide for Smart Former Gold (v. 1.0) by IToris Inc. team

AppShore Premium Edition Campaigns How to Guide. Release 2.1

Drupal CMS for marketing sites

NetFlow for SouthWare NetLink

Dashboard Skin Tutorial. For ETS2 HTML5 Mobile Dashboard v3.0.2

FormAPI, AJAX and Node.js

Joomla! Actions Suite

Transcription:

Using jquery and CSS to Gain Easy Wins in CiviCRM The CMS agnostic, cross browser way to get (mostly) what you want By Stuart from Korlon LLC (find me as "Stoob")

Why is this method OK to use? CiviCRM already uses jquery and CSS jquery and CSS can be used with any CMS supported by CiviCRM: Drupal, Joomla, Wordpress - any version jquery takes the guesswork out of crossbrowser script compatibility issues jquery cures disease and feeds children ;-)

What are some common uses? Showing and hiding certain parts of a form Changing label width and label contents Hiding tabs and hiding fields unnecessary in your use case Adding headers, changing styles, adding descriptive text

When do I use what? Showing and hiding certain parts of a form Changing label width and label contents Hiding tabs and hiding fields unnecessary in your use case Adding headers, changing styles, adding descriptive text jquery is red. CSS is blue. Magenta is either....and CiviCRM loves you.

Why do it this way? No merging/diffing.tpl or.php files each time you upgrade Civi No modules and PHP that are different for each CMS. Reuse code & save time Requires no knowledge of Smarty or PHP Flexibility to add jquery/css wherever you want: blocks, templates, modules, themes...

Why not do it this way? When you require actual security. These methods only hide, show and alter things When your user base turns off Javascript When you want to manipulate data and processing, not just presentation and UI Because you feel more comfortable doing it another way

How do I jquery? <script> jquery goes here. </script> in a Drupal block, Joomla module, template, or theme but... Drupal 7 now uses a wrapper like: <script> (function ($) { jquery goes here. }(jquery)); </script>

How do I CSS? Add CSS to your theme, template, or block that is called after civicrm.css. This should override whatever CSS defaults there are Suggest not configuring alternate civicrm.css file or editing this file directly Use Firebug or Chrome to inspect element, use exact or more specific selector to override

Do's and Don'ts 1. Don't use drupal_add_js() function 2. Do make sure that wherever you are putting the jquery reads it as <script>. Don't use filters or input modes that wreck it 3. If put in Smarty tpl, do <literal> tags like: <literal> <script> your code </script> </literal>

Cool Trick! whatever.extra.tpl Save yourself the headache of diff'ing or merging.tpl on upgrade. 1. Create custom TPL directory (read docs) 2. Rather than add the whole file name it whatever.extra.tpl 3. It will be appended to the end of the file each time 4. As of 4.2 will even work with /n/ versions Thanks Dave Greenberg!

Do's and Don'ts 4. Do use visibility settings to limit the <script> to CiviCRM where you want it such as: civicrm/contribute/transact 5. Do use javascript to limit the code to the specific page you want using id=n in URL <script> if (document.location.href.indexof('id=n') > 0 ) {... } </script> 6. Do use the cj("id#element") namespace

CSS Commonly Used element#id { display: none; } element.class { width: Npx; } element#id { text-decoration: none; font-weight: normal; } element#id.double.class { float: clear; } You may have to get specific like: #content #crm-container div.class { }

jquery Commonly Used.hide() and.show().click().val().before() and.after().html().replacewith().change().ready().addclass() and removeclass()

Real Example: Price Set Subheaders <style type="text/css"> div.date-subheader { width: 22%; font-weight: bold; textalign: right; } </style> <script> cj("div. Panel_Presentations_in_Collaborsection").before("<div class='crm-section datesubheader'>thursday, May 24</div>"); </script> Inserted into page.php in Wordpress theme.

Real Example: Simple Activities This is an actual 'create activity' screen in Civi simplified for non-techie users to show only the fields that matter.

Real Example: Simple Activities This is what it used to look like.

Real Example: Simple Activities First get the activity type id#, then go nuts with hide(), replacewith() and before() if (getparameterbyname('atype')) { var choice = getparameterbyname('atype'); if (choice == '12') { cj("tr.crm-activity-form-block-source_contact_id").hide(); cj("tr.crm-activity-form-block-location").hide(); cj("tr.crm-activity-form-block-subject").hide(); cj("tr.crm-activity-form-block-assignee_contact_id").hide(); cj("tr.crm-activity-form-block-duration label").replacewith("<label for='duration'>... cj("tr.crm-activity-form-block-target_contact_id").before("<tr>...

Real Example: Peekaboo Forms Show a Profile on a contribution form only when a user selects an option. 1. Find the correct Contribution page with: document.location.href. indexof('id=n') > 0 2. Find the id# of the element you want to trigger and use it: $('input#civicrm_qfid_4_4').click(function() { cj(".custom_post_profile-group").show(); }); 3. While you're at it, preselect the state: cj("select#state_province-6").val('1045'); 4. And trigger a 'same as' address copy: cj('#custom_6\\[yes\\]').click(function() { cj("#city-7").val($("#city-6").val()); });