forked from trailheadapps/dreamhouse-sfdx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PropertyCarousel.cmp
34 lines (28 loc) · 1.64 KB
/
PropertyCarousel.cmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes" controller="PropertyController" access="global">
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="property" type="Property__c" />
<aura:attribute name="files" type="Object[]" />
<force:recordData recordId="{!v.recordId}"
targetFields="{!v.property}"
fields="['Id', 'Name', 'Address__c', 'Description__c']"/>
<aura:handler name="init" value="{!this}" action="{!c.onInit}" />
<aura:handler event="ltng:selectSObject" action="{!c.recordChangeHandler}"/>
<lightning:card title="{!v.property.Name}" iconName="custom:custom38">
<aura:if isTrue="{!v.files.length > 0}">
<lightning:carousel disableAutoRefresh="true">
<aura:iteration items="{!v.files}" var="file" indexVar="index">
<lightning:carouselImage src="{! '/sfc/servlet.shepherd/version/download/' + file.Id}" />
</aura:iteration>
</lightning:carousel>
<aura:set attribute="else">
<div class="card-content">
<lightning:icon iconName="utility:photo" size="medium" class="slds-align_absolute-center"/>
<p class="slds-text-color--weak">There are currently no pictures for this property.</p>
</div>
</aura:set>
</aura:if>
<div class="card-content">
<lightning:fileUpload label="Add picture" multiple="true" accept=".jpg, .png, .gif" recordId="{!v.recordId}" onuploadfinished="{!c.onUploadFinished}"/>
</div>
</lightning:card>
</aura:component>