Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/alsonkemp/turbinado-website
Conflicts: App/Controllers/Page.hs App/Layouts/Default.hs App/Models/Bases/PageModelBase.hs App/Views/Develop/Index.hs
- Loading branch information
Showing
304 changed files
with
34,107 additions
and
632 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import App.Models.PageModel | ||
|
||
show :: Controller () | ||
show = do id' <- getSetting_u "id" | ||
p <- find id' | ||
setViewDataValue "page-title" (title p) | ||
setViewDataValue "page-content" (content p) | ||
|
||
list :: Controller () | ||
list = do pages <- findAllOrderBy "_id" | ||
setViewDataValue "component-pages-list" $ map (\p -> (title p, _id p)) pages | ||
|
||
listOnly :: Controller () | ||
listOnly = do prefix <- getSetting_u "pages-prefix" :: Controller String | ||
pages <- findAllWhereOrderBy "_id like ?" [toSql $ prefix ++ "%"] "_id" | ||
setViewDataValue "component-pages-list" $ map (\p -> (title p, _id p)) pages | ||
setSetting "component-view" "List" -- use the view from the List action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test :: Controller () | ||
test = return () |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
markup= <div class="page-listing"> | ||
<h1> | ||
Pages | ||
</h1> | ||
<% do l <- getViewDataValue_u "component-pages-list" :: View [(String, String)] | ||
mapM indexItem l | ||
%> | ||
</div> | ||
|
||
indexItem (t,i) = return $ cdata $ unlines $ | ||
["<div style='padding: 0pt 5px;'>" | ||
," <a href=\"" ++ i ++"\">" | ||
," "++ t | ||
," </a>" | ||
,"</div>" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
markup = <div class="page-content"> | ||
<h1><% getViewDataValue_u "page-title" :: View String %></h1> | ||
<% (getViewDataValue_u "page-content" :: View String) >>= (return . cdata) %> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
markup = <div> | ||
test | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
show :: Controller () | ||
show = return () | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,41 @@ | ||
import App.Models.PageModel | ||
import qualified Network.URI as URI | ||
|
||
index :: Controller () | ||
index = do conn <- liftIO $ fromJust $ databaseConnection | ||
pages <- liftIO $ findAll conn | ||
index = do pages <- findAll | ||
setViewDataValue "pages-list" $ map (\p -> (title p, _id p)) pages | ||
|
||
show :: Controller () | ||
show = do conn <- liftIO $ fromJust $ databaseConnection | ||
e <- get | ||
id' <- getSetting "id" | ||
case id' of | ||
Nothing -> redirectTo "/Home" | ||
Just i -> do p <- find conn i | ||
setViewDataValue "page-title" (title p) | ||
setViewDataValue "page-content" (content p) | ||
show = do id' <- getSetting_u "id" | ||
p <- find id' | ||
setViewDataValue "page-title" (title p) | ||
setViewDataValue "page-content" (content p) | ||
|
||
new :: Controller () | ||
new = do conn <- liftIO $ fromJust $ databaseConnection | ||
e <- get | ||
id' <- getSetting "id" | ||
case id' of | ||
Nothing -> redirectTo "/Home" | ||
Just i -> do setViewDataValue "save-url" ("/Page/Create/" ++ i) | ||
new = do id' <- getSetting_u "id" | ||
setViewDataValue "save-url" ("/Page/Create/" ++ id') | ||
|
||
create :: Controller () | ||
create = do conn <- liftIO $ fromJust $ databaseConnection | ||
e <- get | ||
id' <- getSetting "id" | ||
create = do id' <- getSetting_u "id" | ||
_title <- getParam_u "title" | ||
_content <- getParam_u "content" | ||
case id' of | ||
Nothing -> redirectTo "/Home" | ||
Just i -> do App.Models.PageModel.insert conn Page {_id = i, title = _title, content = _content} | ||
redirectTo $ "/Page/Show/" ++ i | ||
App.Models.PageModel.insert Page {_id = id', title = _title, content = _content} False | ||
redirectTo $ "/Page/Show/" ++ id' | ||
|
||
edit :: Controller () | ||
edit = do conn <- liftIO $ fromJust $ databaseConnection | ||
e <- get | ||
id' <- getSetting "id" | ||
case id' of | ||
Nothing -> redirectTo "/Home" | ||
Just i -> do p <- find conn i | ||
setViewDataValue "save-url" ("/Page/Save/" ++ i) | ||
setViewDataValue "page-title" (title p) | ||
setViewDataValue "page-content" (content p) | ||
edit = do id' <- getSetting_u "id" | ||
p <- find id' | ||
setViewDataValue "save-url" ("/Page/Save/" ++ id') | ||
setViewDataValue "page-title" (title p) | ||
setViewDataValue "page-content" (content p) | ||
|
||
save :: Controller () | ||
save = do conn <- liftIO $ fromJust $ databaseConnection | ||
e <- get | ||
id' <- getSetting "id" | ||
save = do id' <- getSetting_u "id" | ||
_title <- getParam_u "title" | ||
_content <- getParam_u "content" | ||
case id' of | ||
Nothing -> redirectTo "/Home" | ||
Just i -> do p <- find conn i | ||
App.Models.PageModel.update conn p {title = _title, content = _content} | ||
redirectTo $ "/Page/Show/" ++ i | ||
p <- find id' | ||
App.Models.PageModel.update p {title = _title, content = _content} | ||
redirectTo $ "/Page/Show/" ++ id' | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
index :: Controller () | ||
index = return () | ||
show :: Controller () | ||
show = return () | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.