module Resource ( module Resource.Author, module Resource.Book, module Resource.ExampleAppTag, ) where import Text.YuiGrid import RESTng.System import RESTng.Resources (comments, ratings, resourceTags) import Resource.Author (Author, authorProxy) import Resource.Book (Book, bookProxy) import Resource.ExampleAppTag(ExampleAppTag, exampleAppTagProxy) ------------------------ -- Resource Annotations ------------------------ instance AnnotatedResource Author where annotations = [ nearRight $ setColumnsVote 2 $ childComponent bookProxy, nearBottom $ setColumnsVote 2 $ giveBorderCSS $ (dummyStringAnnotation "Tags") `absorveAnn` resourceTags ] instance AnnotatedResource Book where annotations = (parentComponent authorProxy) : map (smallMarginBottomCSS) [ nearTop $ dummyStringAnnotation "This is a dummy annotation on the top of the book to illustrate a box here", nearRight $ setColumnsVote 3 $ dummyStringAnnotation "Other dummy annotation box here to show 3 columns", setColumnsVote 3 $ comments, nearBottom $ setColumnsVote 2 $ nearRight $ giveBorderCSS $ ratings, nearBottom $ setColumnsVote 2 $ giveBorderCSS $ (dummyStringAnnotation "Tags") `absorveAnn` resourceTags ] instance AnnotatedResource ExampleAppTag where annotations = [parentListComponent [ParentBox authorProxy, ParentBox bookProxy] ] ------------------------ -- Resource CRUDs ------------------------ instance CRUDable Author where canGetCreationForm = everybodyCan canCreate = everybodyCan canRetrieve = everybodyCan canUpdate = everybodyCan canDelete = everybodyCan instance CRUDable Book where canGetCreationForm = everybodyCan canCreate = everybodyCan canRetrieve = everybodyCan canUpdate = everybodyCan canDelete = everybodyCan instance CRUDable ExampleAppTag where canGetCreationForm = everybodyCan canCreate = everybodyCan canRetrieve = everybodyCan canUpdate = everybodyCan canDelete = everybodyCan