Blog

Activity Log Toggle (New York)

Add a toggle button to expand/collapse the activity log. This can be helpful if you have a lot of entries in the activity log.

Code

Global for all tables using activity log

UI Script: ActivityLogToggle
UI Type: Desktop
Global: true
Script:

try{
   $j(document).ready(function(){
             setTimeout(addActivityToggle, 3000);//set delay to allow the activity log section to be generated by AngularJS
   });
}
catch(e){
   //alert('Error in processing addActivityToggle function due to: ' + e.message);
}
function addActivityToggle(){
   //Check to see if an element with the class name of '.activities-form' exists
   if($j('.activities-form').length){
         // Create the html for the toggle icon\button
         var toggButton = '<button id="activity_toggle_button" type="button" class="btn btn-default btn-ref icon-chevron-down sn-popover-basic"><span class="sr-only">Toggle Activity</span></button>';
         //Append the toggle button after the filter button
         $j('#activity_field_filter_popover').parent('.form-field-addons').append(toggButton);
         //Add the click function to hide\show the activity
         $j("#activity_toggle_button").click(function(){
               $j('.activities-form').toggle(500,function(){
                     //Set the icon image to icon-chevron-left when the activity is hidden
                     if($j(this).css('display') == 'none'){
                           $j("#activity_toggle_button").removeClass('icon-chevron-down').addClass('icon-chevron-left').css('box-shadow' ,'inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px gold');
                     }
                     //Else set the icon image to icon-chevron-down
                     else{
                           $j("#activity_toggle_button").removeClass('icon-chevron-left').addClass('icon-chevron-down').css('box-shadow','none');
                     }
               });
       });
   }
}

Alternate Method: Selectively use for only certain tables

Client Script: Activity Toggle
Table: your table here
When: onLoad
Isolate Script: false
UI Type: Desktop
Script:
function onLoad() {
	$j(document).ready(function(){
		setTimeout(addActivityToggle, 3000);//set delay to allow the activity log section to be generated by AngularJS
	});
}

UI Script: ActivityLogToggle
Global: true
UI Type: Desktop
function addActivityToggle(){
	//Check to see if an element with the class name of '.activities-form' exists
	//Ignore Print Screen
	if($j('.activities-form').length){
		// Create the html for the toggle icon\button
		var toggButton = '<button id="activity_toggle_button" type="button" class="btn btn-default btn-ref icon-chevron-down sn-popover-basic"><span class="sr-only">Toggle Activity</span></button>';
		//Append the toggle button after the filter button
		$j('#activity_field_filter_popover').parent('.form-field-addons').append(toggButton);
		//Add the click function to hide\show the activity
		$j("#activity_toggle_button").click(function(){
			$j('.activities-form').toggle(500,function(){
				//Set the icon image to icon-chevron-left when the activity is hidden
				if($j(this).css('display') == 'none'){
					$j("#activity_toggle_button").removeClass('icon-chevron-down').addClass('icon-chevron-left').css('box-shadow' ,'inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px gold');
				}
				//Else set the icon image to icon-chevron-down
				else{
					$j("#activity_toggle_button").removeClass('icon-chevron-left').addClass('icon-chevron-down').css('box-shadow','none');
				}
			});
		});
	}
}