From 336c06b4ffc3896f0e7d3bf068610c0df62cf6b6 Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 24 Aug 2015 16:53:04 +0200 Subject: [PATCH] managed to insert a link into the footer --- Application.hs | 10 +++++----- Foundation.hs | 4 ++++ Settings.hs | 5 +++-- config/settings.yml | 11 ++++++++--- eidolon.cabal | 2 +- static/css/style-desktop.css | 5 +++++ static/css/style-global.css | 5 +++++ templates/copyrightFooter.hamlet | 1 + templates/default-layout.hamlet | 2 +- 9 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 templates/copyrightFooter.hamlet diff --git a/Application.hs b/Application.hs index 95839c7..d556031 100644 --- a/Application.hs +++ b/Application.hs @@ -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 diff --git a/Foundation.hs b/Foundation.hs index 00b119a..49c0c2d 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -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 diff --git a/Settings.hs b/Settings.hs index c12ad09..18d52fa 100644 --- a/Settings.hs +++ b/Settings.hs @@ -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" diff --git a/config/settings.yml b/config/settings.yml index 483d6a2..5f9a9fd 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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 diff --git a/eidolon.cabal b/eidolon.cabal index 5026b7b..4e1952a 100644 --- a/eidolon.cabal +++ b/eidolon.cabal @@ -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 diff --git a/static/css/style-desktop.css b/static/css/style-desktop.css index 10573a4..2418e93 100644 --- a/static/css/style-desktop.css +++ b/static/css/style-desktop.css @@ -150,6 +150,11 @@ font-size: 2.25em; margin: 0 0 1em 0; } + + #footer a:hover + { + color: #D64760; + } #footer .left { diff --git a/static/css/style-global.css b/static/css/style-global.css index 36be992..b0e79ee 100644 --- a/static/css/style-global.css +++ b/static/css/style-global.css @@ -22,6 +22,11 @@ font-weight: 400; } + figcaption + { + display:none; + } + a { color: #fff; diff --git a/templates/copyrightFooter.hamlet b/templates/copyrightFooter.hamlet new file mode 100644 index 0000000..b29efed --- /dev/null +++ b/templates/copyrightFooter.hamlet @@ -0,0 +1 @@ +#{appCopyright $ appSettings master} diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index aa90f57..01025db 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -28,7 +28,7 @@ $maybe msg <- mmsg ^{pageBody wc}