...
- Create a new file called superHero.cfc and save this into your project's ./packages/types directory.
- Copy the following code into this file, save and review with the instructor
Code Block title ./myproject/packages/types/superHero.cfc <cfcomponent name="superHero" extends="farcry.core.packages.types.types" output="false" displayname="Super Hero"> <cfproperty name="title" type="string" default="" hint="Super hero title." /> <cfproperty name="secretHideout" type="string" hint="The secret hideout location of the super hero" /> <cfproperty name="teaser" type="longchar" default="" hint="Mini intro for super hero biography." /> <cfproperty name="biography" type="longchar" default="" hint="Super hero biography." /> <cfproperty name="imgHero" type="string" hint="The image of the hero" /> </cfcomponent>
- Go to the FarCry Webtop and deploy the content type: ADMIN > Developer Utilities > COAPI Tools > Types
- Locate your new content type, "superHero" and select DEPLOY.
- Click on the [Scaffold] button now to create an Administration scaffold
- Select the checkbox next to "Create type admin interface",
- put in a title for your administration list
- select label and imgHero as the fields to appear in your list
Info title Basic Scaffolding The Scaffold option for deployed content types generates some sample code you can use to get started right away.
"Create type admin interface" creates a small XML file that generates a menu item for you in the FarCry webtop.
The framework provides a default edit handler and display view so no need to add anything else here just yet.
- Reload your Application. This time you will need to update the [Webtop] option
- Go to the Custom Content Tab. Locate your Super Hero admin and create some Heroes (or Villains!)
Info title Editing Content Types When you created your first superHero object you may have noticed a rudimentary edit handler allowing you to key in details, save and update. That's not actually part of the scaffold code that was generated at all. The edit handler is dynamically generated at run time based on the metadata associated with the superHero component's cfproperty tags. Ok. So its pretty minimalist now but wait.. it's only the beginning.
Warning title Wait Up! Make sure you understand the concept of extends, displayname and property type before the instructor starts babbling on about something else.
...
Code Block | ||
---|---|---|
| ||
<cfproperty name="imageSourceID" type="string"
ftSeq="2" ftFieldset="General Details" ftLabel="Source Image"
ftType="uuid" ftJoin="dmImage"
ftHint="Select an image from the image library or create a new image.">
<cfproperty name="imageCarousel" type="string"
ftSeq="3" ftFieldset="General Details" ftLabel="Carousel Image"
ftType="image" ftDestination="/images/dmCarouselItem/imageCarousel"
ftAllowUpload="false" ftSourceField="imageSourceID:SourceImage"
ftAutoGenerateType="center" ftImageWidth="620" ftImageHeight="200"
ftQuality="0.8" ftInterpolation="blackman">
<cfproperty name="imageThumbnail" type="string"
ftSeq="4" ftFieldset="General Details" ftLabel="Thumbnail Image"
ftType="image" ftDestination="/images/dmCarouselItem/imageThumbnail"
ftAllowUpload="false" ftSourceField="imageSourceID:SourceImage"
ftAutoGenerateType="center" ftImageWidth="95" ftImageHeight="30"
ftQuality="0.8" ftInterpolation="blackman"
ftHint="">
|