Course display etwas erweitert.
This commit is contained in:
parent
3fbeed2682
commit
1fe7362a30
@ -25,10 +25,9 @@ getCourseListR = redirect TermShowR
|
||||
|
||||
getCourseListTermR :: TermIdentifier -> Handler Html
|
||||
getCourseListTermR tidini = do
|
||||
(term,courses) <- runDB $ do
|
||||
term <- get $ TermKey tidini
|
||||
courses <- selectList [CourseTermId ==. TermKey tidini] [Asc CourseShorthand]
|
||||
return (term, courses)
|
||||
(term,courses) <- runDB $ (,)
|
||||
<$> get (TermKey tidini)
|
||||
<*> selectList [CourseTermId ==. TermKey tidini] [Asc CourseShorthand]
|
||||
when (isNothing term) $ do
|
||||
setMessage [shamlet| Semester #{termToText tidini} nicht gefunden. |]
|
||||
redirect TermShowR
|
||||
@ -57,7 +56,12 @@ getCourseListTermR tidini = do
|
||||
|
||||
getCourseShowR :: TermIdentifier -> Text -> Handler Html
|
||||
getCourseShowR tid csh = do
|
||||
courseEnt <- runDB $ getBy404 $ CourseTermShort (TermKey tid) csh
|
||||
(courseEnt,(schoolMB,participants)) <- runDB $ do
|
||||
courseEnt@(Entity cid course) <- getBy404 $ CourseTermShort (TermKey tid) csh
|
||||
dependent <- (,)
|
||||
<$> get (courseSchoolId course)
|
||||
<*> count [CourseParticipantCourseId ==. cid]
|
||||
return $ (courseEnt,dependent)
|
||||
let course = entityVal courseEnt
|
||||
defaultLayout $ do
|
||||
setTitle $ [shamlet| #{termToText tid} - #{csh}|]
|
||||
|
||||
@ -3,37 +3,27 @@
|
||||
<div .row>
|
||||
<h1 .header>
|
||||
#{courseName course}
|
||||
|
||||
$maybe school <- schoolMB
|
||||
<h4>
|
||||
#{schoolName school}
|
||||
<div .container>
|
||||
<div .bs-docs-section>
|
||||
<div .row>
|
||||
<div .col-lg-12>
|
||||
<div .page-header>
|
||||
<h1 #start>Beschreibung
|
||||
<div .page-header>
|
||||
|
||||
$maybe descr <- courseDescription course
|
||||
<h2 #description>Beschreibung
|
||||
<p> #{descr}
|
||||
|
||||
|
||||
<p>
|
||||
You can also use this scaffolded site to explore some concepts, and best practices.
|
||||
|
||||
|
||||
<li .list-group-item>
|
||||
We can link to other handlers, like the <a href="@{ProfileR}">Profile</a>.
|
||||
Try it out as an anonymous user and see the access denied.
|
||||
Then, try to <a href="@{AuthR LoginR}">login</a> with the dummy authentication added
|
||||
while in development.
|
||||
|
||||
<li .list-group-item>
|
||||
The HTML you are seeing now is actually composed by a number of <em>widgets</em>, #
|
||||
most of them are brought together by the <tt>defaultLayout</tt> function which #
|
||||
is defined in the <tt>Foundation.hs</tt> module,
|
||||
All the files for templates and wigdets are in <tt>templates</tt>.
|
||||
|
||||
<li .list-group-item>
|
||||
A Widget's Html, Css and Javascript are separated in three files with the
|
||||
<tt>.hamlet</tt>, <tt>.lucius</tt> and <tt>.julius</tt> extensions.
|
||||
$maybe link <- courseLinkExternal course
|
||||
<h4 #linl>Homepage:
|
||||
<a href=#{link}>#{link}
|
||||
<div .row>
|
||||
<div .col-lg-12>
|
||||
<h4>Teilnehmer
|
||||
#{participants}
|
||||
$maybe capacity <- courseCapacity course
|
||||
\ von #{capacity}
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user