[paginated table uses templates
thomashartman1@gmail.com**20080921125212] hunk ./src/Controller.hs 111
- jobTable = paintTable (Just ["project","budget"]) jobCells (Just p)
+ jobTable = paintTable (templates rglobs) (Just ["project","budget"]) jobCells (Just p)
hunk ./src/View.hs 81
+menuLink :: STGroup String
+ -> Maybe [Char]
+ -> String
+ -> (String, String)
+ -> String
hunk ./src/View.hs 97
-paintTable :: Maybe [String] -> [[String]] -> Maybe Pagination -> String
-paintTable mbHeaderCells datacells mbPagination =
+--paintTable :: [String] -> Maybe [String] -> [[String]] -> Maybe Pagination -> String
+paintTable templates mbHeaderCells datacells mbPagination =
hunk ./src/View.hs 102
- tableCells = fromTo fromRow toRow datacells
- (fromRow,toRow) = maybe (1,(length datacells))
- (\pg -> currentPaginationFromTo datacells pg)
- mbPagination
- paginationBar = maybe "" (paintPaginationBar datacells) mbPagination
+ tableCells :: [[String]]
+ tableCells = maybe datacells (getPaginatedCells datacells) mbPagination
+
+ paginationBar :: String
+ paginationBar = maybe "" (paintPaginationBar templates datacells) mbPagination
hunk ./src/ViewPagination.hs 1
+{-# LANGUAGE NoMonomorphismRestriction #-}
hunk ./src/ViewPagination.hs 5
-
+import Misc
+import Text.StringTemplate
hunk ./src/ViewPagination.hs 16
-paintPaginationBar datacells pg =
- (paginationtitle pg) ++ ( concat . intersperse " | "
- . map f $ (paginationRanges pg datacells) )
- where f range = case range of
+paintPaginationBar :: STGroup String -> [[String]] -> Pagination -> String
+paintPaginationBar templates datacells pg =
+ let r = renderTemplateGroup templates
+ paintlink range = case range of
hunk ./src/ViewPagination.hs 21
- (firstval,fr):xs -> let to = last . map snd $ xs
- in "" ++ (show fr) ++ " to " ++ (show to) ++ ""
+ (_,fr):xs -> let to = last . map snd $ xs
+ attrs = [("baselink",baselink pg),("from",show fr),("to",show to)]
+ in r attrs "paginationlinkunselected"
+
+ pglinks = map paintlink $ (paginationRanges pg datacells )
+
+ in (paginationtitle pg) ++ ( concat . intersperse " | " $ pglinks )
+
+
hunk ./src/ViewPagination.hs 31
+getPaginatedCells datacells pg = fromTo fromRow toRow datacells
+ where (fromRow,toRow) = currentPaginationFromTo datacells pg
addfile ./templates/paginationlinkunselected.st
hunk ./templates/paginationlinkunselected.st 1
+
+