Skip to content

Instantly share code, notes, and snippets.

View JitendraZaa's full-sized avatar

Jitendra Zaa JitendraZaa

View GitHub Profile
@JitendraZaa
JitendraZaa / Lookup.cls
Last active July 6, 2017 00:40
Controller class to be used by Lookup Lightning Component
/**
* @Author : Jitendra Zaa
* @Date : 4-Jul-2017
* @Desc : Controller for Lookup Lightning Component
* */
public class Lookup {
/**
* Returns JSON of list of ResultWrapper to Lex Components
* @objectName - Name of SObject
@JitendraZaa
JitendraZaa / AccountEdit.cmp.html
Last active July 31, 2019 12:25
Salesforce Lightning Data Service Demo Code
<aura:component implements="force:appHostable,
flexipage:availableForRecordHome,force:hasRecordId"
access="global" >
<aura:attribute name="account" type="Object"
description="The record object to be displayed"/>
<aura:attribute name="accountRecord" type="Object"
description="A simplified view record object to be displayed"/>
<aura:attribute name="recordSaveError" type="String"
description="An error message bound to force:recordData"/>
@JitendraZaa
JitendraZaa / AccountDisplay.cmp.html
Created July 22, 2017 00:57
View mode of Salesforce Lightning Data Service
<aura:component implements="flexipage:availableForAllPageTypes,
flexipage:availableForRecordHome,force:hasRecordId"
access="global" >
<aura:attribute name="account" type="Object"
description="The record object to be displayed"/>
<aura:attribute name="accountRecord" type="Object"
description="A simplified view record object to be displayed"/>
<aura:attribute name="recordError" type="String"
description="An error message bound to force:recordData"/>
/**
* Author : Jitendra Zaa
* Desc : This Controller is used by Lightning component to make Http request to Wikipedia
* */
public class WikiHttpRequest {
@AuraEnabled
public static String getWikiResponse(String searchText, Integer searchLimit){
HttpRequest req = new HttpRequest();
req.setEndpoint( 'https://en.wikipedia.org/w/api.php?action=opensearch&search=' + searchText + '&limit='+
/**
* Author : Jitendra Zaa
* Desc : Test class for Lightning controller WikiHttpRequest
* */
@isTest
public class MockWikiHttpRequest implements HttpCalloutMock {
// Implement this interface method
public HTTPResponse respond(HTTPRequest req) {
// Create a fake response
HttpResponse res = new HttpResponse();
<aura:component controller="WikiHttpRequest"
implements="force:appHostable,flexipage:availableForAllPageTypes">
<ltng:require styles="/resource/SLDS090/assets/styles/salesforce-lightning-design-system.css"/>
<aura:attribute name="txtWikiText" type="String"/>
<aura:attribute name="resultLimit" type="Integer" default="4"/>
<div class="slds-card">
<div class="slds-card__header slds-grid">
<div class="slds-media slds-media--center slds-has-flexi-truncate">
<div class="slds-media__figure">
({
searchWiki : function(component, event, helper) {
if(event.getParams().keyCode == 13){
helper.wikiCallOut(component.get('v.txtWikiText'),component, helper);
}
},
searchWikiOnButton : function(component, event, helper){
helper.wikiCallOut(component.get('v.txtWikiText'),component, helper);
}
})
<design:component>
<design:attribute name="resultLimit" label="Result Limit" description="Total number of results to display" />
</design:component>
<aura:component >
<aura:attribute type="String" name="header" />
<aura:attribute name="body" type="Aura.Component[]"/>
<aura:attribute name="collpaseText" type="String" default="[ + ]"/>
<div>
<div class="Message">
<div style="width:90%;float:left"> {!v.header} </div>
<div class="expandCollapse" onclick="{!c.ToggleCollapse}"> {!v.collpaseText} </div>
</div>
<div class="container hide" aura:id="containerCollapsable">
<aura:application >
<c:CollapsiblePanel header="CollapsiblePanel Demo">
<aura:set attribute="body">
<ui:message title="Confirmation" severity="confirm" closable="true">
This is an example of confirmation message.
</ui:message>
<ui:message title="Information" severity="info" closable="true">
This is an example of message.
</ui:message>
<ui:message title="Warning" severity="warning" closable="true">