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 Yesod.Core.Types (loggerSet)
import Control.Monad.Logger (liftLoc, runLoggingT) import Control.Monad.Logger (liftLoc, runLoggingT)
import Database.Persist.Sqlite (createSqlitePool, runSqlPool, import Database.Persist.Postgresql (createPostgresqlPool, runSqlPool,
sqlDatabase, sqlPoolSize) pgConnStr, pgPoolSize)
import Language.Haskell.TH.Syntax (qLocation) import Language.Haskell.TH.Syntax (qLocation)
import Network.Wai.Handler.Warp (Settings, defaultSettings, import Network.Wai.Handler.Warp (Settings, defaultSettings,
defaultShouldDisplayException, defaultShouldDisplayException,
@ -99,9 +99,9 @@ makeFoundation appSettings = do
logFunc = messageLoggerSource tempFoundation appLogger logFunc = messageLoggerSource tempFoundation appLogger
-- Create the database connection pool -- Create the database connection pool
pool <- flip runLoggingT logFunc $ createSqlitePool pool <- flip runLoggingT logFunc $ createPostgresqlPool
(sqlDatabase $ appDatabaseConf appSettings) (pgConnStr $ appDatabaseConf appSettings)
(sqlPoolSize $ appDatabaseConf appSettings) (pgPoolSize $ appDatabaseConf appSettings)
-- Perform database migration using our application's logging settings. -- Perform database migration using our application's logging settings.
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc 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 -- value passed to hamletToRepHtml cannot be a widget, this allows
-- you to use normal widget features in default-layout. -- you to use normal widget features in default-layout.
copyrightWidget <- widgetToPageContent $ do
$(widgetFile "copyrightFooter")
wc <- widgetToPageContent widget wc <- widgetToPageContent widget
pc <- widgetToPageContent $ do pc <- widgetToPageContent $ do
@ -107,6 +110,7 @@ renderLayout widget = do
css_bootstrap_css css_bootstrap_css
]) ])
$(widgetFile "default-layout") $(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
formLayout :: Widget -> Handler Html formLayout :: Widget -> Handler Html

View file

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

View file

@ -34,10 +34,15 @@ ip-from-header: "_env:IP_FROM_HEADER:false"
# skip-combining: false # skip-combining: false
database: database:
database: "_env:SQLITE_DATABASE:eidolon.sqlite3" user: "_env:PGUSER:eidolon"
poolsize: "_env:SQLITE_POOLSIZE:10" 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 #analytics: UA-YOURCODE
# block signup process # block signup process

View file

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

View file

@ -151,6 +151,11 @@
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
#footer a:hover
{
color: #D64760;
}
#footer .left #footer .left
{ {
display: inline-block; display: inline-block;

View file

@ -22,6 +22,11 @@
font-weight: 400; font-weight: 400;
} }
figcaption
{
display:none;
}
a a
{ {
color: #fff; 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} ^{pageBody wc}
<div id="footer"> <div id="footer">
<div class="left"> <div class="left">
#{appCopyright $ appSettings master} ^{pageBody copyrightWidget}
<div class="right"> <div class="right">
$case route $case route
$of Just HomeR $of Just HomeR