forked from forcedotcom/GIFter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f0dd00
commit 083f7f7
Showing
10 changed files
with
137 additions
and
28 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
force-app/main/default/aura/PostGIFToChatter/PostGIFToChatter.cmp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<aura:component implements="force:appHostable"> | ||
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"> | ||
|
||
Post GIF to Chatter | ||
|
||
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
<aura:component implements="force:appHostable"> | ||
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"> | ||
|
||
</aura:component> | ||
<aura:attribute name="searchTerms" type="String" /> | ||
<aura:attribute name="results" type="Map" /> | ||
|
||
<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> | ||
|
||
<ltng:require scripts="{!join(',', | ||
$Resource.jquery331, | ||
$Resource.GIPHY)}" afterScriptsLoaded="{!c.afterScriptsLoaded}" /> | ||
|
||
<lightning:card> | ||
|
||
<lightning:layout verticalAlign="end" class="path-to-zip slds-m-around--small"> | ||
<lightning:layoutitem flexibility="grow"> | ||
<span onkeypress="{!c.keyCheck}"> | ||
<lightning:input aura:id="searchTerms" type="text" label="Search Terms" value="{!v.searchTerms}" /> | ||
</span> | ||
</lightning:layoutitem> | ||
<lightning:layoutitem> | ||
<lightning:button onclick="{!c.search}">Search</lightning:button> | ||
</lightning:layoutitem> | ||
</lightning:layout> | ||
|
||
</lightning:card> | ||
|
||
<lightning:card> | ||
<lightning:layout horizontalAlign="center" multipleRows="true"> | ||
|
||
<aura:iteration items="{!v.results}" var="result"> | ||
<lightning:layoutItem padding="around-small" size="8" smallDeviceSize="6" mediumDeviceSize="4" largeDeviceSize="3"> | ||
|
||
<div class="gif-image"> | ||
<a onclick="{!c.gifSelected}"> | ||
<img src="{!result.images.fixed_height.url}"></img> | ||
</a> | ||
</div> | ||
|
||
</lightning:layoutItem> | ||
</aura:iteration> | ||
|
||
</lightning:layout> | ||
</lightning:card> | ||
|
||
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
.THIS { | ||
.THIS .gif-image { | ||
position:relative; | ||
width: 100%; | ||
text-align: center; | ||
display: block; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
.THIS .path-to-zip { | ||
margin-bottom: 12px; | ||
} | ||
|
||
.THIS .path-to-zip .slds-button { | ||
margin-left: 8px; | ||
} |
41 changes: 39 additions & 2 deletions
41
force-app/main/default/aura/SearchGIPHY/SearchGIPHYController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,42 @@ | ||
({ | ||
myAction : function(component, event, helper) { | ||
|
||
afterScriptsLoaded: function (component, event, helper) { | ||
console.log('afterScriptsLoaded called successfully'); | ||
}, | ||
|
||
doInit: function (component, event, helper) { | ||
console.log('doInit called successfully'); | ||
}, | ||
|
||
keyCheck: function (component, event, helper) { | ||
if (event.which == 13) { | ||
console.log('keyCheck detected enter') | ||
|
||
var searchTerms = component.get("v.searchTerms"); | ||
helper.search(searchTerms, function (results) { | ||
console.log('keyCheck enter returned from helper') | ||
component.set("v.results", results.data); | ||
}); | ||
|
||
} | ||
}) | ||
}, | ||
|
||
search: function (component, event, helper) { | ||
|
||
console.log('search called successfully'); | ||
|
||
var searchTerms = component.get("v.searchTerms"); | ||
helper.search(searchTerms, function (results) { | ||
console.log('search returned from helper') | ||
component.set("v.results", results.data); | ||
}); | ||
|
||
}, | ||
|
||
gifSelected: function (component) { | ||
var property = component.get("v.property"); | ||
|
||
console.log('gifSelected called successfully'); | ||
} | ||
|
||
}) |
21 changes: 18 additions & 3 deletions
21
force-app/main/default/aura/SearchGIPHY/SearchGIPHYHelper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
({ | ||
helperMethod : function() { | ||
search: function (searchTerms, data) { | ||
|
||
} | ||
}) | ||
console.log('search called successfully'); | ||
console.log(searchTerms); | ||
|
||
var apiKey = _GIPHY.getApiKey(); | ||
console.log(apiKey); | ||
|
||
$.getJSON("https://api.giphy.com/v1/gifs/search?api_key=" + apiKey + "&q=" + searchTerms + "&limit=8&offset=0&rating=G&lang=en", function (results) { | ||
|
||
console.log('called api'); | ||
console.log(results); | ||
console.log(results.data.length); | ||
|
||
data(results); | ||
|
||
}); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
force-app/main/default/staticresources/jquery331.resource-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<cacheControl>Private</cacheControl> | ||
<contentType>text/javascript</contentType> | ||
</StaticResource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters