From 6c7ce8f1936b376fd9c01421ab8561dfea32726a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 14 Mar 2013 22:10:51 -0400 Subject: [PATCH] reorg repolist --- Assistant/WebApp/Configurators.hs | 32 +++++++++++++++++ Assistant/WebApp/Configurators/Pairing.hs | 1 + Assistant/WebApp/DashBoard.hs | 2 +- Assistant/WebApp/RepoList.hs | 34 ++----------------- .../list.hamlet => repolist.hamlet} | 0 .../list.julius => repolist.julius} | 0 6 files changed, 36 insertions(+), 33 deletions(-) rename templates/{configurators/repositories/list.hamlet => repolist.hamlet} (100%) rename templates/{configurators/repositories/list.julius => repolist.julius} (100%) diff --git a/Assistant/WebApp/Configurators.hs b/Assistant/WebApp/Configurators.hs index caa153c2af..1e57f503ca 100644 --- a/Assistant/WebApp/Configurators.hs +++ b/Assistant/WebApp/Configurators.hs @@ -10,6 +10,7 @@ module Assistant.WebApp.Configurators where import Assistant.WebApp.Common +import Assistant.WebApp.RepoList import Assistant.WebApp.Configurators.Local #ifdef WITH_XMPP import Assistant.XMPP.Client @@ -27,3 +28,34 @@ getConfigurationR = ifM (inFirstRun) #endif $(widgetFile "configurators/main") ) + +{- An intro message, list of repositories, and nudge to make more. -} +introDisplay :: Text -> Widget +introDisplay ident = do + webapp <- lift getYesod + repolist <- lift $ repoList $ RepoSelector + { onlyCloud = False + , onlyConfigured = True + , includeHere = False + } + let n = length repolist + let numrepos = show n + $(widgetFile "configurators/intro") + lift $ modifyWebAppState $ \s -> s { showIntro = False } + +{- Lists known repositories, followed by options to add more. -} +getRepositoriesR :: Handler RepHtml +getRepositoriesR = page "Repositories" (Just Repositories) $ do + let repolist = repoListDisplay $ RepoSelector + { onlyCloud = False + , onlyConfigured = False + , includeHere = True + } + $(widgetFile "configurators/repositories") + + +makeMiscRepositories :: Widget +makeMiscRepositories = $(widgetFile "configurators/repositories/misc") + +makeCloudRepositories :: Bool -> Widget +makeCloudRepositories onlyTransfer = $(widgetFile "configurators/repositories/cloud") diff --git a/Assistant/WebApp/Configurators/Pairing.hs b/Assistant/WebApp/Configurators/Pairing.hs index 83df2ea6ff..9feb48c368 100644 --- a/Assistant/WebApp/Configurators/Pairing.hs +++ b/Assistant/WebApp/Configurators/Pairing.hs @@ -12,6 +12,7 @@ module Assistant.WebApp.Configurators.Pairing where import Assistant.Pairing import Assistant.WebApp.Common +import Assistant.WebApp.Configurators import Assistant.Types.Buddies #ifdef WITH_PAIRING import Assistant.Pairing.Network diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs index 6e6fe2dbb4..7a910a8441 100644 --- a/Assistant/WebApp/DashBoard.hs +++ b/Assistant/WebApp/DashBoard.hs @@ -12,7 +12,7 @@ module Assistant.WebApp.DashBoard where import Assistant.WebApp.Common import Assistant.WebApp.Utility import Assistant.WebApp.Notifications -import Assistant.WebApp.RepoList +import Assistant.WebApp.Configurators import Assistant.TransferQueue import Utility.NotificationBroadcaster import Logs.Transfer diff --git a/Assistant/WebApp/RepoList.hs b/Assistant/WebApp/RepoList.hs index 2d2a3cbef2..e5f94c04b9 100644 --- a/Assistant/WebApp/RepoList.hs +++ b/Assistant/WebApp/RepoList.hs @@ -1,6 +1,6 @@ {- git-annex assistant webapp repository list - - - Copyright 2012 Joey Hess + - Copyright 2012,2013 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -30,36 +30,6 @@ import qualified Data.Map as M import qualified Data.Set as S import qualified Data.Text as T -{- An intro message, list of repositories, and nudge to make more. -} -introDisplay :: Text -> Widget -introDisplay ident = do - webapp <- lift getYesod - repolist <- lift $ repoList $ RepoSelector - { onlyCloud = False - , onlyConfigured = True - , includeHere = False - } - let n = length repolist - let numrepos = show n - $(widgetFile "configurators/intro") - lift $ modifyWebAppState $ \s -> s { showIntro = False } - -makeMiscRepositories :: Widget -makeMiscRepositories = $(widgetFile "configurators/repositories/misc") - -makeCloudRepositories :: Bool -> Widget -makeCloudRepositories onlyTransfer = $(widgetFile "configurators/repositories/cloud") - -{- Lists known repositories, followed by options to add more. -} -getRepositoriesR :: Handler RepHtml -getRepositoriesR = page "Repositories" (Just Repositories) $ do - let repolist = repoListDisplay $ RepoSelector - { onlyCloud = False - , onlyConfigured = False - , includeHere = True - } - $(widgetFile "configurators/repositories") - data Actions = DisabledRepoActions { setupRepoLink :: Route WebApp } @@ -113,7 +83,7 @@ repoListDisplay reposelector = do repolist <- lift $ repoList reposelector - $(widgetFile "configurators/repositories/list") + $(widgetFile "repolist") where ident = "repolist" diff --git a/templates/configurators/repositories/list.hamlet b/templates/repolist.hamlet similarity index 100% rename from templates/configurators/repositories/list.hamlet rename to templates/repolist.hamlet diff --git a/templates/configurators/repositories/list.julius b/templates/repolist.julius similarity index 100% rename from templates/configurators/repositories/list.julius rename to templates/repolist.julius