Skip to content

Instantly share code, notes, and snippets.

View Avinava's full-sized avatar

Avi Avinava

View GitHub Profile
@Avinava
Avinava / RemoteObjects.page
Created June 7, 2014 12:14
Using Salesforce RemoteObjects with JSRender : Create a stateless Table
<apex:page >
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"/>
<apex:includeScript value="https://rawgithub.com/BorisMoore/jsrender/master/jsrender.min.js"/>
<apex:remoteObjects >
<!--Name the field you like to query-->
<apex:remoteObjectModel name="Contact" jsShorthand="con" fields="Id,Name,FirstName,LastName,Phone,Email"/>
</apex:remoteObjects>
<script>
//function to invoke the retreive call to query records
@Avinava
Avinava / SimpleSite.Page
Last active August 29, 2015 14:01
SimpleSite.page
<apex:page showHeader="false" docType="html-5.0" >
<vs:importvisualstrap />
<style>
body{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.intro{
margin-top:20px;
font-size:140%;
font-weight: 200;
@Avinava
Avinava / UserDashboard.cls
Created May 26, 2014 10:42
UserDashboard Controller
public without sharing class VSDashBoard_Con {
public List<Task> getTasks(){
return [SELECT Id,Subject,Status, ActivityDate FROM Task WHERE ActivityDate = TODAY AND Status != 'Completed' AND Status != 'Deferred'];
}
public List<Case> getCases(){
return [SELECT Id,CaseNumber,Status,Subject, Priority FROM Case WHERE OwnerId=:UserInfo.getUserId() AND isClosed = FALSE];
}
public List<Lead> getLeads(){
return [SELECT Id,Name,Status, CreatedDate FROM Lead WHERE OwnerId=:UserInfo.getUserId() AND IsUnreadByOwner = true];
}
@Avinava
Avinava / UserDashboard.page
Created May 26, 2014 10:40
UserDashboard Page
<apex:page sidebar="false" docType="html-5.0" controller="VSDashBoard_Con">
<vs:importvisualstrap />
<script>
function goToDetailPage(recId){
if(typeof sforce != 'undefined' && typeof sforce.one != 'undefined'){
sforce.one.navigateToSObject(recId);
}
else{
window.location.href = '/'+recId;
}
@Avinava
Avinava / CaseOverView.page
Created May 26, 2014 10:28
Visualstrap Case Overview page
<apex:page standardController="Case" sidebar="false" docType="html-5.0">
<style>
.glow{
animation: flashBg 0.9s;
-webkit-animation: flashBg 0.9s alternate infinite;
}
@keyframes flashBg
{
from {
border: 3px solid #ff6161;