summaryrefslogtreecommitdiff
path: root/Model.hs
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2015-03-24 16:14:43 +0100
committerFélix Sipma <felix.sipma@no-log.org>2015-03-24 17:29:07 +0100
commit2fc2df386d1856ff8e9eef642f5f3ca8f4e92984 (patch)
tree2a43fbde351164946beb258a6c22a4c970dbf0e4 /Model.hs
parentc2f90968da0c570c8df21216de8e6e8270baa446 (diff)
Model.Shop: add location field
* config/models: add location field to Shop * Model: add location field to Shop classes * add Handler.ShopPlaceList * templates/shop.hamlet: add map * templates/shop.cassius: add * templates/shop.julius: add * Handler.Shop: add map to getShopR * Form.Shop: add pointField * config/routes: add ShopPlaceListR route * Handler.ShopPlaceList: add * static/images/mp-marker-icon-shop.png: add * fix bug in Form.Fields.Point when editing pointField
Diffstat (limited to 'Model.hs')
-rw-r--r--Model.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Model.hs b/Model.hs
index 0339c59..ac38890 100644
--- a/Model.hs
+++ b/Model.hs
@@ -18,12 +18,13 @@ share [mkPersist sqlSettings, mkMigrate "migrateAll"]
instance ToJSON (Entity Shop) where
toJSON (Entity sid s) = object
- [ "id" .= (String $ toPathPiece sid)
- , "ident" .= (String $ shopIdent s)
- , "vendor" .= (String $ toPathPiece $ shopVendor s)
- , "image" .= maybe Null (String . toPathPiece) (shopImage s)
- , "created" .= shopCreated s
- , "updated" .= shopUpdated s
+ [ "id" .= (String $ toPathPiece sid)
+ , "ident" .= (String $ shopIdent s)
+ , "vendor" .= (String $ toPathPiece $ shopVendor s)
+ , "image" .= maybe Null (String . toPathPiece) (shopImage s)
+ , "location" .= [ toJSON $ pntLon $ shopLocation s, toJSON $ pntLat $ shopLocation s ]
+ , "created" .= shopCreated s
+ , "updated" .= shopUpdated s
]
instance FromJSON Shop where
@@ -31,6 +32,7 @@ instance FromJSON Shop where
<$> o .: "ident"
<*> o .: "vendor"
<*> o .:? "image"
+ <*> o .: "location"
<*> o .: "created"
<*> o .: "updated"