summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assistant/WebApp/Configurators.hs38
-rw-r--r--Assistant/WebApp/DashBoard.hs2
-rw-r--r--Assistant/WebApp/Documentation.hs2
-rw-r--r--Assistant/WebApp/SideBar.hs9
-rw-r--r--Assistant/WebApp/routes7
-rw-r--r--templates/configurators/addrepository.hamlet62
-rw-r--r--templates/configurators/listrepositories.hamlet9
-rw-r--r--templates/configurators/main.hamlet56
-rw-r--r--templates/configurators/main/sidebar.hamlet18
-rw-r--r--templates/sidebar/main.hamlet5
10 files changed, 103 insertions, 105 deletions
diff --git a/Assistant/WebApp/Configurators.hs b/Assistant/WebApp/Configurators.hs
index 018f97363..2771a2284 100644
--- a/Assistant/WebApp/Configurators.hs
+++ b/Assistant/WebApp/Configurators.hs
@@ -35,46 +35,52 @@ getConfigR :: Handler RepHtml
getConfigR = ifM (inFirstRun)
( getFirstRepositoryR
, bootstrap (Just Config) $ do
- sideBarDisplay $ Just sidebar
+ sideBarDisplay
setTitle "Configuration"
$(widgetFile "configurators/main")
)
- where
- sidebar = do
- (_repolist, numrepos, notenough, barelyenough, morethanenough)
- <- lift repoList
- $(widgetFile "configurators/main/sidebar")
{- Lists different types of repositories that can be added. -}
getAddRepositoryR :: Handler RepHtml
getAddRepositoryR = bootstrap (Just Config) $ do
- sideBarDisplay Nothing
+ sideBarDisplay
setTitle "Add repository"
$(widgetFile "configurators/addrepository")
-{- A numbered list of known repositories, including the current one,
- - as well as the total number, and whether that is not enough,
- - barely enough, or more than enough. -}
-repoList :: Handler ([(String, String)], String, Bool, Bool, Bool)
+{- Lists known repositories. -}
+getListRepositoriesR :: Handler RepHtml
+getListRepositoriesR = bootstrap (Just Config) $ do
+ sideBarDisplay
+ setTitle "Repository list"
+ repolist <- lift repoList
+ $(widgetFile "configurators/listrepositories")
+
+{- A numbered list of known repositories, including the current one. -}
+repoList :: Handler [(String, String)]
repoList = do
l <- runAnnex [] $ do
u <- getUUID
rs <- map Remote.uuid <$> Remote.remoteList
rs' <- snd <$> trustPartition DeadTrusted rs
Remote.prettyListUUIDs $ filter (/= webUUID) $ nub $ u:rs'
- let n = length l
- return (zip counter l, show (length l), n < enough, n == enough, n > enough)
+ return $ zip counter l
where
counter = map show ([1..] :: [Int])
- enough = 2
{- An intro message, list of repositories, and nudge to make more. -}
introDisplay :: Text -> Widget
introDisplay ident = do
webapp <- lift getYesod
- (repolist, numrepos, notenough, barelyenough, morethanenough) <- lift repoList
+ repolist <- lift repoList
+ let n = length repolist
+ let numrepos = show n
+ let notenough = n < enough
+ let barelyenough = n == enough
+ let morethanenough = n > enough
$(widgetFile "configurators/intro")
lift $ modifyWebAppState $ \s -> s { showIntro = False }
+ where
+ enough = 2
data RepositoryPath = RepositoryPath Text
deriving Show
@@ -160,7 +166,7 @@ addLocalRepositoryForm msg = do
getFirstRepositoryR :: Handler RepHtml
getFirstRepositoryR = bootstrap (Just Config) $ do
- sideBarDisplay Nothing
+ sideBarDisplay
setTitle "Getting started"
((res, form), enctype) <- lift $ runFormGet addLocalRepositoryForm
case res of
diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs
index 32159c22d..8e526fb1d 100644
--- a/Assistant/WebApp/DashBoard.hs
+++ b/Assistant/WebApp/DashBoard.hs
@@ -68,7 +68,7 @@ getTransfersR nid = do
{- The main dashboard. -}
dashboard :: Bool -> Widget
dashboard warnNoScript = do
- sideBarDisplay Nothing
+ sideBarDisplay
let content = transfersDisplay warnNoScript
$(widgetFile "dashboard/main")
diff --git a/Assistant/WebApp/Documentation.hs b/Assistant/WebApp/Documentation.hs
index 530c4ceb3..b0a9e4d98 100644
--- a/Assistant/WebApp/Documentation.hs
+++ b/Assistant/WebApp/Documentation.hs
@@ -17,6 +17,6 @@ import Yesod
getAboutR :: Handler RepHtml
getAboutR = bootstrap (Just About) $ do
- sideBarDisplay Nothing
+ sideBarDisplay
setTitle "About git-annex"
$(widgetFile "documentation/about")
diff --git a/Assistant/WebApp/SideBar.hs b/Assistant/WebApp/SideBar.hs
index 2fbd4e8c0..4373b5a5b 100644
--- a/Assistant/WebApp/SideBar.hs
+++ b/Assistant/WebApp/SideBar.hs
@@ -22,11 +22,8 @@ import Data.Text (Text)
import qualified Data.Map as M
import Control.Concurrent
-sideBarDisplay :: Maybe Widget -> Widget
-sideBarDisplay onsidebar = do
- {- If a widget was passed to include on the sidebar, display
- - it above alerts. -}
- let perpage = maybe noop id onsidebar
+sideBarDisplay :: Widget
+sideBarDisplay = do
let content = do
{- Any yesod message appears as the first alert. -}
maybe noop rendermessage =<< lift getMessage
@@ -86,7 +83,7 @@ getSideBarR nid = do
- to avoid slowing down user actions like closing alerts. -}
liftIO $ threadDelay 100000
- page <- widgetToPageContent $ sideBarDisplay Nothing
+ page <- widgetToPageContent sideBarDisplay
hamletToRepHtml $ [hamlet|^{pageBody page}|]
{- Called by the client to close an alert. -}
diff --git a/Assistant/WebApp/routes b/Assistant/WebApp/routes
index 893ba79fe..12b9564ee 100644
--- a/Assistant/WebApp/routes
+++ b/Assistant/WebApp/routes
@@ -1,11 +1,12 @@
/ HomeR GET
/noscript NoScriptR GET
-/noscriptauto NoScriptAutoR GET
+/noscript/auto NoScriptAutoR GET
/about AboutR GET
/config ConfigR GET
-/config/addrepository AddRepositoryR GET
-/config/firstrepository FirstRepositoryR GET
+/config/repository/add AddRepositoryR GET
+/config/repository/first FirstRepositoryR GET
+/config/repository/list ListRepositoriesR GET
/transfers/#NotificationId TransfersR GET
/sidebar/#NotificationId SideBarR GET
diff --git a/templates/configurators/addrepository.hamlet b/templates/configurators/addrepository.hamlet
index 1f793c2a5..d91286ad8 100644
--- a/templates/configurators/addrepository.hamlet
+++ b/templates/configurators/addrepository.hamlet
@@ -1,10 +1,52 @@
-<div .row-fluid>
- <div .span4>
- <h3>
- Clone to removable drive
- <p>
- Clone this repository to a USB drive, or other removable media, #
- for offline archiving, backups, or to #
- <a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
- between computers.
-
+<div .span9>
+ <h2>
+ Add repositories
+ <div .row-fluid>
+ <div .span4>
+ <h3>
+ <a href="">
+ Clone to a removable drive
+ <p>
+ Clone this repository to a USB drive, memory stick, or other #
+ removable media.
+ <p>
+ For offline archiving, backups, or to #
+ <a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
+ between computers.
+ <div .span4>
+ <h3>
+ <a href="">
+ Pair with a local computer
+ <p>
+ Automatically keep files in sync between computers on your #
+ local network.
+ <p>
+ For easy sharing with family and friends, or between your devices.
+ <div .span4>
+ <h3>
+ <a href="">
+ Connect to your phone
+ <p>
+ Save photos and recordings from your phone.
+ <p>
+ Send selected files to your phone.
+ <div .row-fluid>
+ <div .span4>
+ <h3>
+ <a href="">
+ Store data in the cloud
+ <p>
+ Store your data on a third-party cloud platform, #
+ including Amazon S3, Box.com, and Rsync.net.
+ <p>
+ Pay someone to keep your data safe and available. #
+ With strong encryption to protect your privacy.
+ <div .span4>
+ <h3>
+ <a href="">
+ Clone to a remote server
+ <p>
+ Set up a repository on a remote server using #
+ <tt>ssh</tt> or <tt>rsync</tt>.
+ <p>
+ To use your own personal cloud.
diff --git a/templates/configurators/listrepositories.hamlet b/templates/configurators/listrepositories.hamlet
new file mode 100644
index 000000000..22a6910de
--- /dev/null
+++ b/templates/configurators/listrepositories.hamlet
@@ -0,0 +1,9 @@
+<div .span9>
+ <table .table .table-striped .table-condensed>
+ <tbody>
+ $forall (num, name) <- repolist
+ <tr>
+ <td>
+ #{num}
+ <td>
+ #{name}
diff --git a/templates/configurators/main.hamlet b/templates/configurators/main.hamlet
index 929b22437..c974eeb5d 100644
--- a/templates/configurators/main.hamlet
+++ b/templates/configurators/main.hamlet
@@ -1,53 +1,15 @@
<div .span9>
- <h2>
- Add repositories #
- <small>
<div .row-fluid>
<div .span4>
<h3>
- <a href="">
- Clone to a removable drive
- <p>
- Clone this repository to a USB drive, memory stick, or other #
- removable media.
- <p>
- For offline archiving, backups, or to #
- <a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
- between computers.
+ <a href="@{AddRepositoryR}">
+ Add repositories
+ <p>
+ Distribute the files in this repository to other devices;
+ make backups; and more by adding repositories.
<div .span4>
<h3>
- <a href="">
- Pair with a local computer
- <p>
- Automatically keep files in sync between computers on your #
- local network.
- <p>
- For easy sharing with family and friends, or between your devices.
- <div .span4>
- <h3>
- <a href="">
- Connect to your phone
- <p>
- Save photos and recordings from your phone.
- <p>
- Send selected files to your phone.
- <div .row-fluid>
- <div .span4>
- <h3>
- <a href="">
- Store data in the cloud
- <p>
- Store your data on a third-party cloud platform, #
- including Amazon S3, Box.com, and Rsync.net.
- <p>
- Pay someone to keep your data safe and available. #
- With strong encryption to protect your privacy.
- <div .span4>
- <h3>
- <a href="">
- Clone to a remote server
- <p>
- Set up a repository on a remote server using #
- <tt>ssh</tt> or <tt>rsync</tt>.
- <p>
- To use your own personal cloud.
+ <a href="@{ListRepositoriesR}">
+ Repository list
+ <p>
+ An overview of your repositories.
diff --git a/templates/configurators/main/sidebar.hamlet b/templates/configurators/main/sidebar.hamlet
deleted file mode 100644
index 3d427f8c5..000000000
--- a/templates/configurators/main/sidebar.hamlet
+++ /dev/null
@@ -1,18 +0,0 @@
-<div .alert .alert-info>
- <h4 .alert-heading>
- git-annex is managing #
- $if notenough
- only #
- <span .badge .badge-error>#{numrepos}</span> repository. #
- $else
- $if barelyenough
- <span .badge .badge-warning>#{numrepos}</span> repositories. #
- $else
- <span .badge .badge-success>#{numrepos}</span> repositories. #
- $if notenough
- Recommend you add more clones to avoid data loss.
- $else
- $if barelyenough
- Consider adding more.
- $else
- Adding more can't hurt!
diff --git a/templates/sidebar/main.hamlet b/templates/sidebar/main.hamlet
index 63f201cf1..32900b920 100644
--- a/templates/sidebar/main.hamlet
+++ b/templates/sidebar/main.hamlet
@@ -1,4 +1,3 @@
-<div .span3>
- ^{perpage}
- <div .sidebar-nav ##{ident}>
+<div .span3 ##{ident}>
+ <div .sidebar-nav>
^{content}