drop down menu for each repository with edit, disable, delete

This commit is contained in:
Joey Hess 2013-04-03 21:26:38 -04:00
parent 37d7da4de8
commit a886c3b56d
4 changed files with 30 additions and 11 deletions

View file

@ -27,16 +27,20 @@ import System.IO.HVFS (SystemFS(..))
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Map as M import qualified Data.Map as M
notCurrentRepo :: UUID -> Handler RepHtml -> Handler RepHtml
notCurrentRepo uuid a = go =<< liftAnnex (Remote.remoteFromUUID uuid)
where
go Nothing = redirect DeleteCurrentRepositoryR
go (Just _) = a
getDisableRepositoryR :: UUID -> Handler RepHtml getDisableRepositoryR :: UUID -> Handler RepHtml
getDisableRepositoryR uuid = do getDisableRepositoryR uuid = notCurrentRepo uuid $ do
void $ liftAssistant $ disableRemote uuid void $ liftAssistant $ disableRemote uuid
redirect DashboardR redirect DashboardR
getDeleteRepositoryR :: UUID -> Handler RepHtml getDeleteRepositoryR :: UUID -> Handler RepHtml
getDeleteRepositoryR uuid = go =<< liftAnnex (Remote.remoteFromUUID uuid) getDeleteRepositoryR uuid = notCurrentRepo uuid $
where deletionPage $ do
go Nothing = redirect DeleteCurrentRepositoryR
go (Just r) = deletionPage $ do
reponame <- liftAnnex $ Remote.prettyUUID uuid reponame <- liftAnnex $ Remote.prettyUUID uuid
$(widgetFile "configurators/delete/start") $(widgetFile "configurators/delete/start")

View file

@ -1,6 +1,9 @@
<div .span9 .hero-unit> <div .span9 .hero-unit>
<h2> <h2>
Configuring repository $if new
Repository created
$else
Editing repository
$if new $if new
<p> <p>
This repository is set up and ready to go! This repository is set up and ready to go!
@ -20,10 +23,8 @@
<div .form-actions> <div .form-actions>
<button .btn .btn-primary type=submit> <button .btn .btn-primary type=submit>
Save Changes # Save Changes #
<a href="@{DashboardR}"> <a .btn href="@{DashboardR}">
Cancel # Cancel #
<a href="@{DeleteRepositoryR uuid}">
Delete repository
$if new $if new
<p> <p>
In a hurry? Feel free to skip this step! You can always come back # In a hurry? Feel free to skip this step! You can always come back #

View file

@ -2,11 +2,15 @@
<li> <li>
<a href="@{NewRepositoryR}"> <a href="@{NewRepositoryR}">
<i .icon-plus-sign></i> Add another local repository <i .icon-plus-sign></i> Add another local repository
<li>
<a href="@{RepositorySwitcherR}"> <a href="@{RepositorySwitcherR}">
<i .icon-folder-close></i> Switch repository <i .icon-folder-close></i> Switch repository
<li>
<a href="@{RestartR}"> <a href="@{RestartR}">
<i .icon-repeat></i> Restart daemon <i .icon-repeat></i> Restart daemon
<li>
<a href="@{ShutdownR}"> <a href="@{ShutdownR}">
<i .icon-off></i> Shutdown daemon <i .icon-off></i> Shutdown daemon
<li>
<a href="@{LogR}"> <a href="@{LogR}">
<i .icon-list></i> View log <i .icon-list></i> View log

View file

@ -32,8 +32,18 @@
<a href="@{setupRepoLink actions}"> <a href="@{setupRepoLink actions}">
enable enable
$else $else
<a href="@{setupRepoLink actions}"> <span .dropdown #menu-#{fromUUID uuid}>
configure <a .dropdown-toggle data-toggle="dropdown" href="#menu-#{fromUUID uuid}">
<i .icon-cog></i> settings
<b .caret></b>
<ul .dropdown-menu>
<li>
<a href="@{setupRepoLink actions}">
<i .icon-pencil></i> Edit
<a href="@{DisableRepositoryR uuid}">
<i .icon-minus></i> Disable
<a href="@{DeleteRepositoryR uuid}">
<i .icon-trash></i> Delete
$if addmore $if addmore
<tr> <tr>
<td colspan="3"> <td colspan="3">