managed to insert a link into the footer

transplant to postgres successfull
This commit is contained in:
nek0 2015-08-24 16:53:04 +02:00
parent 8c52aad913
commit fff7f6fe5d
9 changed files with 33 additions and 12 deletions

View file

@ -33,8 +33,8 @@ import Data.Default (def)
import Yesod.Core.Types (loggerSet)
import Control.Monad.Logger (liftLoc, runLoggingT)
import Database.Persist.Sqlite (createSqlitePool, runSqlPool,
sqlDatabase, sqlPoolSize)
import Database.Persist.Postgresql (createPostgresqlPool, runSqlPool,
pgConnStr, pgPoolSize)
import Language.Haskell.TH.Syntax (qLocation)
import Network.Wai.Handler.Warp (Settings, defaultSettings,
defaultShouldDisplayException,
@ -99,9 +99,9 @@ makeFoundation appSettings = do
logFunc = messageLoggerSource tempFoundation appLogger
-- Create the database connection pool
pool <- flip runLoggingT logFunc $ createSqlitePool
(sqlDatabase $ appDatabaseConf appSettings)
(sqlPoolSize $ appDatabaseConf appSettings)
pool <- flip runLoggingT logFunc $ createPostgresqlPool
(pgConnStr $ appDatabaseConf appSettings)
(pgPoolSize $ appDatabaseConf appSettings)
-- Perform database migration using our application's logging settings.
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc

View file

@ -91,6 +91,9 @@ renderLayout widget = do
-- value passed to hamletToRepHtml cannot be a widget, this allows
-- you to use normal widget features in default-layout.
copyrightWidget <- widgetToPageContent $ do
$(widgetFile "copyrightFooter")
wc <- widgetToPageContent widget
pc <- widgetToPageContent $ do
@ -107,6 +110,7 @@ renderLayout widget = do
css_bootstrap_css
])
$(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
formLayout :: Widget -> Handler Html

View file

@ -27,7 +27,7 @@ import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?))
import Data.FileEmbed (embedFile)
import Data.Yaml (decodeEither')
import Database.Persist.Sqlite (SqliteConf)
import Database.Persist.Postgresql (PostgresConf)
import Language.Haskell.TH.Syntax (Exp, Name, Q)
import Network.Wai.Handler.Warp (HostPreference)
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
@ -40,7 +40,7 @@ import Yesod.Default.Util (WidgetFileSettings, widgetFileNoReload,
data AppSettings = AppSettings
{ appStaticDir :: String
-- ^ Directory from which to serve static files.
, appDatabaseConf :: SqliteConf
, appDatabaseConf :: PostgresConf
-- ^ Configuration settings for accessing the database.
, appRoot :: Text
-- ^ Base for all generated URLs.
@ -99,6 +99,7 @@ instance FromJSON AppSettings where
appSkipCombining <- o .:? "skip-combining" .!= defaultDev
appCopyright <- o .: "copyright"
appCopyrightLink <- o .: "copyrightLink"
appAnalytics <- o .:? "analytics"
appSignupBlocked <- o .: "signupBlocked"

View file

@ -34,10 +34,15 @@ ip-from-header: "_env:IP_FROM_HEADER:false"
# skip-combining: false
database:
database: "_env:SQLITE_DATABASE:eidolon.sqlite3"
poolsize: "_env:SQLITE_POOLSIZE:10"
user: "_env:PGUSER:eidolon"
password: "_env:PGPASS:eidolon"
host: "_env:PGHOST:localhost"
port: "_env:PGPORT:5432"
database: "_env:PGDATABASE:eidolon"
poolsize: "_env:PGPOOLSIZE:10"
copyright: Insert copyright statement here
copyright: Powered by Eidolon
copyrightLink: https://github.com/nek0/eidolon
#analytics: UA-YOURCODE
# block signup process

View file

@ -74,7 +74,7 @@ library
, bytestring >= 0.9
, text >= 0.11
, persistent >= 2.1.1.3
, persistent-sqlite >= 1.3
, persistent-postgresql >= 1.3
, persistent-template >= 1.3
, template-haskell
, shakespeare >= 2.0

View file

@ -150,6 +150,11 @@
font-size: 2.25em;
margin: 0 0 1em 0;
}
#footer a:hover
{
color: #D64760;
}
#footer .left
{

View file

@ -22,6 +22,11 @@
font-weight: 400;
}
figcaption
{
display:none;
}
a
{
color: #fff;

View file

@ -0,0 +1 @@
<a href=#{appCopyrightLink $ appSettings master} target=_blank>#{appCopyright $ appSettings master}

View file

@ -28,7 +28,7 @@ $maybe msg <- mmsg
^{pageBody wc}
<div id="footer">
<div class="left">
#{appCopyright $ appSettings master}
^{pageBody copyrightWidget}
<div class="right">
$case route
$of Just HomeR