more parallelism

This commit is contained in:
nek0 2015-01-11 20:06:44 +01:00
parent aef34a52b2
commit 4a4815bbe3
8 changed files with 60 additions and 43 deletions

View file

@ -4,6 +4,7 @@ import Import
import Handler.Commons import Handler.Commons
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.List as L import qualified Data.List as L
import Data.Maybe
import System.FilePath import System.FilePath
import System.Directory import System.Directory
@ -50,7 +51,7 @@ getAdminAlbumSettingsR albumId = do
entities <- runDB $ selectList [UserId !=. (albumOwner album)] [Desc UserName] entities <- runDB $ selectList [UserId !=. (albumOwner album)] [Desc UserName]
users <- return $ map (\u -> (userName $ entityVal u, entityKey u)) entities users <- return $ map (\u -> (userName $ entityVal u, entityKey u)) entities
(adminAlbumSettingsWidget, enctype) <- generateFormPost $ adminAlbumSettingsForm album albumId users (adminAlbumSettingsWidget, enctype) <- generateFormPost $ adminAlbumSettingsForm album albumId users
defaultLayout $ do formLayout $ do
setTitle "Administration: Album settings" setTitle "Administration: Album settings"
$(widgetFile "adminAlbumSet") $(widgetFile "adminAlbumSet")
Nothing -> do Nothing -> do
@ -73,7 +74,7 @@ postAdminAlbumSettingsR albumId = do
((res, _), _) <- runFormPost $ adminAlbumSettingsForm album albumId users ((res, _), _) <- runFormPost $ adminAlbumSettingsForm album albumId users
case res of case res of
FormSuccess temp -> do FormSuccess temp -> do
width <- getThumbWidth $ albumSamplePic temp width <- getThumbWidth $ Just $ L.tail $ fromMaybe ['a'] $ albumSamplePic temp
_ <- runDB $ update albumId _ <- runDB $ update albumId
[ AlbumTitle =. albumTitle temp [ AlbumTitle =. albumTitle temp
, AlbumShares =. albumShares temp , AlbumShares =. albumShares temp

View file

@ -1,10 +1,13 @@
$newline always $newline always
<h3>Media from #{albumTitle album} <div id="header" class="item" data-width="400">
<div class="inner">
<h1>Media from #{albumTitle album}
$if null media $if null media
#{albumTitle album} has no media yet <p>#{albumTitle album} has no media yet
$else
<ul>
$forall (Entity mId m) <- media $forall (Entity mId m) <- media
<li> <article class="item" data-width="200">
<a href=@{AdminMediumSettingsR mId}>#{mediumTitle m} <a href=@{AdminMediumSettingsR mId}>#{mediumTitle m}
<figure class="thumbnail">
<img src=#{mediumThumb m}>
<figcaption>#{mediumTitle m}

View file

@ -1,15 +1,14 @@
$newline always $newline always
<h3>Album settings <div id="header" class="item" data-width="400">
<form class="inner" method="post" enctype=#{enctype}>
<div class="left"> <h1>Album settings
<form method="post" enctype=#{enctype}>
^{adminAlbumSettingsWidget} ^{adminAlbumSettingsWidget}
<div> <div>
<input type=submit value="Change settings"> <input type=submit value="Change settings">
<a href=@{AdminAlbumDeleteR albumId}>Delete this album <a href=@{AdminAlbumDeleteR albumId}>Delete this album
<div class="right"> <div id="header" class="item" data-width="200">
<ul> <div class="inner">
<li> <p>
<a href=@{AdminAlbumMediaR albumId}>Media in this album <a href=@{AdminAlbumMediaR albumId}>Media in this album

View file

@ -1,10 +1,16 @@
$newline always $newline always
<h3>Albums <div id="header" class="item" data-width="400">
<div class="inner">
<h1>Albums
$if null albums $if null albums
There are no albums yet <p>There are no albums yet
$else
$forall (Entity aId a) <- albums $forall (Entity aId a) <- albums
<ul> <article class="item" data-width=#{albumSampleWidth a}>
<li>
<a href=@{AdminAlbumSettingsR aId}>#{albumTitle a} <a href=@{AdminAlbumSettingsR aId}>#{albumTitle a}
<figure class="thumbnail">
$if (albumSamplePic a) == Nothing
<img src="/static/img/album.jpg">
$else
<img src=#{T.pack $ fromJust $ albumSamplePic a}>
<figcaption>#{albumTitle a}

View file

@ -1,10 +1,13 @@
$newline always $newline always
<h3>Media <div id="header" class="item" data-width="400">
<div class="inner">
<h1>Media
$if null media $if null media
There are no media yet <p>There are no media yet
$else
<ul>
$forall (Entity mId m) <- media $forall (Entity mId m) <- media
<li> <article class="item" data-width=#{mediumThumbWidth m}>
<a href=@{AdminMediumSettingsR mId}>#{mediumTitle m} <a href=@{AdminMediumSettingsR mId}>#{mediumTitle m}
<figure class="thumbnail">
<img src=#{mediumThumb m}>
<figcaption>#{mediumTitle m}

View file

@ -7,7 +7,11 @@ $newline always
#{userSlug owner} has no albums yet #{userSlug owner} has no albums yet
$forall (Entity aId a) <- albums $forall (Entity aId a) <- albums
<div id="header" class="item" data-width="200"> <article class="item" data-width=#{albumSampleWidth a}>
<div class="inner">
<p>
<a href=@{AdminAlbumSettingsR aId}>#{albumTitle a} <a href=@{AdminAlbumSettingsR aId}>#{albumTitle a}
<figure class="thumbnail">
$if (albumSamplePic a) == Nothing
<img src="/static/img/album.jpg">
$else
<img src=#{T.pack $ fromJust $ albumSamplePic a}>
<figcaption>#{albumTitle a}

View file

@ -7,7 +7,8 @@ $newline always
#{userSlug owner} has no media yet #{userSlug owner} has no media yet
$forall (Entity mId m) <- media $forall (Entity mId m) <- media
<div id="header" class="item" data-width="200"> <article class="item" data-width=#{mediumThumbWidth m}>
<div class="inner">
<p>
<a href=@{AdminMediumSettingsR mId}>#{mediumTitle m} <a href=@{AdminMediumSettingsR mId}>#{mediumTitle m}
<figure class="thumbnail">
<img src=#{mediumThumb m}>
<figcaption>#{mediumTitle m}

View file

@ -18,7 +18,7 @@ $forall (Entity albumId album) <- userAlbs
<a href=@{AlbumR albumId}> <a href=@{AlbumR albumId}>
<figure class="thumbnail"> <figure class="thumbnail">
$if (albumSamplePic album) == Nothing $if (albumSamplePic album) == Nothing
<img src="/static/img/album.jpg"><br> <img src="/static/img/album.jpg">
$else $else
<img src=#{T.pack $ fromJust $ albumSamplePic album}> <img src=#{T.pack $ fromJust $ albumSamplePic album}>
<figcaption>#{albumTitle album} <figcaption>#{albumTitle album}
@ -34,7 +34,7 @@ $else
<a href=@{AlbumR albumId}> <a href=@{AlbumR albumId}>
<figure class="thumbnail"> <figure class="thumbnail">
$if (albumSamplePic album) == Nothing $if (albumSamplePic album) == Nothing
<img src="/static/img/album.jpg"><br> <img src="/static/img/album.jpg">
$else $else
<img src=#{T.pack $ fromJust $ albumSamplePic album}> <img src=#{T.pack $ fromJust $ albumSamplePic album}>
<figcaption>#{albumTitle album} <figcaption>#{albumTitle album}